Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for arm64 for server builds #145053

Merged
merged 6 commits into from
Mar 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 7 additions & 4 deletions build/azure-pipelines/common/createAsset.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,15 @@ function getPlatform(product, os, arch, type) {
}
return `darwin-${arch}`;
case 'server':
return 'server-darwin';
if (arch === 'x64') {
return 'server-darwin';
}
return `server-darwin-${arch}`;
case 'web':
if (arch !== 'x64') {
throw new Error(`What should the platform be?: ${product} ${os} ${arch} ${type}`);
if (arch === 'x64') {
return 'server-darwin-web';
}
return 'server-darwin-web';
return `server-darwin-${arch}-web`;
default:
throw new Error(`Unrecognized: ${product} ${os} ${arch} ${type}`);
}
Expand Down
11 changes: 7 additions & 4 deletions build/azure-pipelines/common/createAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,15 @@ function getPlatform(product: string, os: string, arch: string, type: string): s
}
return `darwin-${arch}`;
case 'server':
return 'server-darwin';
if (arch === 'x64') {
return 'server-darwin';
}
return `server-darwin-${arch}`;
case 'web':
if (arch !== 'x64') {
throw new Error(`What should the platform be?: ${product} ${os} ${arch} ${type}`);
if (arch === 'x64') {
return 'server-darwin-web';
}
return 'server-darwin-web';
return `server-darwin-${arch}-web`;
default:
throw new Error(`Unrecognized: ${product} ${os} ${arch} ${type}`);
}
Expand Down
54 changes: 35 additions & 19 deletions build/azure-pipelines/darwin/product-build-darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ 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'))
condition: and(succeeded(), ne(variables['VSCODE_ARCH'], 'universal'))

- script: |
set -e
Expand Down Expand Up @@ -200,15 +200,15 @@ 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
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))

- 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
Expand All @@ -219,15 +219,15 @@ 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
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))

- 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)
Expand All @@ -247,7 +247,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)
Expand Down Expand Up @@ -296,27 +296,43 @@ 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-$(VSCODE_ARCH)-web.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'), ne(variables['VSCODE_ARCH'], 'universal'))

- 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'))

- script: |
mv $(agent.builddirectory)/vscode-server-darwin-x64.zip $(agent.builddirectory)/vscode-server-darwin.zip
mv $(agent.builddirectory)/vscode-server-darwin-x64-web.zip $(agent.builddirectory)/vscode-server-darwin-web.zip
displayName: Rename x64 server builds to their legacy names
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'), eq(variables['VSCODE_ARCH'], 'x64'))

- publish: $(Agent.BuildDirectory)/vscode-server-darwin-arm64.zip
artifact: vscode_server_darwin_arm64_archive-unsigned
displayName: Publish arm64 server archive
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'), eq(variables['VSCODE_ARCH'], 'arm64'))

- publish: $(Agent.BuildDirectory)/vscode-server-darwin-arm64-web.zip
artifact: vscode_web_darwin_arm64_archive-unsigned
displayName: Publish arm64 web server archive
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'), eq(variables['VSCODE_ARCH'], 'arm64'))

- publish: $(Agent.BuildDirectory)/vscode-server-darwin.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'))
artifact: vscode_server_darwin_x64_archive-unsigned
displayName: Publish x64 server archive
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'), eq(variables['VSCODE_ARCH'], 'x64'))

- publish: $(Agent.BuildDirectory)/vscode-server-darwin-web.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'))
artifact: vscode_web_darwin_x64_archive-unsigned
displayName: Publish x64 web server archive
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'), eq(variables['VSCODE_ARCH'], 'x64'))
Comment on lines +317 to +335
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexdima why duplicate these steps for each artifact over the previous version based on vscode_web_darwin_$(VSCODE_ARCH)_archive-unsigned and scode_server_darwin_$(VSCODE_ARCH)_archive-unsigned ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to keep compatibility with the old names:

  • the x64 versions are still called vscode-server-darwin.zip and vscode-server-darwin-web.zip
  • the arm64 versions are called vscode-server-darwin-arm64.zip and vscode-server-darwin-arm64-web.zip

I didn't know how to write a conditional inside the publish: field. If you know how to do it, please start a PR to remove the duplication.


- task: AzureCLI@2
inputs:
Expand Down Expand Up @@ -358,9 +374,9 @@ steps:
inputs:
BuildDropPath: $(agent.builddirectory)/vscode-server-darwin
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'), ne(variables['VSCODE_ARCH'], 'universal'))

- publish: $(agent.builddirectory)/vscode-server-darwin/_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'), ne(variables['VSCODE_ARCH'], 'universal'))
18 changes: 5 additions & 13 deletions build/gulpfile.reh.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
Expand Down Expand Up @@ -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}`);

Expand All @@ -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));
Expand All @@ -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';
}
Expand Down Expand Up @@ -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 = [];
Expand Down Expand Up @@ -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)
));
Expand Down
2 changes: 1 addition & 1 deletion build/lib/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
2 changes: 1 addition & 1 deletion build/lib/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤌😙


const node = platform === 'win32' ? 'node.exe' : 'node';
const nodePath = path.join(root, '.build', 'node', `v${version}`, `${platform}-${arch}`, node);
Expand Down
5 changes: 0 additions & 5 deletions build/npm/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down