@@ -34,39 +34,52 @@ buildscript {
3434 mavenCentral()
3535 gradlePluginPortal()
3636 }
37-
38- dependencies {
39- classpath ' gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0'
40- }
4137}
4238
4339repositories {
4440 mavenCentral()
4541}
4642
47- apply plugin : ' com.github.johnrengelman.shadow'
48-
49- shadowJar {
50- classifier = null
51- }
52-
5343dependencies {
5444 testImplementation ' org.apache.logging.log4j:log4j-core:2.17.1'
5545
5646 implementation ' io.netty:netty-all:4.1.65.Final'
5747 implementation group : ' commons-io' , name : ' commons-io' , version : ' 2.8.0' // used from Netty
58- implementation ' org.apache.logging.log4j:log4j-api:2.17.1'
59-
48+ compileOnly ' org.apache.logging.log4j:log4j-api:2.17.1' // provided by Logstash
49+ compileOnly group : ' org.jruby ' , name : ' jruby-complete ' , version : " 9.1.13.0 " // provided by Logstash
6050 // 1.60 effectively means jruby-openssl >= 0.10.2 (logstash > 6.7)
61- compileOnly group : ' org.bouncycastle' , name : ' bcpkix-jdk15on' , version : " 1.60"
51+ compileOnly group : ' org.bouncycastle' , name : ' bcpkix-jdk15on' , version : " 1.60" // provided by Logstash (JRuby-OpenSSL)
6252}
6353
64- task vendor (dependsOn : shadowJar) {
54+ task generateGemJarRequiresFile {
55+ doLast {
56+ File jars_file = file(' lib/logstash-input-tcp_jars.rb' )
57+ jars_file. newWriter(). withWriter { w ->
58+ w << " # AUTOGENERATED BY THE GRADLE SCRIPT. DO NOT EDIT.\n\n "
59+ w << " require \' jar_dependencies\'\n "
60+ configurations. runtimeClasspath. allDependencies. each {
61+ w << " require_jar(\' ${ it.group} \' , \' ${ it.name} \' , \' ${ it.version} \' )\n "
62+ }
63+ w << " \n require_jar(\' ${ project.group} \' , \' ${ project.name} \' , \' ${ project.version} \' )\n "
64+ }
65+ }
66+ }
67+
68+ task vendor {
6569 doLast {
6670 String vendorPathPrefix = " vendor/jar-dependencies"
71+ configurations. runtimeClasspath. allDependencies. each { dep ->
72+ File f = configurations. runtimeClasspath. filter { it. absolutePath. contains(" ${ dep.group} /${ dep.name} /${ dep.version} " ) }. singleFile
73+ String groupPath = dep. group. replaceAll(' \\ .' , ' /' )
74+ File newJarFile = file(" ${ vendorPathPrefix} /${ groupPath} /${ dep.name} /${ dep.version} /${ dep.name} -${ dep.version} .jar" )
75+ newJarFile. mkdirs()
76+ Files . copy(f. toPath(), newJarFile. toPath(), REPLACE_EXISTING )
77+ }
6778 String projectGroupPath = project. group. replaceAll(' \\ .' , ' /' )
6879 File projectJarFile = file(" ${ vendorPathPrefix} /${ projectGroupPath} /${ project.name} /${ project.version} /${ project.name} -${ project.version} .jar" )
6980 projectJarFile. mkdirs()
7081 Files . copy(file(" $buildDir /libs/${ project.name} -${ project.version} .jar" ). toPath(), projectJarFile. toPath(), REPLACE_EXISTING )
7182 }
7283}
84+
85+ vendor. dependsOn(jar, generateGemJarRequiresFile)
0 commit comments