feat: add product flavor and dimension to RN App#386
Open
hurali97 wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an env flavor dimension (dev/prod) to the example React Native app and Brownfield library, and updates the brownfield Gradle plugin source-set wiring so variant-specific JNI libs and generated assets/resources are included correctly for flavored builds.
Changes:
- Add
envflavor dimension +dev/prodflavors toapps/RNApp(:appand:BrownfieldLib). - Update the brownfield Gradle plugin source-set configuration to include per-variant JNI lib directories (e.g.,
libsDevRelease). - Ensure the Android example app can consume the new flavored library via
missingDimensionStrategy("env", "dev"), and adjust packaging script / gitignore patterns accordingly.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| gradle-plugins/react/README.md | Documents how to use product flavors/dimensions with the brownfield module and the required alignment with the RN :app module. |
| gradle-plugins/react/brownfield/src/main/kotlin/com/callstack/react/brownfield/plugin/RNSourceSets.kt | Switches JNI lib source-set wiring from build-type-only to per-variant directories to support flavored variants. |
| apps/RNApp/package.json | Updates the Android packaging script to package the devRelease variant. |
| apps/RNApp/android/BrownfieldLib/build.gradle.kts | Adds env flavor dimension and dev/prod flavors to the Brownfield library module. |
| apps/RNApp/android/app/build.gradle | Adds matching env flavor dimension and dev/prod flavors to the RN app module. |
| apps/RNApp/.gitignore | Generalizes ignores to cover flavored JNI lib output directories (libs*Debug, libs*Release). |
| apps/AndroidApp/app/build.gradle.kts | Adds missingDimensionStrategy("env", "dev") so the consumer app can resolve the new env dimension. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
59
to
+60
| // 3. Lazily configure the 'main' source set using .named() | ||
| androidExtension.sourceSets.named(variant.name) { sourceSet -> | ||
| androidExtension.sourceSets.named(variantName) { sourceSet -> |
Collaborator
There was a problem hiding this comment.
Let's just update this comment :D
Comment on lines
+105
to
+107
| flavorDimensions += "env" | ||
|
|
||
| productFlavors { |
artus9033
approved these changes
Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds product flavor and dimension to RN App. This helps increase the coverage for BGP to catch any regressions around product flavors and dimensions. For instance, after making these changes we found that the JNI libs were not being included in the AAR because of hardcoded sourcesets configuration.
Test plan