Skip to content

Conversation

kraenhansen
Copy link
Collaborator

Merging this PR will:

  • Introduce a default behavior for both cmake-rn and ferric to build for targets / triplets needed for iOS simulator and Android emulator.

@kraenhansen kraenhansen self-assigned this Jun 11, 2025
Copy link

changeset-bot bot commented Jun 11, 2025

⚠️ No Changeset found

Latest commit: 3eeb1b3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@kraenhansen kraenhansen added CMake RN Our `cmake` wrapping CLI Ferric 🦀 labels Jun 11, 2025
@kraenhansen kraenhansen requested a review from mani3xis June 11, 2025 17:39
Copy link
Contributor

@matthargett matthargett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we expect that each new platform supported would be created in-repo as a new file? given the type-code embedded in the name, is it worth having a base interface (TargetPlatform?) that includes platformIsSupported, with concrete implementations (AppleTargetPlatform, AndroidTargetPlatform).

@kraenhansen
Copy link
Collaborator Author

@matthargett I think that's a great question and something I don't have an immediate answer for.
From my vantage point, we'll be able to support the out-of-tree platforms in-repo, but I might be missing parts of the bigger picture.

I could definitely do a follow-up PR with a refactor to separate out a type that needs implementation per platform 👍
Should we have a way for other platforms to register themselves into this as well?

@kraenhansen kraenhansen requested review from Copilot and removed request for mani3xis June 12, 2025 06:40
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds default build targets for iOS simulator and Android emulator in both cmake-rn and ferric when no targets/triplets are specified, and provides helper functions to detect platform support.

  • Default targets/triplets for Apple and Android are added when none are passed.
  • Helper functions isAndroidSupported and isAppleSupported are introduced.
  • User messages are updated to inform about default behavior instead of exiting.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/ferric/src/build.ts Added default Android and Apple simulator targets and support checks
packages/cmake-rn/src/cli.ts Introduced default triplets for emulator/simulator and updated user messages
packages/cmake-rn/src/apple.ts Added isAppleSupported helper
packages/cmake-rn/src/android.ts Added isAndroidSupported helper
Comments suppressed due to low confidence (4)

packages/cmake-rn/src/cli.ts:134

  • [nitpick] The default-triplet logic is duplicated in both cmake-rn and ferric. Consider extracting it into a shared utility to reduce duplication.
if (triplets.size === 0) {

packages/ferric/src/build.ts:135

  • [nitpick] The info message warns about defaults but doesn't list the actual targets chosen. Including [...] of default targets would make it clearer which targets are being used.
console.error(

packages/cmake-rn/src/cli.ts:133

  • There are no tests verifying the new default-triplet behavior. Adding unit tests to cover scenarios where no triplets are provided would help prevent regressions.
if (triplets.size === 0) {

packages/cmake-rn/src/android.ts:98

  • The function uses fs.existsSync but fs is not imported. Add import fs from 'fs'; at the top of the file.
export function isAndroidSupported() {

}
if (isAppleSupported()) {
if (process.arch === "arm64") {
targets.add("aarch64-apple-ios-sim");
Copy link

Copilot AI Jun 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the ARM64 simulator is added for Apple; consider also adding x86_64-apple-ios-sim when process.arch === "x64" to cover Intel-based simulators.

Suggested change
targets.add("aarch64-apple-ios-sim");
targets.add("aarch64-apple-ios-sim");
} else if (process.arch === "x64") {
targets.add("x86_64-apple-ios-sim");

Copilot uses AI. Check for mistakes.

@kraenhansen kraenhansen requested a review from mani3xis June 12, 2025 08:18
@kraenhansen kraenhansen merged commit d703f8d into main Jun 17, 2025
4 checks passed
@kraenhansen kraenhansen deleted the kh/default-targets-and-triplets branch June 17, 2025 07:16
@kraenhansen
Copy link
Collaborator Author

Merging for now, to keep things going. Please review in retrospect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CMake RN Our `cmake` wrapping CLI Ferric 🦀

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants