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 (#433)

In PR #432 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 #432
  • Loading branch information
andsel authored Oct 28, 2021
1 parent f18e4a3 commit 8026068
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 @@ -56,14 +56,12 @@ task run (type: JavaExec, dependsOn: classes){
}

task generateGemJarRequiresFile {
configurations.implementation.canBeResolved = true

doLast {
File jars_file = file('lib/logstash-input-beats_jars.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"
}
w << "require_jar(\'${project.group}\', \'${project.name}\', \'${project.version}\')\n"
Expand All @@ -74,8 +72,8 @@ task generateGemJarRequiresFile {
task vendor {
doLast {
String vendorPathPrefix = "vendor/jar-dependencies"
configurations.implementation.allDependencies.each { dep ->
File f = configurations.implementation.filter { it.absolutePath.contains("${dep.group}/${dep.name}/${dep.version}") }.singleFile
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()
Expand Down

0 comments on commit 8026068

Please sign in to comment.