Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ lib/jars
.ci
.gradle
.idea
build
build
lib/logstash-input-file_jars.rb
27 changes: 19 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,11 @@ task generateGemJarRequiresFile {
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"
configurations.runtimeClasspath.incoming.artifacts.artifacts.each { artifact ->
def id = artifact.id.componentIdentifier
if (id instanceof org.gradle.api.artifacts.component.ModuleComponentIdentifier) {
w << "require_jar(\'${id.group}\', \'${id.module}\', \'${id.version}\')\n"
}
}
w << "\nrequire_jar(\'${project.group}\', \'${project.name}\', \'${project.version}\')\n"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes do not change any behavior but interestingly, project JAR isn't used anywhere (I was expecting require "logstash-input-file_jars"), some files seems (watched_files_collection.rb -> WatchedFilesCollection?) referencing.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. I think given the only dep is an old jruby version i'm guessing there just are not really any deps needed. I think for consistency across projects its fine to just do this update anyway.

}
Expand All @@ -76,13 +79,21 @@ task generateGemJarRequiresFile {
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)
configurations.runtimeClasspath.incoming.artifacts.artifacts.each { artifact ->
def id = artifact.id.componentIdentifier
if (id instanceof org.gradle.api.artifacts.component.ModuleComponentIdentifier) {
String name = id.module
String version = id.version
String groupPath = group.replaceAll('\\.', '/')
File newJarFile = file("${vendorPathPrefix}/${groupPath}/${name}/${version}/${name}-${version}.jar")
if (!newJarFile.parentFile.exists()) {
newJarFile.parentFile.mkdirs()
}
Files.copy(artifact.file.toPath(), newJarFile.toPath(), REPLACE_EXISTING)
}
}

// Copy the project jar into vendor/jar-dependencies
String projectGroupPath = project.group.replaceAll('\\.', '/')
File projectJarFile = file("${vendorPathPrefix}/${projectGroupPath}/${project.name}/${project.version}/${project.name}-${project.version}.jar")
projectJarFile.mkdirs()
Expand Down