-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(compass, hadron-build): only run electron-rebuild on linux
- Loading branch information
1 parent
1f2efe8
commit 83dfdba
Showing
4 changed files
with
60 additions
and
7 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
'use strict'; | ||
const spawn = require('cross-spawn'); | ||
const path = require('path'); | ||
|
||
const modulesToRebuild = | ||
require('../package.json').config.hadron.rebuild.onlyModules; | ||
|
||
// We only want to force rebuild on linux to make sure that the version of glibc | ||
// is matching the platform we're running this on instead of the platform the | ||
// prebuilt was generated on, for other platforms it's okay to just download the | ||
// prebuilt modules when available | ||
const forceRebuildFromSource = process.platform === 'linux'; | ||
|
||
/** @type {[string, string[]]} */ | ||
const rebuildArgs = [ | ||
'electron-rebuild', | ||
[ | ||
'--only', | ||
modulesToRebuild.join(','), | ||
...(forceRebuildFromSource | ||
? [ | ||
// electron-rebuild doesn't allow to force rebuild from source, but we | ||
// can force it by passing a fake tag that would not allow prebuilt to | ||
// download the asset | ||
'--prebuild-tag-prefix', | ||
'not-real-prefix-to-force-rebuild', | ||
] | ||
: []), | ||
...process.argv.slice(2), | ||
], | ||
]; | ||
|
||
// eslint-disable-next-line no-console | ||
console.log('> %s', rebuildArgs.flat().join(' ')); | ||
|
||
spawn(...rebuildArgs, { | ||
cwd: path.resolve(__dirname, '..'), | ||
stdio: 'inherit', | ||
env: process.env, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters