Skip to content

Delete generated BuildTypeAttr in module file to not force the build type to app consumer#425

Open
DevHugo wants to merge 1 commit intoairbnb:masterfrom
DevHugo:fix-416-variant-issue
Open

Delete generated BuildTypeAttr in module file to not force the build type to app consumer#425
DevHugo wants to merge 1 commit intoairbnb:masterfrom
DevHugo:fix-416-variant-issue

Conversation

@DevHugo
Copy link

@DevHugo DevHugo commented Nov 23, 2025

Fix #416, #274.

Due to commit e7f105f the module file generated by the plugin gradle-maven-publish-plugin contains com.android.build.api.attributes.BuildTypeAttr attribute. This attribute force consumer of the library to use only the build types specified by the attribute: "debug" and "release".
See this medium article, if you want to have more details on the issue.

Reproduction case is to create an app with a specific buildTypes (not debug and release) and try to compile. Example on ReproProjectShowkase with command ./gradlew clean assemblePaid --rerun-tasks --no-configuration-cache

Before the PR, the module file look like this.

 "variants": [
  {
    "name": "debugVariantMavenApiPublication",
    "attributes": {
      "com.android.build.api.attributes.BuildTypeAttr": "debug"
      (other attrs redacted for clarity ...)
    },
  }
]

After this PR, the module generated by the plugin should look like the 1.0.4 version module file. You can attest that by checking the diff between the 1.0.4 version and the fixed module file 1.0.5: https://www.diffchecker.com/dn2JxDwe/ (external website diffchecker.com).

It also avoid publishing debug artefact, that was not needed. See this PR and issue 274.

You can find documentation on AndroidSingleVariantLibrary or source code, if you want to deep-dive a little.

Non regression test done: see that it works in the demo project ReproProjectShowkase and test the sample app.

…type to app consumer

Fix airbnb#416, airbnb#274

Due to commit e7f105f the module file generated by the plugin gradle-maven-publish-plugin contains
com.android.build.api.attributes.BuildTypeAttr attribute.
This attribute force consumer of the library to use only the build types specified by the attribute: "debug" and "release".

Reproduction case is to create an app with a specific buildTypes (not debug and release) and try to compile.
Example on https://github.com/DevHugo/ReproProjectShowkase with command  ./gradlew clean assemblePaid --rerun-tasks --no-configuration-cache

It also avoid publishing debug artefact, that was not needed.
@DevHugo DevHugo force-pushed the fix-416-variant-issue branch from 584f80e to be28a3c Compare November 23, 2025 12:53
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.

1.0.5 publishing on debug and release variants only

1 participant