Skip to content

Commit 06372b8

Browse files
Saadnajmiclaude
andcommitted
Simplify verbose [macOS] comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d96a94a commit 06372b8

6 files changed

Lines changed: 19 additions & 26 deletions

File tree

packages/react-native/Package.swift

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -246,15 +246,12 @@ let reactJsErrorHandler = RNTarget(
246246
let reactGraphicsApple = RNTarget(
247247
name: .reactGraphicsApple,
248248
path: "ReactCommon/react/renderer/graphics/platform/ios",
249-
linkedFrameworks: ["CoreGraphics"], // [macOS] UIKit removed; linked conditionally via platformLinkerSettings below
250-
// [macOS: UIKit on iOS/visionOS, AppKit on macOS
251-
// Note: #if os(macOS) doesn't work here because Package.swift runs on the host,
252-
// not the target. Use .when(platforms:) for cross-compilation support.
249+
linkedFrameworks: ["CoreGraphics"],
250+
// [macOS] UIKit/AppKit linked conditionally for cross-compilation
253251
platformLinkerSettings: [
254252
.linkedFramework("UIKit", .when(platforms: [.iOS, .visionOS])),
255253
.linkedFramework("AppKit", .when(platforms: [.macOS])),
256254
],
257-
// macOS]
258255
dependencies: [.reactDebug, .jsi, .reactUtils, .reactNativeDependencies]
259256
)
260257

@@ -368,13 +365,13 @@ let reactCore = RNTarget(
368365
"ReactCommon/react/runtime/platform/ios", // explicit header search path to break circular dependency. RCTHost imports `RCTDefines.h` in ReactCore, ReacCore needs to import RCTHost
369366
],
370367
linkedFrameworks: ["CoreServices"],
371-
excludedPaths: ["Fabric", "Tests", "Resources", "Runtime/RCTJscInstanceFactory.mm", "I18n/strings", "CxxBridge/JSCExecutorFactory.mm", "CoreModules", "RCTUIKit"], // [macOS] added RCTUIKit exclusion (separate target)
372-
dependencies: [.reactNativeDependencies, .reactCxxReact, .reactPerfLogger, .jsi, .reactJsiExecutor, .reactUtils, .reactFeatureFlags, .reactRuntimeScheduler, .yoga, .reactJsInspector, .reactJsiTooling, .rctDeprecation, .reactCoreRCTWebsocket, .reactRCTImage, .reactTurboModuleCore, .reactRCTText, .reactRCTBlob, .reactRCTAnimation, .reactRCTNetwork, .reactFabric, .hermesPrebuilt, .reactRCTUIKit], // [macOS] added .reactRCTUIKit
368+
excludedPaths: ["Fabric", "Tests", "Resources", "Runtime/RCTJscInstanceFactory.mm", "I18n/strings", "CxxBridge/JSCExecutorFactory.mm", "CoreModules", "RCTUIKit"], // [macOS]
369+
dependencies: [.reactNativeDependencies, .reactCxxReact, .reactPerfLogger, .jsi, .reactJsiExecutor, .reactUtils, .reactFeatureFlags, .reactRuntimeScheduler, .yoga, .reactJsInspector, .reactJsiTooling, .rctDeprecation, .reactCoreRCTWebsocket, .reactRCTImage, .reactTurboModuleCore, .reactRCTText, .reactRCTBlob, .reactRCTAnimation, .reactRCTNetwork, .reactFabric, .hermesPrebuilt, .reactRCTUIKit], // [macOS]
373370
sources: [".", "Runtime/RCTHermesInstanceFactory.mm"]
374371
)
375372

376373
/// React-Fabric.podspec
377-
// [macOS: on macOS, use platform/macos view sources instead of platform/cxx
374+
// [macOS
378375
#if os(macOS)
379376
let reactFabricViewPlatformSources = ["components/view/platform/macos"]
380377
let reactFabricViewPlatformExcludes = ["components/view/platform/cxx"]
@@ -393,7 +390,7 @@ let reactFabric = RNTarget(
393390
"components/view/tests",
394391
"components/view/platform/android",
395392
"components/view/platform/windows",
396-
// "components/view/platform/macos", // [macOS] moved to reactFabricViewPlatformExcludes for conditional exclusion
393+
// "components/view/platform/macos", // [macOS]
397394
"components/scrollview/tests",
398395
"components/scrollview/platform/android",
399396
"mounting/tests",
@@ -437,16 +434,16 @@ let reactFabricComponents = RNTarget(
437434
"components/modal/platform/cxx",
438435
"components/view/platform/android",
439436
"components/view/platform/windows",
440-
// "components/view/platform/macos", // [macOS] not needed here — sources don't include components/view
437+
// "components/view/platform/macos", // [macOS]
441438
"components/textinput/platform/android",
442-
// "components/textinput/platform/macos", // [macOS] removed — directory does not exist
439+
// "components/textinput/platform/macos", // [macOS]
443440
"components/text/platform/android",
444441
"components/text/tests",
445442
"textlayoutmanager/tests",
446443
"textlayoutmanager/platform/android",
447444
"textlayoutmanager/platform/cxx",
448445
"textlayoutmanager/platform/windows",
449-
// "textlayoutmanager/platform/macos", // [macOS] removed — directory does not exist
446+
// "textlayoutmanager/platform/macos", // [macOS]
450447
"conponents/rncore", // this was the old folder where RN Core Components were generated. If you ran codegen in the past, you might have some files in it that might make the build fail.
451448
],
452449
dependencies: [.reactNativeDependencies, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactFabric, .reactTurboModuleBridging],
@@ -662,7 +659,7 @@ class BinaryTarget: BaseTarget {
662659

663660
class RNTarget: BaseTarget {
664661
let linkedFrameworks: [String]
665-
let platformLinkerSettings: [LinkerSetting] // [macOS] Platform-conditional framework linking (e.g. UIKit vs AppKit)
662+
let platformLinkerSettings: [LinkerSetting] // [macOS]
666663
let excludedPaths: [String]
667664
let dependencies: [String]
668665
let sources: [String]?

packages/react-native/scripts/ios-prebuild/hermes.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ async function prepareHermesArtifactsAsync(
6262
let resolvedVersion = process.env.HERMES_VERSION ?? version;
6363

6464
// [macOS] Map macOS version to upstream RN version for artifact lookup.
65-
// If no mapped version is found (main branch / 1000.0.0), allowBuildFromSource
66-
// enables the fallback to hermesCommitAtMergeBase() when no prebuilt artifacts exist.
6765
let allowBuildFromSource = false;
6866
if (!process.env.HERMES_VERSION) {
6967
const packageJsonPath = path.resolve(
@@ -279,8 +277,7 @@ async function hermesSourceType(
279277
return HermesEngineSourceTypes.DOWNLOAD_PREBUILT_NIGHTLY_TARBALL;
280278
}
281279

282-
// [macOS] When on the macOS main branch (no mapped version, no explicit HERMES_VERSION),
283-
// fall back to resolving the Hermes commit at the merge base with facebook/react-native.
280+
// [macOS] Fall back to building Hermes from the merge-base commit.
284281
if (allowBuildFromSource) {
285282
hermesLog(
286283
'No prebuilt Hermes artifact found. Will attempt to resolve from merge base with facebook/react-native.',
@@ -486,7 +483,10 @@ async function buildFromHermesCommit(
486483
const tarballName = `hermes-ios-${buildType.toLowerCase()}.tar.gz`;
487484
const tarballPath = path.join(artifactsPath, tarballName);
488485
hermesLog('Creating Hermes tarball from build output...');
489-
execSync(`tar -czf "${tarballPath}" -C "${hermesDir}" destroot`, inheritStdio);
486+
execSync(
487+
`tar -czf "${tarballPath}" -C "${hermesDir}" destroot`,
488+
inheritStdio,
489+
);
490490

491491
hermesLog(`Hermes built from source and packaged at ${tarballPath}`);
492492
return tarballPath;

packages/react-native/scripts/ios-prebuild/macosVersionResolver.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* [macOS] This file is specific to react-native-macos and has no upstream equivalent.
8-
* It handles version resolution for macOS fork branches where the package version
9-
* differs from upstream react-native.
7+
* [macOS] Handles version resolution for macOS fork branches.
108
*
119
* @flow
1210
* @format

packages/react-native/scripts/ios-prebuild/reactNativeDependencies.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ async function prepareReactNativeDependenciesArtifactsAsync(
5050
let resolvedVersion = process.env.RN_DEP_VERSION ?? version;
5151

5252
// [macOS] Map macOS version to upstream RN version for artifact lookup.
53-
// For stable branches, peerDependencies maps to the upstream version.
54-
// For the main branch (1000.0.0), fall back to the latest stable RN release.
5553
if (!process.env.RN_DEP_VERSION) {
5654
const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
5755
const mappedVersion = findMatchingHermesVersion(packageJsonPath);

packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ CURR_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
1212
IMPORT_HERMESC_PATH=${HERMES_OVERRIDE_HERMESC_PATH:-$PWD/build_host_hermesc/ImportHermesc.cmake}
1313
BUILD_TYPE=${BUILD_TYPE:-Debug}
1414

15-
# [macOS] Allow HERMES_PATH override for building from a standalone Hermes checkout
15+
# [macOS]
1616
HERMES_PATH=${HERMES_PATH:-"$CURR_SCRIPT_DIR/.."}
1717
REACT_NATIVE_PATH=${REACT_NATIVE_PATH:-$CURR_SCRIPT_DIR/../../..}
1818

packages/react-native/sdks/hermes-engine/utils/build-ios-framework.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function get_architecture {
2020
echo "arm64"
2121
elif [[ $1 == "appletvsimulator" ]]; then
2222
echo "x86_64;arm64"
23-
elif [[ $1 == "catalyst" || $1 == "macosx" ]]; then # [macOS] added macosx
23+
elif [[ $1 == "catalyst" || $1 == "macosx" ]]; then # [macOS]
2424
echo "x86_64;arm64"
2525
else
2626
echo "Error: unknown architecture passed $1"
@@ -57,7 +57,7 @@ function build_framework {
5757
# group the frameworks together to create a universal framework
5858
function build_universal_framework {
5959
if [ ! -d destroot/Library/Frameworks/universal/hermes.xcframework ]; then
60-
create_universal_framework "macosx" "iphoneos" "iphonesimulator" "catalyst" "xros" "xrsimulator" "appletvos" "appletvsimulator" # [macOS] added macosx
60+
create_universal_framework "macosx" "iphoneos" "iphonesimulator" "catalyst" "xros" "xrsimulator" "appletvos" "appletvsimulator" # [macOS]
6161
else
6262
echo "Skipping; Clean \"destroot\" to rebuild".
6363
fi

0 commit comments

Comments
 (0)