Installing libxml2-dev libxslt-dev is only needed on TruffleRuby < 21.1

* TruffleRuby >= 21.1 installs nokogiri with the packaged libxml2/libxslt
  like on CRuby by default. See https://github.com/oracle/truffleruby/issues/62
This commit is contained in:
Benoit Daloze
2021-08-07 20:08:38 +02:00
parent 7edf159e98
commit 57d46d78b7
3 changed files with 14 additions and 14 deletions
+5 -5
View File
@@ -40,12 +40,12 @@ function readBundledWithFromGemfileLock(lockFile) {
return null return null
} }
async function afterLockFile(lockFile, platform, engine) { async function afterLockFile(lockFile, platform, engine, rubyVersion) {
if (engine.startsWith('truffleruby') && platform.startsWith('ubuntu-')) { if (engine.startsWith('truffleruby') && common.floatVersion(rubyVersion) < 21.1 && platform.startsWith('ubuntu-')) {
const contents = fs.readFileSync(lockFile, 'utf8') const contents = fs.readFileSync(lockFile, 'utf8')
if (contents.includes('nokogiri')) { if (contents.includes('nokogiri')) {
await common.measure('Installing libxml2-dev libxslt-dev, required to install nokogiri on TruffleRuby', async () => await common.measure('Installing libxml2-dev libxslt-dev, required to install nokogiri on TruffleRuby < 21.1', async () =>
exec.exec('sudo', ['apt-get', '-yqq', 'install', 'libxml2-dev', 'libxslt-dev'], { silent: true })) exec.exec('sudo', ['apt-get', '-yqq', 'install', 'libxml2-dev', 'libxslt-dev'], { silent: true }))
} }
} }
} }
@@ -126,7 +126,7 @@ export async function bundleInstall(gemfile, lockFile, platform, engine, rubyVer
await exec.exec('bundle', ['lock'], envOptions) await exec.exec('bundle', ['lock'], envOptions)
} }
await afterLockFile(lockFile, platform, engine) await afterLockFile(lockFile, platform, engine, rubyVersion)
// cache key // cache key
const paths = [cachePath] const paths = [cachePath]
Generated Vendored
+7 -7
View File
@@ -54,12 +54,12 @@ function readBundledWithFromGemfileLock(lockFile) {
return null return null
} }
async function afterLockFile(lockFile, platform, engine) { async function afterLockFile(lockFile, platform, engine, rubyVersion) {
if (engine.startsWith('truffleruby') && platform.startsWith('ubuntu-')) { if (engine.startsWith('truffleruby') && common.floatVersion(rubyVersion) < 21.1 && platform.startsWith('ubuntu-')) {
const contents = fs.readFileSync(lockFile, 'utf8') const contents = fs.readFileSync(lockFile, 'utf8')
if (contents.includes('nokogiri')) { if (contents.includes('nokogiri')) {
await common.measure('Installing libxml2-dev libxslt-dev, required to install nokogiri on TruffleRuby', async () => await common.measure('Installing libxml2-dev libxslt-dev, required to install nokogiri on TruffleRuby < 21.1', async () =>
exec.exec('sudo', ['apt-get', '-yqq', 'install', 'libxml2-dev', 'libxslt-dev'], { silent: true })) exec.exec('sudo', ['apt-get', '-yqq', 'install', 'libxml2-dev', 'libxslt-dev'], { silent: true }))
} }
} }
} }
@@ -140,7 +140,7 @@ async function bundleInstall(gemfile, lockFile, platform, engine, rubyVersion, b
await exec.exec('bundle', ['lock'], envOptions) await exec.exec('bundle', ['lock'], envOptions)
} }
await afterLockFile(lockFile, platform, engine) await afterLockFile(lockFile, platform, engine, rubyVersion)
// cache key // cache key
const paths = [cachePath] const paths = [cachePath]
@@ -59472,11 +59472,11 @@ async function setupRuby(options = {}) {
const [gemfile, lockFile] = bundler.detectGemfiles() const [gemfile, lockFile] = bundler.detectGemfiles()
const bundlerVersion = await common.measure('Installing Bundler', async () => const bundlerVersion = await common.measure('Installing Bundler', async () =>
bundler.installBundler(inputs['bundler'], lockFile, platform, rubyPrefix, engine, version)) bundler.installBundler(inputs['bundler'], lockFile, platform, rubyPrefix, engine, version))
if (inputs['bundler-cache'] === 'true') { if (inputs['bundler-cache'] === 'true') {
await common.measure('bundle install', async () => await common.measure('bundle install', async () =>
bundler.bundleInstall(gemfile, lockFile, platform, engine, version, bundlerVersion, inputs['cache-version'])) bundler.bundleInstall(gemfile, lockFile, platform, engine, version, bundlerVersion, inputs['cache-version']))
} }
} }
+2 -2
View File
@@ -64,11 +64,11 @@ export async function setupRuby(options = {}) {
const [gemfile, lockFile] = bundler.detectGemfiles() const [gemfile, lockFile] = bundler.detectGemfiles()
const bundlerVersion = await common.measure('Installing Bundler', async () => const bundlerVersion = await common.measure('Installing Bundler', async () =>
bundler.installBundler(inputs['bundler'], lockFile, platform, rubyPrefix, engine, version)) bundler.installBundler(inputs['bundler'], lockFile, platform, rubyPrefix, engine, version))
if (inputs['bundler-cache'] === 'true') { if (inputs['bundler-cache'] === 'true') {
await common.measure('bundle install', async () => await common.measure('bundle install', async () =>
bundler.bundleInstall(gemfile, lockFile, platform, engine, version, bundlerVersion, inputs['cache-version'])) bundler.bundleInstall(gemfile, lockFile, platform, engine, version, bundlerVersion, inputs['cache-version']))
} }
} }