-
Notifications
You must be signed in to change notification settings - Fork 3
Determine default targets from CMAKE_RN_TARGETS
and FERRIC_TARGETS
environment variable
#191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 9852f7e The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
70624d4
to
ee234b5
Compare
There was a problem hiding this 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 introduces environment variable-based default target configuration for both cmake-rn
and ferric
CLIs. The purpose is to allow users to specify default build targets via environment variables rather than requiring explicit command-line arguments each time.
- Adds
CMAKE_RN_TARGETS
environment variable support for cmake-rn CLI default targets - Adds
FERRIC_TARGETS
environment variable support for ferric CLI default targets - Enhances CLI output to show platform and target information during project configuration
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
packages/cmake-rn/src/cli.ts | Implements CMAKE_RN_TARGETS parsing, validation, and adds target summary display |
packages/ferric/src/build.ts | Implements FERRIC_TARGETS parsing with validation using assertFixable |
.github/workflows/check.yml | Updates CI configuration to use the new environment variables |
.changeset/loud-paths-eat.md | Documents ferric-cli changes |
.changeset/loud-dodos-kneel.md | Documents cmake-rn changes |
|
||
const defaultTargets = CMAKE_RN_TARGETS ? CMAKE_RN_TARGETS.split(",") : []; | ||
|
||
for (const target of defaultTargets) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The target validation logic is duplicated between cmake-rn and ferric packages. Consider extracting this validation into a shared utility function to maintain consistency and reduce code duplication.
Copilot uses AI. Check for mistakes.
const { FERRIC_TARGETS } = process.env; | ||
|
||
function getDefaultTargets() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The environment variable extraction is placed at module level but only used within getDefaultTargets(). Consider moving this extraction inside the function to improve encapsulation and make the dependency more explicit.
const { FERRIC_TARGETS } = process.env; | |
function getDefaultTargets() { | |
function getDefaultTargets() { | |
const { FERRIC_TARGETS } = process.env; |
Copilot uses AI. Check for mistakes.
CMAKE_RN_TARGETS
environment variableCMAKE_RN_TARGETS
and FERRIC_TARGETS
environment variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some post-review questions.
CMAKE_RN_TARGETS: arm64-apple-ios-sim | ||
FERRIC_TARGETS: aarch64-apple-ios-sim |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason why Ferric handles the build of aarch64
while cmake-rn handles arm64
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a naming difference between Xcode and the Rust compiler targets.
const targetOption = new Option("--target <target...>", "Targets to build for") | ||
.choices(allTargets) | ||
.default( | ||
defaultTargets, | ||
"CMAKE_RN_TARGETS environment variable split by ','" | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I last used [email protected]
, when invoking the cmake-rn
and cmake-rn --android --ios
commands, the CLI didn't prompt me for what targets to build. Is that still the case, or has something changed recently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's another fallback default if no targets are provided through the CLI runtime options. The reason that is not handled here is because I wanted to print a warning in that case.
We're currently building for Android x86_64 while running an x86 emulator.
Merging this PR will:
--target
runtime option when running thecmake-rn
andferric
CLIs.cmake-rn
CLI.