build: add apple silicon support (#24545)
* chore: add patches to prevent installation of non-arm pip packages * chore: add patches for apple-silicon * build: add apple silicon build * ci: add testing of new arm binary * chore: remove / update for upstreamed patches * Skip content tracing on macos on arm * build: ensure that spec native modules are rebuilt for arm64 on apple-silicon * chore: fix patches * chore: fix broken patch * chore: fix arm64 DCHECK * build: add MAS arm64 build * build: disable arm2 tests * chore: update patches * build: actually build MAS version of apple silicon app Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
This commit is contained in:
parent
6f53457a17
commit
f146a164af
17 changed files with 767 additions and 70 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
const childProcess = require('child_process');
|
||||
const crypto = require('crypto');
|
||||
const fs = require('fs');
|
||||
const fs = require('fs-extra');
|
||||
const { hashElement } = require('folder-hash');
|
||||
const path = require('path');
|
||||
const unknownFlags = [];
|
||||
|
@ -225,6 +225,9 @@ async function installSpecModules (dir) {
|
|||
npm_config_nodedir: nodeDir,
|
||||
npm_config_msvs_version: '2019'
|
||||
});
|
||||
if (fs.existsSync(path.resolve(dir, 'node_modules'))) {
|
||||
await fs.remove(path.resolve(dir, 'node_modules'));
|
||||
}
|
||||
const { status } = childProcess.spawnSync(NPX_CMD, [`yarn@${YARN_VERSION}`, 'install', '--frozen-lockfile'], {
|
||||
env,
|
||||
cwd: dir,
|
||||
|
@ -234,6 +237,19 @@ async function installSpecModules (dir) {
|
|||
console.log(`${fail} Failed to yarn install in '${dir}'`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// TODO(MarshallOfSound): Remove once node-gyp supports arm64
|
||||
if (process.platform === 'darwin' && process.env.npm_config_arch === 'arm64') {
|
||||
for (const nodeModule of fs.readdirSync(path.resolve(dir, 'node_modules'))) {
|
||||
if (fs.existsSync(path.resolve(dir, 'node_modules', nodeModule, 'binding.gyp'))) {
|
||||
childProcess.spawnSync(NPX_CMD, ['https://github.com/MarshallOfSound/node-gyp/archive/apple-silicon.tar.gz', 'clean', 'configure', 'build', '--arch=arm64'], {
|
||||
env,
|
||||
cwd: path.resolve(dir, 'node_modules', nodeModule),
|
||||
stdio: 'inherit'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getSpecHash () {
|
||||
|
@ -244,6 +260,7 @@ function getSpecHash () {
|
|||
hasher.update(fs.readFileSync(path.resolve(__dirname, '../spec-main/package.json')));
|
||||
hasher.update(fs.readFileSync(path.resolve(__dirname, '../spec/yarn.lock')));
|
||||
hasher.update(fs.readFileSync(path.resolve(__dirname, '../spec-main/yarn.lock')));
|
||||
hasher.update(fs.readFileSync(path.resolve(__dirname, '../script/spec-runner.js')));
|
||||
return hasher.digest('hex');
|
||||
})(),
|
||||
(async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue