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

Development and build support for ARM based Apple devices #114879

Merged
merged 2 commits into from
Oct 19, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bazeliskversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.7.5
1.10.1
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.0
4.2.1
1 change: 1 addition & 0 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ check_rules_nodejs_version(minimum_version_string = "3.8.0")
node_repositories(
node_repositories = {
"16.11.1-darwin_amd64": ("node-v16.11.1-darwin-x64.tar.gz", "node-v16.11.1-darwin-x64", "ba54b8ed504bd934d03eb860fefe991419b4209824280d4274f6a911588b5e45"),
"16.11.1-darwin_arm64": ("node-v16.11.1-darwin-arm64.tar.gz", "node-v16.11.1-darwin-arm64", "5e772e478390fab3001b7148a923e4f22fca50170000f18b28475337d3a97248"),
"16.11.1-linux_arm64": ("node-v16.11.1-linux-arm64.tar.xz", "node-v16.11.1-linux-arm64", "083fc51f0ea26de9041aaf9821874651a9fd3b20d1cf57071ce6b523a0436f17"),
"16.11.1-linux_s390x": ("node-v16.11.1-linux-s390x.tar.xz", "node-v16.11.1-linux-s390x", "855b5c83c2ccb05273d50bb04376335c68d47df57f3187cdebe1f22b972d2825"),
"16.11.1-linux_amd64": ("node-v16.11.1-linux-x64.tar.xz", "node-v16.11.1-linux-x64", "493bcc9b660eff983a6de65a0f032eb2717f57207edf74c745bcb86e360310b3"),
Expand Down
3 changes: 2 additions & 1 deletion src/dev/build/lib/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ describe('#getTargetPlatforms()', () => {
.sort()
).toMatchInlineSnapshot(`
Array [
"darwin-arm64",
"darwin-x64",
"linux-arm64",
"linux-x64",
Expand All @@ -132,7 +133,7 @@ describe('#getNodePlatforms()', () => {
.getTargetPlatforms()
.map((p) => p.getNodeArch())
.sort()
).toEqual(['darwin-x64', 'linux-arm64', 'linux-x64', 'win32-x64']);
).toEqual(['darwin-arm64', 'darwin-x64', 'linux-arm64', 'linux-x64', 'win32-x64']);
});

it('returns this platform and linux, when targetAllPlatforms = false', async () => {
Expand Down
3 changes: 3 additions & 0 deletions src/dev/build/lib/platform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ describe('isWindows()', () => {
expect(new Platform('win32', 'x64', 'foo').isWindows()).toBe(true);
expect(new Platform('linux', 'x64', 'foo').isWindows()).toBe(false);
expect(new Platform('darwin', 'x64', 'foo').isWindows()).toBe(false);
expect(new Platform('darwin', 'arm64', 'foo').isWindows()).toBe(false);
});
});

Expand All @@ -39,6 +40,7 @@ describe('isLinux()', () => {
expect(new Platform('win32', 'x64', 'foo').isLinux()).toBe(false);
expect(new Platform('linux', 'x64', 'foo').isLinux()).toBe(true);
expect(new Platform('darwin', 'x64', 'foo').isLinux()).toBe(false);
expect(new Platform('darwin', 'arm64', 'foo').isLinux()).toBe(false);
});
});

Expand All @@ -47,5 +49,6 @@ describe('isMac()', () => {
expect(new Platform('win32', 'x64', 'foo').isMac()).toBe(false);
expect(new Platform('linux', 'x64', 'foo').isMac()).toBe(false);
expect(new Platform('darwin', 'x64', 'foo').isMac()).toBe(true);
expect(new Platform('darwin', 'arm64', 'foo').isMac()).toBe(true);
});
});
1 change: 1 addition & 0 deletions src/dev/build/lib/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@ export const ALL_PLATFORMS = [
new Platform('linux', 'x64', 'linux-x86_64'),
new Platform('linux', 'arm64', 'linux-aarch64'),
new Platform('darwin', 'x64', 'darwin-x86_64'),
new Platform('darwin', 'arm64', 'darwin-aarch64'),
new Platform('win32', 'x64', 'windows-x86_64'),
];
6 changes: 5 additions & 1 deletion src/dev/build/tasks/install_chromium.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ export const InstallChromium = {

async run(config, log, build) {
for (const platform of config.getNodePlatforms()) {
log.info(`Installing Chromium for ${platform.getName()}-${platform.getArchitecture()}`);
const target = `${platform.getName()}-${platform.getArchitecture()}`;
log.info(`Installing Chromium for ${target}`);

// revert after https://github.com/elastic/kibana/issues/109949
if (target === 'darwin-arm64') continue;

const { binaryPath$ } = installBrowser(
log,
Expand Down
9 changes: 9 additions & 0 deletions src/dev/build/tasks/nodejs/download_node_builds_task.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ it('downloads node builds for each platform', async () => {
"url": "darwin:url",
},
],
Array [
Object {
"destination": "darwin:downloadPath",
"log": <ToolingLog>,
"retries": 3,
"sha256": "darwin:sha256",
"url": "darwin:url",
},
],
Array [
Object {
"destination": "win32:downloadPath",
Expand Down
7 changes: 7 additions & 0 deletions src/dev/build/tasks/nodejs/extract_node_builds_task.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ it('runs expected fs operations', async () => {
"strip": 1,
},
],
Array [
<absolute path>/.node_binaries/<node version>/node-v<node version>-darwin-arm64.tar.gz,
<absolute path>/.node_binaries/<node version>/darwin-arm64,
Object {
"strip": 1,
},
],
],
}
`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ it('checks shasums for each downloaded node build', async () => {
Object {
"type": "return",
"value": Object {
"darwin:darwin-arm64:downloadName": "valid shasum",
"darwin:darwin-x64:downloadName": "valid shasum",
"linux:linux-arm64:downloadName": "valid shasum",
"linux:linux-x64:downloadName": "valid shasum",
Expand Down Expand Up @@ -134,6 +135,14 @@ it('checks shasums for each downloaded node build', async () => {
"name": "darwin",
},
],
Array [
<Config>,
Platform {
"architecture": "arm64",
"buildName": "darwin-aarch64",
"name": "darwin",
},
],
Array [
<Config>,
Platform {
Expand Down Expand Up @@ -165,6 +174,13 @@ it('checks shasums for each downloaded node build', async () => {
"downloadPath": "darwin:darwin-x64:downloadPath",
},
},
Object {
"type": "return",
"value": Object {
"downloadName": "darwin:darwin-arm64:downloadName",
"downloadPath": "darwin:darwin-arm64:downloadPath",
},
},
Object {
"type": "return",
"value": Object {
Expand All @@ -190,6 +206,10 @@ it('checks shasums for each downloaded node build', async () => {
"darwin:darwin-x64:downloadPath",
"sha256",
],
Array [
"darwin:darwin-arm64:downloadPath",
"sha256",
],
Array [
"win32:win32-x64:downloadPath",
"sha256",
Expand All @@ -212,6 +232,10 @@ it('checks shasums for each downloaded node build', async () => {
"type": "return",
"value": "valid shasum",
},
Object {
"type": "return",
"value": "valid shasum",
},
],
}
`);
Expand Down
4 changes: 4 additions & 0 deletions src/dev/build/tasks/patch_native_modules_task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ const packages: Package[] = [
url: 'https://storage.googleapis.com/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.16.0/linux-arm64-93.gz',
sha256: '7a786e0b75985e5aafdefa9af55cad8e85e69a3326f16d8c63d21d6b5b3bff1b',
},
'darwin-arm64': {
url: 'https://storage.googleapis.com/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.16.0/darwin-arm64-93.gz',
sha256: '28b540cdddf13578f1bd28a03e29ffdc26a7f00ec859c369987b8d51ec6357c8',
},
'win32-x64': {
url: 'https://github.com/uhop/node-re2/releases/download/1.16.0/win32-x64-93.gz',
sha256: '37245ceb59a086b5e7e9de8746a3cdf148c383be9ae2580f92baea90d0d39947',
Expand Down