Skip to content

Commit

Permalink
remove custom bundler installation
Browse files Browse the repository at this point in the history
  • Loading branch information
jsvd committed Jun 16, 2023
1 parent afb6363 commit b98846d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 33 deletions.
30 changes: 3 additions & 27 deletions build.gradle
Expand Up @@ -290,18 +290,8 @@ def assemblyDeps = [downloadAndInstallJRuby, assemble] + subprojects.collect {
it.tasks.findByName("assemble")
}

def bundlerVersion = "~> 2"

tasks.register("installBundler") {
dependsOn assemblyDeps
outputs.files file("${projectDir}/vendor/bundle/jruby/2.6.0/bin/bundle")
doLast {
gem(projectDir, buildDir, "bundler", bundlerVersion, "${projectDir}/vendor/bundle/jruby/2.6.0")
}
}

tasks.register("bootstrap") {
dependsOn installBundler
dependsOn assemblyDeps
doLast {
setupJruby(projectDir, buildDir)
}
Expand Down Expand Up @@ -417,19 +407,9 @@ tasks.register("unpackTarDistribution", Copy) {

def qaBuildPath = "${buildDir}/qa/integration"
def qaVendorPath = "${qaBuildPath}/vendor"
def qaBundledGemPath = "${qaVendorPath}/jruby/2.6.0".toString()
def qaBundleBin = "${qaBundledGemPath}/bin/bundle"

tasks.register("installIntegrationTestBundler"){
dependsOn unpackTarDistribution
outputs.files file("${qaBundleBin}")
doLast {
gem(projectDir, buildDir, "bundler", bundlerVersion, qaBundledGemPath)
}
}

tasks.register("installIntegrationTestGems") {
dependsOn installIntegrationTestBundler
dependsOn unpackTarDistribution
def gemfilePath = file("${projectDir}/qa/integration/Gemfile")
inputs.files gemfilePath
inputs.files file("${projectDir}/qa/integration/integration_tests.gemspec")
Expand All @@ -439,11 +419,7 @@ tasks.register("installIntegrationTestGems") {
outputs.files fileTree("${qaVendorPath}")
outputs.files file("${projectDir}/qa/integration/Gemfile.lock")
doLast {
bundleWithEnv(
projectDir, buildDir,
qaBuildPath, qaBundleBin, ['install', '--path', qaVendorPath, '--gemfile', gemfilePath],
[ GEM_PATH: qaBundledGemPath, GEM_HOME: qaBundledGemPath ]
)
bundleQAGems(projectDir, qaBuildPath)
}
}

Expand Down
5 changes: 0 additions & 5 deletions rakelib/artifacts.rake
Expand Up @@ -99,11 +99,6 @@ namespace "artifact" do
@exclude_paths << 'vendor/**/gems/**/Gemfile.lock'
@exclude_paths << 'vendor/**/gems/**/Gemfile'

# jruby's bundler artifacts
@exclude_paths << 'vendor/jruby/bin/bundle*'
@exclude_paths << 'vendor/jruby/lib/ruby/stdlib/bundler*'
@exclude_paths << 'vendor/jruby/lib/ruby/gems/shared/specifications/default/bundler-*.gemspec'
@exclude_paths << 'vendor/jruby/lib/ruby/gems/shared/gems/bundler-*'
@exclude_paths << 'vendor/jruby/lib/ruby/gems/shared/gems/rake-*'

@exclude_paths
Expand Down
18 changes: 17 additions & 1 deletion rubyUtils.gradle
Expand Up @@ -46,6 +46,7 @@ import java.nio.file.Paths
ext {
bundle = this.&bundle
bundleWithEnv = this.&bundleWithEnv
bundleQAGems = this.&bundleQAGems
gem = this.&gem
buildGem = this.&buildGem
rake = this.&rake
Expand Down Expand Up @@ -87,6 +88,21 @@ void bundleWithEnv(File projectDir, File buildDir, String pwd, String bundleBin,
}
}

void bundleQAGems(File projectDir, String qaBuildPath) {
def jruby = new ScriptingContainer()
jruby.setLoadPaths(["${projectDir}/vendor/jruby/lib/ruby/stdlib".toString()])
try {
jruby.currentDirectory = qaBuildPath
jruby.runScriptlet("""
require "bundler/cli"
Bundler::CLI.start(['install', '--path', "${qaBuildPath}/vendor", '--gemfile', "${projectDir}/qa/integration/Gemfile"])
""")
} finally {
jruby.terminate()
Ruby.clearGlobalRuntime()
}
}

/**
* Installs a Gem with the given version to the given path.
* @param projectDir Gradle projectDir
Expand Down Expand Up @@ -169,7 +185,7 @@ Object executeJruby(File projectDir, File buildDir, Closure<?> /* Object*/ block
def jruby = new ScriptingContainer()
def env = jruby.environment
def gemDir = "${projectDir}/vendor/bundle/jruby/2.6.0".toString()
jruby.setLoadPaths(["${projectDir}/vendor/bundle/jruby/2.6.0/gems/bundler-2.4.13/lib".toString(), "${projectDir}/vendor/jruby/lib/ruby/stdlib".toString()])
jruby.setLoadPaths(["${projectDir}/vendor/jruby/lib/ruby/stdlib".toString()])
env.put "USE_RUBY", "1"
env.put "GEM_HOME", gemDir
env.put "GEM_SPEC_CACHE", "${buildDir}/cache".toString()
Expand Down

0 comments on commit b98846d

Please sign in to comment.