Skip to content

Commit

Permalink
update JAR dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
yaauie committed Nov 11, 2022
1 parent 9fb2f67 commit 10686a3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
5 changes: 3 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ end

task :vendor => :install_jars

Rake::Task["test"].clear
task :test do
require 'rspec'
require 'rspec/core/runner'
Rake::Task[:install_jars].invoke
sh './gradlew test'
exit(RSpec::Core::Runner.run(Rake::FileList['spec/**/*_spec.rb']))
sh(%{./gradlew test}) { |ok,res| exit(res) unless ok }
exit(RSpec::Core::Runner.run(%w(--format documentation).concat(Rake::FileList['spec/**/*_spec.rb'])))
end
25 changes: 15 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies {
testImplementation 'org.hamcrest:hamcrest-library:1.3'
testImplementation "org.apache.logging.log4j:log4j-core:${log4jVersion}"

implementation 'io.netty:netty-all:4.1.65.Final'
implementation 'io.netty:netty-all:4.1.68.Final'
compileOnly "org.apache.logging.log4j:log4j-api:${log4jVersion}" // provided by Logstash
}

Expand All @@ -51,9 +51,12 @@ 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.resolvedConfiguration.resolvedArtifacts
.collect {it.owner}
.sort { it.group }
.each {
w << "require_jar(\'${it.group}\', \'${it.name}\', \'${it.version}\')\n"
}
w << "require_jar(\'${project.group}\', \'${project.name}\', \'${project.version}\')\n"
}
}
Expand All @@ -62,12 +65,14 @@ 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.resolvedConfiguration.resolvedArtifacts.each { artifact ->
ModuleVersionIdentifier dep = artifact.owner
File f = artifact.file

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")
Expand Down

0 comments on commit 10686a3

Please sign in to comment.