Skip to content

Commit 0bbbe3e

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

6 files changed

Lines changed: 16 additions & 23 deletions

File tree

packages/react-native/Package.swift

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,8 @@ let reactJsErrorHandler = RNTarget(
249249
let reactGraphicsApple = RNTarget(
250250
name: .reactGraphicsApple,
251251
path: "ReactCommon/react/renderer/graphics/platform/ios",
252-
linkedFrameworks: ["CoreGraphics"], // [macOS] UIKit removed; linked conditionally via platformLinkerSettings below
253-
// [macOS] Package.swift evaluates on the host (macOS), not the target, so #if os(macOS) doesn't work for cross-compilation.
254-
// not the target. Use .when(platforms:) for cross-compilation support.
252+
linkedFrameworks: ["CoreGraphics"],
253+
// [macOS] UIKit/AppKit linked conditionally for cross-compilation
255254
platformLinkerSettings: [
256255
.linkedFramework("UIKit", .when(platforms: [.iOS, .visionOS])),
257256
.linkedFramework("AppKit", .when(platforms: [.macOS])),
@@ -369,19 +368,18 @@ let reactCore = RNTarget(
369368
"ReactCommon/react/runtime/platform/ios", // explicit header search path to break circular dependency. RCTHost imports `RCTDefines.h` in ReactCore, ReacCore needs to import RCTHost
370369
],
371370
linkedFrameworks: ["CoreServices"],
372-
// [macOS] RCTUIKit is part of React-Core on 0.81 — add platform-conditional UIKit/AppKit linking
371+
// [macOS]
373372
platformLinkerSettings: [
374373
.linkedFramework("UIKit", .when(platforms: [.iOS, .visionOS])),
375374
.linkedFramework("AppKit", .when(platforms: [.macOS])),
376375
],
377-
// macOS]
378376
excludedPaths: ["Fabric", "Tests", "Resources", "Runtime/RCTJscInstanceFactory.mm", "I18n/strings", "CxxBridge/JSCExecutorFactory.mm", "CoreModules"],
379377
dependencies: [.reactNativeDependencies, .reactCxxReact, .reactPerfLogger, .jsi, .reactJsiExecutor, .reactUtils, .reactFeatureFlags, .reactRuntimeScheduler, .yoga, .reactJsInspector, .reactJsiTooling, .rctDeprecation, .reactCoreRCTWebsocket, .reactRCTImage, .reactTurboModuleCore, .reactRCTText, .reactRCTBlob, .reactRCTAnimation, .reactRCTNetwork, .reactFabric, .hermesPrebuilt],
380378
sources: [".", "Runtime/RCTHermesInstanceFactory.mm"]
381379
)
382380

383381
/// React-Fabric.podspec
384-
// [macOS: on macOS, use platform/macos view sources instead of platform/cxx
382+
// [macOS
385383
#if os(macOS)
386384
let reactFabricViewPlatformSources = ["components/view/platform/macos"]
387385
let reactFabricViewPlatformExcludes = ["components/view/platform/cxx"]
@@ -400,7 +398,7 @@ let reactFabric = RNTarget(
400398
"components/view/tests",
401399
"components/view/platform/android",
402400
"components/view/platform/windows",
403-
// "components/view/platform/macos", // [macOS] moved to reactFabricViewPlatformExcludes for conditional exclusion
401+
// "components/view/platform/macos", // [macOS]
404402
"components/scrollview/tests",
405403
"components/scrollview/platform/android",
406404
"mounting/tests",
@@ -445,8 +443,7 @@ let reactFabricComponents = RNTarget(
445443
"components/view/platform/android",
446444
"components/view/platform/windows",
447445
"components/view/platform/macos",
448-
// [macOS] Both IOSSwitchShadowNode.mm and MacOSSwitchShadowNode.mm are included;
449-
// they use #if TARGET_OS_OSX guards internally so only the correct one compiles.
446+
// [macOS] Both switch files included; TARGET_OS_OSX guards select the correct one.
450447
"components/textinput/platform/android",
451448
"components/text/platform/android",
452449
"components/textinput/platform/macos",
@@ -654,7 +651,7 @@ class BinaryTarget: BaseTarget {
654651

655652
class RNTarget: BaseTarget {
656653
let linkedFrameworks: [String]
657-
let platformLinkerSettings: [LinkerSetting] // [macOS] Platform-conditional framework linking (e.g. UIKit vs AppKit)
654+
let platformLinkerSettings: [LinkerSetting] // [macOS]
658655
let excludedPaths: [String]
659656
let dependencies: [String]
660657
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(
@@ -282,8 +280,7 @@ async function hermesSourceType(
282280
return HermesEngineSourceTypes.DOWNLOAD_PREBUILT_NIGHTLY_TARBALL;
283281
}
284282

285-
// [macOS] When on the macOS main branch (no mapped version, no explicit HERMES_VERSION),
286-
// fall back to resolving the Hermes commit at the merge base with facebook/react-native.
283+
// [macOS] Fall back to building Hermes from the merge-base commit.
287284
if (allowBuildFromSource) {
288285
hermesLog(
289286
'No prebuilt Hermes artifact found. Will attempt to resolve from merge base with facebook/react-native.',
@@ -489,7 +486,10 @@ async function buildFromHermesCommit(
489486
const tarballName = `hermes-ios-${buildType.toLowerCase()}.tar.gz`;
490487
const tarballPath = path.join(artifactsPath, tarballName);
491488
hermesLog('Creating Hermes tarball from build output...');
492-
execSync(`tar -czf "${tarballPath}" -C "${hermesDir}" destroot`, inheritStdio);
489+
execSync(
490+
`tar -czf "${tarballPath}" -C "${hermesDir}" destroot`,
491+
inheritStdio,
492+
);
493493

494494
hermesLog(`Hermes built from source and packaged at ${tarballPath}`);
495495
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)