Skip to content

Conversation

kraenhansen
Copy link
Collaborator

Stacked on #130, merging this PR will:

  • Add an --android-sdk-version option with a default value matching the minimum required Android SDK version in the React Native community template.

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

changeset-bot bot commented Jun 19, 2025

⚠️ No Changeset found

Latest commit: c45d06f

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 requested a review from Copilot June 19, 2025 13:58
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

Adds a new --android-sdk-version flag to the cmake-rn CLI so users can specify the Android platform API level for CMake-based React Native builds.

  • Introduce DEFAULT_ANDROID_SDK_VERSION and wire up a new CLI option
  • Pass androidSdkVersion through getTripletConfigureCmakeArgs and configureProject
  • Update Android CMake args to use -DANDROID_PLATFORM=<sdkVersion>

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/cmake-rn/src/cli.ts Define default SDK version constant, add --android-sdk-version option, and integrate it into the command pipeline
packages/cmake-rn/src/android.ts Extend getAndroidConfigureCmakeArgs signature to accept sdkVersion and set ANDROID_PLATFORM
Comments suppressed due to low confidence (5)

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

  • [nitpick] Add a comment explaining why 24 was chosen (e.g. matching the community template’s minSdkVersion) so future maintainers understand this default.
const DEFAULT_ANDROID_SDK_VERSION = "24";

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

  • [nitpick] Clarify in the help text that this flag sets the Android platform API level (e.g. 'API level for Android builds'), not the SDK tools version.
  "The Android SDK version to use for Android builds"

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

  • Consider adding a unit or integration test to ensure the --android-sdk-version option is parsed and propagated correctly.
const androidSdkVersionOption = new Option(

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

  • [nitpick] Remove or document the commented-out CMake flags related to ANDROID_NATIVE_API_LEVEL if they’re no longer needed to keep the codebase clean.
    `ANDROID_ABI=${architecture}`,

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

  • Also verify that the SDK platform directory (e.g. ${ANDROID_HOME}/platforms/android-${sdkVersion}) exists and, if missing, suggest running sdkmanager --install "platforms;android-${sdkVersion}".
    fs.existsSync(ndkPath),

@kraenhansen kraenhansen added the CMake RN Our `cmake` wrapping CLI label Jun 19, 2025
This was referenced Jun 19, 2025
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.

I'm assuming this option is here so that higher-level tooling (RN CLI?) can pull the mininmum SDK version from the user's Gradle files, is that correct?

@kraenhansen
Copy link
Collaborator Author

It's mostly for the library developer to pick, but it's only really needed if someone is calling into Android APIs from their native addon. The reason I added now is just to silence a warning - I should have probably made that clear from the description 😊

Base automatically changed from kh/cmake-rn/verbose to main June 20, 2025 07:46
@kraenhansen kraenhansen marked this pull request as ready for review June 20, 2025 07:48
@kraenhansen kraenhansen merged commit 828145a into main Jun 20, 2025
4 checks passed
@kraenhansen kraenhansen deleted the kh/cmake-rn/android-sdk branch June 20, 2025 07:56
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants