Skip to content

Commit 038acbe

Browse files
authored
Build: skip shadowing jar dependencies (#187)
1 parent f60633f commit 038acbe

File tree

5 files changed

+36
-22
lines changed

5 files changed

+36
-22
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
*.gem
2-
Gemfile.lock
32
.bundle
43
vendor
54
.idea
@@ -10,4 +9,5 @@ build
109
*.ipr
1110
out
1211
.rakeTasks
13-
12+
Gemfile.lock
13+
lib/logstash-input-beats_jars.rb

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
## 6.2.7
2+
- Build: skip shadowing jar dependencies [#187](https://github.com/logstash-plugins/logstash-input-tcp/pull/187)
3+
* plugin no longer shadows dependencies into its *logstash-input-tcp.jar*
4+
* log4j-api is now a provided dependency and is no longer packaged with the plugin
5+
16
## 6.2.6
27
- [DOC] Fix incorrect pipeline code snippet [#194](https://github.com/logstash-plugins/logstash-input-tcp/pull/194)
38
- Update log4j dependency to 2.17.1 [#196](https://github.com/logstash-plugins/logstash-input-tcp/pull/196)
4-
9+
510
## 6.2.5
611
- Update log4j dependency to 2.17.0
712

build.gradle

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -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

4339
repositories {
4440
mavenCentral()
4541
}
4642

47-
apply plugin: 'com.github.johnrengelman.shadow'
48-
49-
shadowJar {
50-
classifier = null
51-
}
52-
5343
dependencies {
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 << "\nrequire_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)

lib/logstash-input-tcp_jars.rb

Lines changed: 0 additions & 4 deletions
This file was deleted.

version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.2.6
1+
6.2.7

0 commit comments

Comments
 (0)