stop installing rake and json on every bootstrap

Fixes #11102
This commit is contained in:
Joao Duarte 2019-08-30 18:16:39 +01:00 committed by João Duarte
parent 16c085588f
commit 6842aba9eb
4 changed files with 31 additions and 19 deletions

View file

@ -6,7 +6,7 @@ gem "logstash-core", :path => "./logstash-core"
gem "logstash-core-plugin-api", :path => "./logstash-core-plugin-api"
gem "atomic", "~> 1"
gem "builder", "~> 3"
gem "json", "~> 1.8.3"
gem "json", "~> 1"
gem "paquet", "~> 0.2"
gem "pleaserun", "~>0.0.28"
gem "rake", "~> 12"

View file

@ -119,35 +119,43 @@ clean {
delete "${projectDir}/build/rubyDependencies.csv"
}
task bootstrap {
doLast {
rake(projectDir, buildDir, 'plugin:install-base')
}
}
def assemblyDeps = [downloadAndInstallJRuby, assemble] + subprojects.collect {
it.tasks.findByName("assemble")
}
task installDefaultGems(dependsOn: assemblyDeps) {
task installBundler(dependsOn: assemblyDeps) {
outputs.files file("${projectDir}/vendor/bundle/bin/bundle")
doLast {
gem(projectDir, buildDir, "bundler", "1.17.3", "${projectDir}/vendor/bundle/jruby/2.5.0")
}
}
task bootstrap(dependsOn: installBundler) {
doLast {
setupJruby(projectDir, buildDir)
}
}
task installDefaultGems(dependsOn: bootstrap) {
doLast {
rake(projectDir, buildDir, 'plugin:install-default')
}
}
task installTestGems(dependsOn: assemblyDeps) {
task installTestGems(dependsOn: bootstrap) {
doLast {
rake(projectDir, buildDir, 'plugin:install-development-dependencies')
}
}
task compileGrammar(dependsOn: assemblyDeps) {
task compileGrammar(dependsOn: bootstrap) {
doLast {
rake(projectDir, buildDir, 'compile:grammar')
}
}
task assembleTarDistribution(dependsOn: assemblyDeps) {
task assembleTarDistribution(dependsOn: bootstrap) {
inputs.files fileTree("${projectDir}/rakelib")
inputs.files fileTree("${projectDir}/bin")
inputs.files fileTree("${projectDir}/config")
@ -163,7 +171,7 @@ task assembleTarDistribution(dependsOn: assemblyDeps) {
}
}
task assembleOssTarDistribution(dependsOn: assemblyDeps) {
task assembleOssTarDistribution(dependsOn: bootstrap) {
inputs.files fileTree("${projectDir}/rakelib")
inputs.files fileTree("${projectDir}/bin")
inputs.files fileTree("${projectDir}/config")
@ -177,7 +185,7 @@ task assembleOssTarDistribution(dependsOn: assemblyDeps) {
}
}
task assembleZipDistribution(dependsOn: assemblyDeps) {
task assembleZipDistribution(dependsOn: bootstrap) {
inputs.files fileTree("${projectDir}/rakelib")
inputs.files fileTree("${projectDir}/bin")
inputs.files fileTree("${projectDir}/config")
@ -193,7 +201,7 @@ task assembleZipDistribution(dependsOn: assemblyDeps) {
}
}
task assembleOssZipDistribution(dependsOn: assemblyDeps) {
task assembleOssZipDistribution(dependsOn: bootstrap) {
inputs.files fileTree("${projectDir}/rakelib")
inputs.files fileTree("${projectDir}/bin")
inputs.files fileTree("${projectDir}/config")

View file

@ -1,5 +1,4 @@
namespace "artifact" do
gem 'json', '~> 1'
SNAPSHOT_BUILD = ENV["RELEASE"] != "1"
VERSION_QUALIFIER = ENV["VERSION_QUALIFIER"]

View file

@ -29,6 +29,7 @@ ext {
gem = this.&gem
buildGem = this.&buildGem
rake = this.&rake
setupJruby = this.&setupJruby
generateRubySupportFilesForPlugin = this.&generateRubySupportFilesForPlugin
validatePluginJar = this.&validatePluginJar
versionMap = new HashMap()
@ -129,6 +130,14 @@ void rake(File projectDir, File buildDir, String task) {
}
}
void setupJruby(File projectDir, File buildDir) {
executeJruby projectDir, buildDir, { ScriptingContainer jruby ->
jruby.currentDirectory = projectDir
jruby.runScriptlet("require '${projectDir}/lib/bootstrap/environment'")
jruby.runScriptlet("LogStash::Bundler.invoke!")
}
}
/**
* Executes Closure using a fresh JRuby environment, safely tearing it down afterwards.
* @param projectDir Gradle projectDir
@ -247,10 +256,6 @@ task downloadAndInstallJRuby(dependsOn: [verifyFile, installCustomJRuby], type:
includeEmptyDirs = false
into "${projectDir}/vendor/jruby"
doLast {
gem(projectDir, buildDir, "rake", "12.3.1", "${projectDir}/vendor/bundle/jruby/2.5.0")
gem(projectDir, buildDir, "json", "1.8.6", "${projectDir}/vendor/bundle/jruby/2.5.0")
}
}
downloadAndInstallJRuby.onlyIf { customJRubyDir == "" }