diff --git a/.gitignore b/.gitignore index 7b97ccd..f682c3f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ *.gem -Gemfile.lock .bundle vendor .idea @@ -10,4 +9,5 @@ build *.ipr out .rakeTasks - +Gemfile.lock +lib/logstash-input-beats_jars.rb \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d73dd47..07dc542 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,12 @@ +## 6.2.7 + - Build: skip shadowing jar dependencies [#187](https://github.com/logstash-plugins/logstash-input-tcp/pull/187) + * plugin no longer shadows dependencies into its *logstash-input-tcp.jar* + * log4j-api is now a provided dependency and is no longer packaged with the plugin + ## 6.2.6 - [DOC] Fix incorrect pipeline code snippet [#194](https://github.com/logstash-plugins/logstash-input-tcp/pull/194) - Update log4j dependency to 2.17.1 [#196](https://github.com/logstash-plugins/logstash-input-tcp/pull/196) - + ## 6.2.5 - Update log4j dependency to 2.17.0 diff --git a/build.gradle b/build.gradle index 0b0d2a0..bcda498 100644 --- a/build.gradle +++ b/build.gradle @@ -34,39 +34,52 @@ buildscript { mavenCentral() gradlePluginPortal() } - - dependencies { - classpath 'gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0' - } } repositories { mavenCentral() } -apply plugin: 'com.github.johnrengelman.shadow' - -shadowJar { - classifier = null -} - dependencies { testImplementation 'org.apache.logging.log4j:log4j-core:2.17.1' implementation 'io.netty:netty-all:4.1.65.Final' implementation group: 'commons-io', name: 'commons-io', version: '2.8.0' // used from Netty - implementation 'org.apache.logging.log4j:log4j-api:2.17.1' - + compileOnly 'org.apache.logging.log4j:log4j-api:2.17.1' // provided by Logstash + compileOnly group: 'org.jruby', name: 'jruby-complete', version: "9.1.13.0" // provided by Logstash // 1.60 effectively means jruby-openssl >= 0.10.2 (logstash > 6.7) - compileOnly group: 'org.bouncycastle', name: 'bcpkix-jdk15on', version: "1.60" + compileOnly group: 'org.bouncycastle', name: 'bcpkix-jdk15on', version: "1.60" // provided by Logstash (JRuby-OpenSSL) } -task vendor(dependsOn: shadowJar) { +task generateGemJarRequiresFile { + doLast { + File jars_file = file('lib/logstash-input-tcp_jars.rb') + jars_file.newWriter().withWriter { w -> + w << "# AUTOGENERATED BY THE GRADLE SCRIPT. DO NOT EDIT.\n\n" + w << "require \'jar_dependencies\'\n" + configurations.runtimeClasspath.allDependencies.each { + w << "require_jar(\'${it.group}\', \'${it.name}\', \'${it.version}\')\n" + } + w << "\nrequire_jar(\'${project.group}\', \'${project.name}\', \'${project.version}\')\n" + } + } +} + +task vendor { doLast { String vendorPathPrefix = "vendor/jar-dependencies" + configurations.runtimeClasspath.allDependencies.each { dep -> + File f = configurations.runtimeClasspath.filter { it.absolutePath.contains("${dep.group}/${dep.name}/${dep.version}") }.singleFile + String groupPath = dep.group.replaceAll('\\.', '/') + File newJarFile = file("${vendorPathPrefix}/${groupPath}/${dep.name}/${dep.version}/${dep.name}-${dep.version}.jar") + newJarFile.mkdirs() + Files.copy(f.toPath(), newJarFile.toPath(), REPLACE_EXISTING) + } String projectGroupPath = project.group.replaceAll('\\.', '/') File projectJarFile = file("${vendorPathPrefix}/${projectGroupPath}/${project.name}/${project.version}/${project.name}-${project.version}.jar") projectJarFile.mkdirs() Files.copy(file("$buildDir/libs/${project.name}-${project.version}.jar").toPath(), projectJarFile.toPath(), REPLACE_EXISTING) } } + +vendor.dependsOn(jar, generateGemJarRequiresFile) diff --git a/lib/logstash-input-tcp_jars.rb b/lib/logstash-input-tcp_jars.rb deleted file mode 100644 index 3c07cae..0000000 --- a/lib/logstash-input-tcp_jars.rb +++ /dev/null @@ -1,4 +0,0 @@ -# encoding: utf-8 - -require 'jar_dependencies' -require_jar('org.logstash.inputs', 'logstash-input-tcp', ::File.read(::File.join(::File.dirname(__FILE__), '../version')).split("\n").first) diff --git a/version b/version index 09d22fa..d938f42 100644 --- a/version +++ b/version @@ -1 +1 @@ -6.2.6 +6.2.7