Add --strip option to strip debug symbols from outputs#286
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a --strip option to cmake-rn for removing debug symbols from built Android and Apple native libraries, reducing binary size in production builds.
Key Changes:
- Added
--stripCLI option to enable debug symbol stripping - Implemented platform-specific stripping logic using
strip(Apple) andllvm-strip(Android) - Refactored Android NDK path resolution into reusable helper functions
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/cmake-rn/src/cli.ts | Adds --strip CLI option definition |
| packages/cmake-rn/src/platforms/apple.ts | Implements stripping for Apple platforms using strip -rSTx command |
| packages/cmake-rn/src/platforms/android.ts | Implements stripping for Android using NDK's llvm-strip and refactors NDK path helpers |
| .changeset/great-kings-clean.md | Documents the new feature in the changeset |
| const outputPath = path.join(buildPath, "out"); | ||
| assert( | ||
| fs.existsSync(outputPath), | ||
| `Expected output file in ${outputPath}`, | ||
| ); |
There was a problem hiding this comment.
The outputPath variable is computed but never used. The assertion checks for 'out' directory existence, but this appears unrelated to the stripping operation. Either remove this unused code or clarify its purpose if it's meant to validate something about the strip operation.
| const outputPath = path.join(buildPath, "out"); | |
| assert( | |
| fs.existsSync(outputPath), | |
| `Expected output file in ${outputPath}`, | |
| ); |
| const outputPath = path.join(buildPath, "out"); | ||
| assert( | ||
| fs.existsSync(outputPath), | ||
| `Expected output file in ${outputPath}`, |
There was a problem hiding this comment.
The error message says 'Expected output file' but the check is for a directory named 'out'. The message should say 'Expected output directory' to accurately reflect what's being validated.
| `Expected output file in ${outputPath}`, | |
| `Expected output directory at ${outputPath}`, |
ba50b37 to
22952b9
Compare
Merging this PR will:
--stripoption to allow the stripping of debug information from Android and Apple libraries.