Development and build support for ARM based Apple devices (#114879)

This commit is contained in:
Jonathan Budzenski 2021-10-19 17:01:52 -05:00 committed by GitHub
parent b1dd89e173
commit fa1a233d23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 58 additions and 4 deletions

View file

@ -1 +1 @@
1.7.5
1.10.1

View file

@ -1 +1 @@
4.0.0
4.2.1

View file

@ -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"),

View file

@ -107,6 +107,7 @@ describe('#getTargetPlatforms()', () => {
.sort()
).toMatchInlineSnapshot(`
Array [
"darwin-arm64",
"darwin-x64",
"linux-arm64",
"linux-x64",
@ -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 () => {

View file

@ -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);
});
});
@ -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);
});
});
@ -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);
});
});

View file

@ -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'),
];

View file

@ -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,

View file

@ -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",

View file

@ -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,
},
],
],
}
`);

View file

@ -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",
@ -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 {
@ -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 {
@ -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",
@ -212,6 +232,10 @@ it('checks shasums for each downloaded node build', async () => {
"type": "return",
"value": "valid shasum",
},
Object {
"type": "return",
"value": "valid shasum",
},
],
}
`);

View file

@ -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',