Skip to content

feat: expose Brownfield Gradle Plugin as node module - #359

Merged
artus9033 merged 10 commits into
callstack:mainfrom
MrMuzyk:feat/expose-bgp-as-node-module
Jun 17, 2026
Merged

feat: expose Brownfield Gradle Plugin as node module#359
artus9033 merged 10 commits into
callstack:mainfrom
MrMuzyk:feat/expose-bgp-as-node-module

Conversation

@MrMuzyk

@MrMuzyk MrMuzyk commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Include the Brownfield Android Gradle Plugin source in the published @callstack/react-native-brownfield package
  • Add a script that copies the Gradle plugin source into the package before publishing and removes the copy afterwards
  • Document the node_modules setup as an advanced option for local patching
  • Keep the Maven dependency as the default and recommended setup
  • Add missing repository declarations to the Gradle plugin's settings.gradle to support composite build resolution
  • Add a changeset

Test plan

Check that the npm package contains the Gradle plugin source:
yarn workspace @callstack/react-native-brownfield pack --dry-run

image

Check that the copied Gradle plugin project can be loaded by Gradle:

yarn workspace @callstack/react-native-brownfield sync:gradle-plugin
./gradle-plugins/react/brownfield/gradlew -p packages/react-native-brownfield/gradle-plugin/brownfield tasks
yarn workspace @callstack/react-native-brownfield sync:gradle-plugin --clean

Within RNApp

  1. Remove classpath("com.callstack.react:brownfield-gradle-plugin:") from android/build.gradle
  2. Add to android/settings.gradle inside pluginManagement:
  includeBuild("../node_modules/@callstack/react-native-brownfield/gradle-plugin/brownfield")
  repositories {
      google()
      mavenCentral()  
      gradlePluginPortal()
  }
  1. Run ./gradlew :BrownfieldLib:assembleDebug
  2. Verify > Task :brownfield:compileKotlin appears in the output — this confirms the plugin was compiled from node_modules source rather than downloaded from Maven Central
  3. Verify BUILD SUCCESSFUL

Within Expo55

  1. Run expo prebuild --platform android --clean in apps/ExpoApp55
  2. In the generated apps/ExpoApp55/android/settings.gradle, add inside the pluginManagement block (after the last includeBuild line, before the closing }):
    includeBuild("../node_modules/@callstack/react-native-brownfield/gradle-plugin/brownfield")
    repositories {
    google()
    mavenCentral()
    gradlePluginPortal()
    }
  3. Run ./gradlew :brownfieldlib:assembleDebug
  4. Verify > Task :brownfield:compileKotlin appears — confirms plugin compiled from node_modules source, not Maven
  5. Verify BUILD SUCCESSFUL
Screenshot 2026-06-03 at 13 45 33 Screenshot 2026-06-03 at 13 45 49

@MrMuzyk
MrMuzyk marked this pull request as ready for review June 3, 2026 13:45
@artus9033 artus9033 changed the title feat: expose bgp as node module feat: expose Brownfield Gradle Plugin as node module Jun 3, 2026

@hurali97 hurali97 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great work!

Comment thread gradle-plugins/react/brownfield/gradle/libs.versions.toml
Comment thread gradle-plugins/react/brownfield/settings.gradle
@MrMuzyk

MrMuzyk commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Back from vacation. I will be addressing the comments and rebasing today!

@MrMuzyk
MrMuzyk requested a review from hurali97 June 16, 2026 12:17

@hurali97 hurali97 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM - Just take care of the changeset and we are good!

Comment thread .changeset/brownfield-gradle-plugin-source.md Outdated
@MrMuzyk

MrMuzyk commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Hey @artus9033, you wanted to have a look at it as well :)

@artus9033 artus9033 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Great job!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 makes the Brownfield Android Gradle Plugin source available inside the published @callstack/react-native-brownfield npm package so consumers can opt into using it via Gradle composite build (includeBuild) from node_modules for local patching, while keeping the Maven artifact as the default path.

Changes:

  • Add a sync-gradle-plugin-source.js script and wire it into prepack/postpack to copy the Gradle plugin source into the npm package and clean it up afterward.
  • Document the “load from node_modules source” setup in both the Gradle plugin README and the Android integration docs.
  • Improve composite build support by adding pluginManagement.repositories in the plugin’s settings.gradle, plus small Kotlin source/tooling adjustments.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/react-native-brownfield/scripts/sync-gradle-plugin-source.js New script to copy/remove Gradle plugin sources into the package for publishing.
packages/react-native-brownfield/package.json Adds sync:gradle-plugin and hooks sync/cleanup into prepack/postpack; includes gradle-plugin in published files.
packages/react-native-brownfield/.gitignore Ignores the generated gradle-plugin/ directory in the package workspace.
gradle-plugins/react/README.md Documents how to include the plugin build from node_modules.
gradle-plugins/react/brownfield/src/main/kotlin/.../ProjectConfigurations.kt Tightens generic bound for attribute copying (T : Any).
gradle-plugins/react/brownfield/settings.gradle Adds plugin repositories to support composite build plugin resolution.
gradle-plugins/react/brownfield/gradle/libs.versions.toml Bumps Kotlin JVM plugin version.
docs/docs/docs/getting-started/android.mdx Adds “Advanced: Load the Plugin from Node Modules” integration docs.
.changeset/brownfield-gradle-plugin-source.md Declares a minor release for exposing plugin source.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread gradle-plugins/react/README.md
Comment thread gradle-plugins/react/README.md
Comment thread gradle-plugins/react/brownfield/gradle/libs.versions.toml
@artus9033
artus9033 merged commit 533569b into callstack:main Jun 17, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants