From bd9d4d5b51a12f4f4cee543b9f7070ea80371d83 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Mon, 14 Mar 2022 16:22:54 +0100 Subject: [PATCH] Add support for arm64 for server builds --- .../darwin/product-build-darwin.yml | 37 +++++++++---------- build/gulpfile.reh.js | 18 +++------ build/lib/node.js | 2 +- build/lib/node.ts | 2 +- build/npm/postinstall.js | 5 --- 5 files changed, 25 insertions(+), 39 deletions(-) diff --git a/build/azure-pipelines/darwin/product-build-darwin.yml b/build/azure-pipelines/darwin/product-build-darwin.yml index e0d4c43d8e3..2ce96ecc19f 100644 --- a/build/azure-pipelines/darwin/product-build-darwin.yml +++ b/build/azure-pipelines/darwin/product-build-darwin.yml @@ -124,11 +124,10 @@ steps: - script: | set -e VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \ - yarn gulp vscode-reh-darwin-min-ci + yarn gulp vscode-reh-darwin-$(VSCODE_ARCH)-min-ci VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \ - yarn gulp vscode-reh-web-darwin-min-ci + yarn gulp vscode-reh-web-darwin-$(VSCODE_ARCH)-min-ci displayName: Build Server - condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64')) - script: | set -e @@ -200,7 +199,7 @@ steps: APP_ROOT=$(agent.builddirectory)/VSCode-darwin-$(VSCODE_ARCH) APP_NAME="`ls $APP_ROOT | head -n 1`" INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME/Contents/MacOS/Electron" \ - VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-darwin" \ + VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-darwin-$(VSCODE_ARCH)" \ ./scripts/test-integration.sh --build --tfs "Integration Tests" displayName: Run integration tests (Electron) timeoutInMinutes: 20 @@ -208,7 +207,7 @@ steps: - script: | set -e - VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-darwin" \ + VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-darwin-$(VSCODE_ARCH)" \ ./scripts/test-web-integration.sh --browser webkit displayName: Run integration tests (Browser, Webkit) timeoutInMinutes: 20 @@ -219,7 +218,7 @@ steps: APP_ROOT=$(agent.builddirectory)/VSCode-darwin-$(VSCODE_ARCH) APP_NAME="`ls $APP_ROOT | head -n 1`" INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME/Contents/MacOS/Electron" \ - VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-darwin" \ + VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-darwin-$(VSCODE_ARCH)" \ ./scripts/test-remote-integration.sh displayName: Run integration tests (Remote) timeoutInMinutes: 20 @@ -227,7 +226,7 @@ steps: - script: | set -e - VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-darwin" \ + VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-darwin-$(VSCODE_ARCH)" \ yarn smoketest-no-compile --web --headless timeoutInMinutes: 10 displayName: Run smoke tests (Browser, Chromium) @@ -247,7 +246,7 @@ steps: set -e APP_ROOT=$(agent.builddirectory)/VSCode-darwin-$(VSCODE_ARCH) APP_NAME="`ls $APP_ROOT | head -n 1`" - VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-darwin" \ + VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-darwin-$(VSCODE_ARCH)" \ yarn smoketest-no-compile --build "$APP_ROOT/$APP_NAME" --remote timeoutInMinutes: 10 displayName: Run smoke tests (Remote) @@ -296,27 +295,27 @@ steps: set -e # package Remote Extension Host - pushd .. && mv vscode-reh-darwin vscode-server-darwin && zip -Xry vscode-server-darwin.zip vscode-server-darwin && popd + pushd .. && mv vscode-reh-darwin-$(VSCODE_ARCH) vscode-server-darwin && zip -Xry vscode-server-darwin-$(VSCODE_ARCH).zip vscode-server-darwin && popd # package Remote Extension Host (Web) - pushd .. && mv vscode-reh-web-darwin vscode-server-darwin-web && zip -Xry vscode-server-darwin-web.zip vscode-server-darwin-web && popd + pushd .. && mv vscode-reh-web-darwin-$(VSCODE_ARCH) vscode-server-darwin-web && zip -Xry vscode-server-darwin-web-$(VSCODE_ARCH).zip vscode-server-darwin-web && popd displayName: Prepare to publish servers - condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), ne(variables['VSCODE_PUBLISH'], 'false')) + condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false')) - publish: $(Agent.BuildDirectory)/VSCode-darwin-$(VSCODE_ARCH).zip artifact: unsigned_vscode_client_darwin_$(VSCODE_ARCH)_archive displayName: Publish client archive condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false')) - - publish: $(Agent.BuildDirectory)/vscode-server-darwin.zip + - publish: $(Agent.BuildDirectory)/vscode-server-darwin-$(VSCODE_ARCH).zip artifact: vscode_server_darwin_$(VSCODE_ARCH)_archive-unsigned displayName: Publish server archive - condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), ne(variables['VSCODE_PUBLISH'], 'false')) + condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false')) - - publish: $(Agent.BuildDirectory)/vscode-server-darwin-web.zip + - publish: $(Agent.BuildDirectory)/vscode-server-darwin-web-$(VSCODE_ARCH).zip artifact: vscode_web_darwin_$(VSCODE_ARCH)_archive-unsigned displayName: Publish web server archive - condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), ne(variables['VSCODE_PUBLISH'], 'false')) + condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false')) - task: AzureCLI@2 inputs: @@ -356,11 +355,11 @@ steps: - task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 displayName: Generate SBOM (server) inputs: - BuildDropPath: $(agent.builddirectory)/vscode-server-darwin + BuildDropPath: $(agent.builddirectory)/vscode-server-darwin-$(VSCODE_ARCH) PackageName: Visual Studio Code Server - condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'), eq(variables['VSCODE_ARCH'], 'x64')) + condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false')) - - publish: $(agent.builddirectory)/vscode-server-darwin/_manifest + - publish: $(agent.builddirectory)/vscode-server-darwin-$(VSCODE_ARCH)/_manifest displayName: Publish SBOM (server) artifact: vscode_server_darwin_$(VSCODE_ARCH)_sbom - condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'), eq(variables['VSCODE_ARCH'], 'x64')) + condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false')) diff --git a/build/gulpfile.reh.js b/build/gulpfile.reh.js index b72e1e44008..757f670cff2 100644 --- a/build/gulpfile.reh.js +++ b/build/gulpfile.reh.js @@ -39,7 +39,8 @@ const REMOTE_FOLDER = path.join(REPO_ROOT, 'remote'); const BUILD_TARGETS = [ { platform: 'win32', arch: 'ia32' }, { platform: 'win32', arch: 'x64' }, - { platform: 'darwin', arch: null }, // TODO@server-darwin-arm64: See also postinstall.js which hard-codes remote to x64 + { platform: 'darwin', arch: 'x64' }, + { platform: 'darwin', arch: 'arm64' }, { platform: 'linux', arch: 'ia32' }, { platform: 'linux', arch: 'x64' }, { platform: 'linux', arch: 'armhf' }, @@ -132,10 +133,6 @@ function getNodeVersion() { const nodeVersion = getNodeVersion(); BUILD_TARGETS.forEach(({ platform, arch }) => { - if (platform === 'darwin') { - arch = 'x64'; - } - gulp.task(task.define(`node-${platform}-${arch}`, () => { const nodePath = path.join('.build', 'node', `v${nodeVersion}`, `${platform}-${arch}`); @@ -150,8 +147,7 @@ BUILD_TARGETS.forEach(({ platform, arch }) => { })); }); -const arch = process.platform === 'darwin' ? 'x64' : process.arch; -const defaultNodeTask = gulp.task(`node-${process.platform}-${arch}`); +const defaultNodeTask = gulp.task(`node-${process.platform}-${process.arch}`); if (defaultNodeTask) { gulp.task(task.define('node', defaultNodeTask)); @@ -176,10 +172,6 @@ function nodejs(platform, arch) { return es.readArray([new File({ path: 'node', contents, stat: { mode: parseInt('755', 8) } })]); } - if (platform === 'darwin') { - arch = 'x64'; - } - if (arch === 'armhf') { arch = 'armv7l'; } @@ -273,7 +265,7 @@ function packageTask(type, platform, arch, sourceFolderName, destinationFolderNa .pipe(util.stripSourceMappingURL()) .pipe(jsFilter.restore); - const nodePath = `.build/node/v${nodeVersion}/${platform}-${platform === 'darwin' ? 'x64' : arch}`; + const nodePath = `.build/node/v${nodeVersion}/${platform}-${arch}`; const node = gulp.src(`${nodePath}/**`, { base: nodePath, dot: true }); let web = []; @@ -390,7 +382,7 @@ function tweakProductForServerWeb(product) { const destinationFolderName = `vscode-${type}${dashed(platform)}${dashed(arch)}`; const serverTaskCI = task.define(`vscode-${type}${dashed(platform)}${dashed(arch)}${dashed(minified)}-ci`, task.series( - gulp.task(`node-${platform}-${platform === 'darwin' ? 'x64' : arch}`), + gulp.task(`node-${platform}-${arch}`), util.rimraf(path.join(BUILD_ROOT, destinationFolderName)), packageTask(type, platform, arch, sourceFolderName, destinationFolderName) )); diff --git a/build/lib/node.js b/build/lib/node.js index e727aff8323..588962fa5bd 100644 --- a/build/lib/node.js +++ b/build/lib/node.js @@ -11,7 +11,7 @@ const yarnrcPath = path.join(root, 'remote', '.yarnrc'); const yarnrc = fs.readFileSync(yarnrcPath, 'utf8'); const version = /^target\s+"([^"]+)"$/m.exec(yarnrc)[1]; const platform = process.platform; -const arch = platform === 'darwin' ? 'x64' : process.arch; +const arch = process.arch; const node = platform === 'win32' ? 'node.exe' : 'node'; const nodePath = path.join(root, '.build', 'node', `v${version}`, `${platform}-${arch}`, node); console.log(nodePath); diff --git a/build/lib/node.ts b/build/lib/node.ts index 6ac45ebb1f8..d1b0039b022 100644 --- a/build/lib/node.ts +++ b/build/lib/node.ts @@ -12,7 +12,7 @@ const yarnrc = fs.readFileSync(yarnrcPath, 'utf8'); const version = /^target\s+"([^"]+)"$/m.exec(yarnrc)![1]; const platform = process.platform; -const arch = platform === 'darwin' ? 'x64' : process.arch; +const arch = process.arch; const node = platform === 'win32' ? 'node.exe' : 'node'; const nodePath = path.join(root, '.build', 'node', `v${version}`, `${platform}-${arch}`, node); diff --git a/build/npm/postinstall.js b/build/npm/postinstall.js index 2e809b1f233..837e8638c87 100644 --- a/build/npm/postinstall.js +++ b/build/npm/postinstall.js @@ -65,11 +65,6 @@ for (let dir of dirs) { if (process.env['LDFLAGS']) { delete env['LDFLAGS']; } if (process.env['VSCODE_REMOTE_NODE_GYP']) { env['npm_config_node_gyp'] = process.env['VSCODE_REMOTE_NODE_GYP']; } - // TODO@server-darwin-arm64: Remove this check when support for arm64 for the server is added on darwin - if (/^remote/.test(dir) && process.platform === 'darwin' && (process.arch === 'arm64' || process.env['npm_config_arch'] === 'arm64')) { - // darwin arm: force `x64` on remote folder - env['npm_config_arch'] = 'x64'; - } opts = { env }; } else if (/^extensions\//.test(dir)) { opts = { ignoreEngines: true };