Fix MacOS build (#48285)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48285

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D67275514

fbshipit-source-id: 6512cbb090e90f827f643353a0a73c4f9516f651
This commit is contained in:
Pieter De Baets
2024-12-16 04:06:27 -08:00
committed by Facebook GitHub Bot
parent ba8136e41d
commit 5edd32bf3f
3 changed files with 23 additions and 12 deletions
+5 -3
View File
@@ -19,7 +19,7 @@ import {
updateSnapshotsAndGetJestSnapshotResult,
} from './snapshotUtils';
import {
getBuckModeForPlatform,
getBuckModesForPlatform,
getDebugInfoFromCommandResult,
getShortHash,
runBuck2,
@@ -76,7 +76,7 @@ function generateBytecodeBundle({
const hermesCompilerCommandResult = runBuck2(
[
'run',
getBuckModeForPlatform(isOptimizedMode),
...getBuckModesForPlatform(isOptimizedMode),
'//xplat/hermes/tools/hermesc:hermesc',
'--',
'-emit-binary',
@@ -178,7 +178,9 @@ module.exports = async function runTest(
const rnTesterCommandResult = runBuck2([
'run',
getBuckModeForPlatform(testConfig.mode === FantomTestConfigMode.Optimized),
...getBuckModesForPlatform(
testConfig.mode === FantomTestConfigMode.Optimized,
),
'//xplat/ReactNative/react-native-cxx/samples/tester:tester',
'--',
'--bundlePath',
+15 -6
View File
@@ -18,21 +18,30 @@ import {SourceMapConsumer} from 'source-map';
const BUCK_ISOLATION_DIR = 'react-native-fantom-buck-out';
export function getBuckModeForPlatform(enableRelease: boolean = false): string {
export function getBuckModesForPlatform(
enableRelease: boolean = false,
): $ReadOnlyArray<string> {
const mode = enableRelease ? 'opt' : 'dev';
let osPlatform;
switch (os.platform()) {
case 'linux':
return `@//arvr/mode/linux/${mode}`;
osPlatform = `@//arvr/mode/linux/${mode}`;
break;
case 'darwin':
return os.arch() === 'arm64'
? `@//arvr/mode/mac-arm/${mode}`
: `@//arvr/mode/mac/${mode}`;
osPlatform =
os.arch() === 'arm64'
? `@//arvr/mode/mac-arm/${mode}`
: `@//arvr/mode/mac/${mode}`;
break;
case 'win32':
return `@//arvr/mode/win/${mode}`;
osPlatform = `@//arvr/mode/win/${mode}`;
break;
default:
throw new Error(`Unsupported platform: ${os.platform()}`);
}
return ['@//xplat/mode/react-force-cxx-platform', osPlatform];
}
type SpawnResultWithOriginalCommand = {
+3 -3
View File
@@ -10,7 +10,7 @@
*/
import {
getBuckModeForPlatform,
getBuckModesForPlatform,
getDebugInfoFromCommandResult,
runBuck2,
} from '../utils';
@@ -96,7 +96,7 @@ async function warmUpMetro(isOptimizedMode: boolean): Promise<void> {
function warmUpHermesCompiler(isOptimizedMode: boolean): void {
const buildHermesCompilerCommandResult = runBuck2([
'build',
getBuckModeForPlatform(isOptimizedMode),
...getBuckModesForPlatform(isOptimizedMode),
'//xplat/hermes/tools/hermesc:hermesc',
]);
@@ -110,7 +110,7 @@ function warmUpHermesCompiler(isOptimizedMode: boolean): void {
function warmUpRNTesterCLI(isOptimizedMode: boolean): void {
const buildRNTesterCommandResult = runBuck2([
'build',
getBuckModeForPlatform(isOptimizedMode),
...getBuckModesForPlatform(isOptimizedMode),
'//xplat/ReactNative/react-native-cxx/samples/tester:tester',
]);