Skip to content

chore: attach release info to proguard mapping upload#491

Merged
turnipdabeets merged 2 commits intomainfrom
chore/new-cli-params-release-version
Apr 17, 2026
Merged

chore: attach release info to proguard mapping upload#491
turnipdabeets merged 2 commits intomainfrom
chore/new-cli-params-release-version

Conversation

@turnipdabeets
Copy link
Copy Markdown
Contributor

@turnipdabeets turnipdabeets commented Apr 17, 2026

💡 Motivation and Context

The posthog-cli's exp proguard upload accepts --release-name, --release-version, and --build (via flattened ReleaseArgs), but this plugin only passed --path and --map-id. As a result, proguard uploads either fell back to git-derived release info (repo name + commit SHA) or created no release association at all — not the app's actual release identity.

iOS (posthog-ios#558) and React Native (posthog-js) already attach this info on their symbol/sourcemap uploads. This PR brings Android to parity.

Captura de pantalla 2026-04-17 a la(s) 1 27 59 p m

💚 How did you test it?

Built :posthog-samples:posthog-android-sample:assembleRelease twice against environment 381971:

Before:

posthog-cli exp proguard upload --path ... --map-id bbb498d5...

→ CLI auto-created release posthog-android@eac1385... (git repo name + commit SHA).

After (with versionCode=2, versionName="1.1" for validation):

posthog-cli exp proguard upload --path ... --map-id bbb498d5... \
  --release-name com.posthog.android.sample --release-version 1.1 --build 2

→ Release associated with the app's actual identity.

Empty-string values from the variant are filtered out so the CLI still falls back to git-derived info when applicationId / versionName / versionCode aren't set.

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran pnpm changeset to generate a changeset file
  • Added the "release" label to the PR to indicate we're publishing new versions for the affected packages

@turnipdabeets turnipdabeets requested a review from a team as a code owner April 17, 2026 12:22
Comment thread .changeset/attach-release-info-to-proguard-upload.md Outdated
Copy link
Copy Markdown
Member

@marandaneto marandaneto left a comment

Choose a reason for hiding this comment

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

missing the release label? LGTM

Plumbs applicationId, versionName, and versionCode from the Android variant into the
proguard upload task so they are passed to posthog-cli as --release-name, --release-version,
and --build. Mirrors the release info already attached on iOS (posthog-ios#558) and React
Native (posthog-js).

Previously the CLI fell back to git-derived release info (repo name + commit SHA); now
uploads are associated with the app's actual release identity, matching how releases show
up across SDKs.
@turnipdabeets turnipdabeets force-pushed the chore/new-cli-params-release-version branch from b08f154 to 72272c7 Compare April 17, 2026 12:39
AGP exposes an unset versionCode as -1 (its sentinel for missing), not null. The
previous implementation passed that through verbatim, producing '--build -1' which
the CLI rejects as an unknown flag, breaking proguard uploads for any app that
doesn't explicitly declare versionCode.

Switch the build property to Int so we can apply Android's platform invariant
(versionCode must be ≥ 1) and drop the flag when the value isn't a real build
number.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants