Repository navigation
feat(bgp): follow the brownfield module's Gradle excludes in the published metadata - #522
Merged
hurali97 merged 4 commits intoNov 9, 2026
Merged
Conversation
…ished metadata
The plugin builds the published dependency list from what embedded
libraries declare, not from what Gradle resolves, so a dependency excluded
with configurations.all { exclude(...) } was still added to the POM and
module.json, and the host app resolved it. Exclude rules on the brownfield
module's implementation, api, runtimeOnly and embed configurations now
keep a dependency out. :app's rules and variant-specific ones are not read.
On Expo, where prebuild regenerates the module, android.expo.excludeDependencies
("group:module" or "group") is written into it as those exclude rules.
Gradle publishes a configuration-level exclude as an exclusion on the dependencies it declares, but not on the ones the plugin injects, so an excluded library could still reach the host through one of them. The injected POM and module.json entries now carry the same exclusions. Also pulls the never-publish rule out of the plugin's wiring so a test covers it, rejects a non-list android.excludeDependencies with a clear message, and splits up the README section.
KisaneNeko
marked this pull request as ready for review
November 5, 2026 17:47
hurali97
approved these changes
Nov 9, 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.
Problem
The plugin builds the published dependency list from what embedded libraries declare, not from what Gradle resolves. A dependency excluded with
configurations.all { exclude(...) }was still injected into the POM andmodule.json, so the host app resolved it anyway. For example,com.caverock:androidsvgandcom.caverock:androidsvg-aarship the same classes and the host failed with duplicate classes. A custom task that editsmodule.jsondoesn't help, becausebrownfieldRemoveDependenciesFromModuleFileinjects the dependency again after it.Change
GradleExclude.kt,RNBrownfieldPlugin.kt: exclude rules on the brownfield module'simplementation,api,runtimeOnlyandembedconfigurations keep a dependency out of the published files.:app's rules, variant-specific configurations and dependency-level excludes are not read.PublishingMetadataInjector.kt: injected dependencies carry the same rules as<exclusions>in the POM andexcludesinmodule.json, as Gradle does for the dependencies it writes, so the excluded library can't arrive through one of them.android.expo.excludeDependenciesinbrownfield.config.json(orandroid.excludeDependenciesinapp.json), asgroup:moduleorgroup. Prebuild writes them into the generated module as aconfigurations.all { exclude(...) }block. Types,schema.json, the scaffold config andconfiguration.mdxare updated.Verified with RNApp (
configurations.allexclude ofgsonand a group-onlyandroidx.swiperefreshlayout) and ExpoApp57 (android.expo.excludeDependencies: ["com.caverock:androidsvg-aar"]): neither stays a dependency in the published POM ormodule.json.Before merging
Rerun those two publishes: they ran before the injected dependencies got the
<exclusions>, which is only unit tested so far.