Build server release for Mac AARCH64
Reviewed By: lblasa Differential Revision: D46144878 fbshipit-source-id: 1aa2982fc99e5dc6cdfbe4d9fcf87f7fc55a1abe
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9b448b2864
commit
558316153c
@@ -40,6 +40,7 @@ enum BuildPlatform {
|
|||||||
LINUX = 'linux',
|
LINUX = 'linux',
|
||||||
WINDOWS = 'windows',
|
WINDOWS = 'windows',
|
||||||
MAC_X64 = 'mac-x64',
|
MAC_X64 = 'mac-x64',
|
||||||
|
MAC_AARCH64 = 'mac-aarch64',
|
||||||
}
|
}
|
||||||
|
|
||||||
const LINUX_STARTUP_SCRIPT = `#!/bin/sh
|
const LINUX_STARTUP_SCRIPT = `#!/bin/sh
|
||||||
@@ -433,21 +434,23 @@ async function buildServerRelease() {
|
|||||||
if (argv.linux) {
|
if (argv.linux) {
|
||||||
platforms.push(BuildPlatform.LINUX);
|
platforms.push(BuildPlatform.LINUX);
|
||||||
}
|
}
|
||||||
// TODO: In the future, also cover aarch64 here.
|
|
||||||
if (argv.mac) {
|
if (argv.mac) {
|
||||||
platforms.push(BuildPlatform.MAC_X64);
|
platforms.push(BuildPlatform.MAC_X64);
|
||||||
|
platforms.push(BuildPlatform.MAC_AARCH64);
|
||||||
}
|
}
|
||||||
if (argv.win) {
|
if (argv.win) {
|
||||||
platforms.push(BuildPlatform.WINDOWS);
|
platforms.push(BuildPlatform.WINDOWS);
|
||||||
}
|
}
|
||||||
|
|
||||||
platforms.forEach(
|
for (const platform of platforms) {
|
||||||
bundleServerReleaseForPlatform.bind(null, dir, versionNumber),
|
await bundleServerReleaseForPlatform(dir, versionNumber, platform);
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function nodeArchFromBuildPlatform(_platform: BuildPlatform): string {
|
function nodeArchFromBuildPlatform(platform: BuildPlatform): string {
|
||||||
// TODO: Change this as we support aarch64.
|
if (platform === BuildPlatform.MAC_AARCH64) {
|
||||||
|
return 'arm64';
|
||||||
|
}
|
||||||
return 'x64';
|
return 'x64';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -456,6 +459,7 @@ function nodePlatformFromBuildPlatform(platform: BuildPlatform): string {
|
|||||||
case BuildPlatform.LINUX:
|
case BuildPlatform.LINUX:
|
||||||
return 'linux';
|
return 'linux';
|
||||||
case BuildPlatform.MAC_X64:
|
case BuildPlatform.MAC_X64:
|
||||||
|
case BuildPlatform.MAC_AARCH64:
|
||||||
return 'macos';
|
return 'macos';
|
||||||
case BuildPlatform.WINDOWS:
|
case BuildPlatform.WINDOWS:
|
||||||
return 'win32';
|
return 'win32';
|
||||||
@@ -465,11 +469,13 @@ function nodePlatformFromBuildPlatform(platform: BuildPlatform): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function installNodeBinary(outputPath: string, platform: BuildPlatform) {
|
async function installNodeBinary(outputPath: string, platform: BuildPlatform) {
|
||||||
|
console.log(`⚙️ Downloading node version for ${platform} using pkg-fetch`);
|
||||||
const path = await pkgFetch({
|
const path = await pkgFetch({
|
||||||
arch: nodeArchFromBuildPlatform(platform),
|
arch: nodeArchFromBuildPlatform(platform),
|
||||||
platform: nodePlatformFromBuildPlatform(platform),
|
platform: nodePlatformFromBuildPlatform(platform),
|
||||||
nodeRange: SUPPORTED_NODE_PLATFORM,
|
nodeRange: SUPPORTED_NODE_PLATFORM,
|
||||||
});
|
});
|
||||||
|
console.log(`⚙️ Copying node binary from ${path} to ${outputPath}`);
|
||||||
await fs.copyFile(path, outputPath);
|
await fs.copyFile(path, outputPath);
|
||||||
// Set +x on the binary as copyFile doesn't maintain the bit.
|
// Set +x on the binary as copyFile doesn't maintain the bit.
|
||||||
await fs.chmod(outputPath, 0o755);
|
await fs.chmod(outputPath, 0o755);
|
||||||
@@ -539,7 +545,10 @@ async function bundleServerReleaseForPlatform(
|
|||||||
|
|
||||||
// On the mac, we need to set up a resource bundle which expects paths
|
// On the mac, we need to set up a resource bundle which expects paths
|
||||||
// to be in different places from Linux/Windows bundles.
|
// to be in different places from Linux/Windows bundles.
|
||||||
if (platform === BuildPlatform.MAC_X64) {
|
if (
|
||||||
|
platform === BuildPlatform.MAC_X64 ||
|
||||||
|
platform === BuildPlatform.MAC_AARCH64
|
||||||
|
) {
|
||||||
outputPaths = await setUpMacBundle(outputDir, versionNumber);
|
outputPaths = await setUpMacBundle(outputDir, versionNumber);
|
||||||
} else if (platform === BuildPlatform.LINUX) {
|
} else if (platform === BuildPlatform.LINUX) {
|
||||||
await setUpLinuxBundle(outputDir);
|
await setUpLinuxBundle(outputDir);
|
||||||
|
|||||||
Reference in New Issue
Block a user