Skip to content

Commit

Permalink
Switch to 'runtimeClasspath' instead of resolve 'implementation' conf…
Browse files Browse the repository at this point in the history
…iguration (#70)

In PR #69 the build.gradle was updated to run on Gradle 7, part of the change consisted in
forcing the resolution of 'implementation' configuration to use it in the listing of dependencies.
This could be assolved by the 'runtimeClasspath' without forcing the resolution which smells like a trick.

Relates #69
  • Loading branch information
andsel committed Oct 28, 2021
1 parent 3b8783a commit 683d3e0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,23 @@ dependencies {


task generateGemJarRequiresFile {
configurations.implementation.canBeResolved = true
doLast {
File jars_file = file('lib/logstash-input-azure_event_hubs.rb')
jars_file.newWriter().withWriter { w ->
w << "# AUTOGENERATED BY THE GRADLE SCRIPT. DO NOT EDIT.\n\n"
w << "require \'jar_dependencies\'\n"
configurations.implementation.allDependencies.each {
configurations.runtimeClasspath.allDependencies.each {
w << "require_jar(\'${it.group}\', \'${it.name}\', \'${it.version}\')\n"
}
}
}
}

task vendor {
configurations.implementation.canBeResolved = true
doLast {
String vendorPathPrefix = "vendor/jar-dependencies"
configurations.implementation.allDependencies.each { dep ->
File f = configurations.implementation.filter { it.absolutePath.contains("${dep.group}" + File.separator + "${dep.name}" + File.separator + "${dep.version}") }.singleFile
configurations.runtimeClasspath.allDependencies.each { dep ->
File f = configurations.runtimeClasspath.filter { it.absolutePath.contains("${dep.group}" + File.separator + "${dep.name}" + File.separator + "${dep.version}") }.singleFile
String groupPath = dep.group.replaceAll('\\.', '/')
File newJarFile = file("${vendorPathPrefix}" + File.separator + "${groupPath}" + File.separator + "${dep.name}"+ File.separator + "${dep.version}" + File.separator + "${dep.name}-${dep.version}.jar")
newJarFile.mkdirs()
Expand Down

0 comments on commit 683d3e0

Please sign in to comment.