Skip to content

feat(platform-android): add --extra-params to package:aar and publish-local:aar - #744

Merged
thiagobrez merged 1 commit into
mainfrom
feat/aar-extra-params
Nov 5, 2026
Merged

thiagobrez merged 1 commit into
mainfrom
feat/aar-extra-params

Conversation

@thiagobrez

Copy link
Copy Markdown
Collaborator

Summary

build:android and run:android already accept --extra-params to pass extra arguments to Gradle, but package:aar and publish-local:aar don't. That leaves no way to pass a project property (-Pfoo=bar) or any other Gradle flag when building or publishing an AAR. Projects that need one have to call ./gradlew directly.

This PR adds the same --extra-params <string> option to both AAR commands:

  • packageAar and publishLocalAar take an optional extraParams array, and runGradleAar appends it after -x lint, the same way runGradle does.
  • plugin-brownfield-android forwards args.extraParams to both commands.
  • Docs: a tip in the brownfield Android guide.
  • Patch changeset for @rock-js/platform-android and @rock-js/plugin-brownfield-android.

The new argument is optional, so existing callers of packageAar, publishLocalAar, packageAarAction and publishLocalAarAction behave exactly as before.

rock package:aar --variant Release --module-name reactnativeapp --extra-params "-PmyProperty=value"
rock publish-local:aar --module-name reactnativeapp --extra-params "-PmyProperty=value"

Use case

A brownfield project that publishes more than one AAR from the same Gradle build, for example a shared native core plus thin per-flavor AARs. A project property selects what the module builds. Today the AAR commands can't pass that property, so the project has to drop Rock for packaging.

Test plan

  • New aar.test.ts: packageAar and publishLocalAar spawn Gradle with the extra params appended, and both options parse the string into separate arguments.
  • pluginBrownfieldAndroid.test.ts: the registered package:aar and publish-local:aar actions forward extraParams.
  • pnpm vitest run for platform-android (aar) and plugin-brownfield-android; eslint and prettier are clean on the changed files.

@vercel

vercel Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
rock Ready Ready Preview Nov 4, 2026 2:31pm UTC

Request Review

@andrei-zgirvaci andrei-zgirvaci left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great job! LGTM!

@thiagobrez
thiagobrez merged commit 4930287 into main Nov 5, 2026
8 of 9 checks passed
@thiagobrez
thiagobrez deleted the feat/aar-extra-params branch November 5, 2026 11:59

This branch was successfully deployed

1 active deployment
Preview — 08fe3aa7 Deployed Nov 4, 2026 by vercel[bot]
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.

3 participants