Skip to content

fix: android consumer-rules - #107

Merged
ovitrif merged 8 commits into
mainfrom
fix/r8-keep-fieldorder
Aug 28, 2026
Merged

fix: android consumer-rules#107
ovitrif merged 8 commits into
mainfrom
fix/r8-keep-fieldorder

Conversation

@ovitrif

@ovitrif ovitrif commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Fixes #105

Follow-up to #106.

The Android AAR ships consumer keep rules for UniFFI/JNA so a minified app can resolve JNI names and lay out JNA structs.

Library publish packages proguard.txt in the AAR. Minified-app R8 belongs in the consuming app.

Description

  • Keeps com.sun.jna.* so libjnidispatch can resolve JNI names on Native, Structure, and CallbackReference.
  • Keeps classes that extend com.sun.jna.*, including com.sun.jna.ptr ByReference types used as UniFFI callback out-params.
  • Keeps com.sun.jna.Structure$FieldOrder and annotated org.lightningdevkit.ldknode struct classes, fields, and constructors.
  • Fails bundleReleaseAar when the AAR is missing a non-empty proguard.txt.

Out of scope

  • Running R8 in this repo.

Preview

N/A — Android consumer keep rules only.

QA Notes

  • Release AAR contains a non-empty proguard.txt with those consumer keep rules.

Release

R8 full mode stripped @structure.FieldOrder from UniFFI structs. Keep the
annotation type and annotated classes so JNA can still lay out the structs.
@ovitrif
ovitrif requested a review from ben-kaufman August 26, 2026 20:17

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b333b30b79

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread CHANGELOG.md Outdated
@ovitrif
ovitrif marked this pull request as draft August 26, 2026 20:39
@ovitrif ovitrif changed the title fix: keep JNA FieldOrder annotations under R8 fix: keep JNA JNI symbols in Android consumer rules Aug 26, 2026
@ovitrif ovitrif changed the title fix: keep JNA JNI symbols in Android consumer rules fix: android consumer-rules Aug 26, 2026
Ship FieldOrder and com.sun.jna.* keeps in the AAR. Library publish
packages proguard.txt so a minified app can resolve JNI names and
lay out JNA structs.
@ovitrif
ovitrif marked this pull request as ready for review August 28, 2026 15:39
@ovitrif
ovitrif requested a review from coreyphillips August 28, 2026 15:39
@ovitrif ovitrif self-assigned this Aug 28, 2026
@ovitrif
ovitrif merged commit 03ccac7 into main Aug 28, 2026
2 checks passed
@ovitrif
ovitrif deleted the fix/r8-keep-fieldorder branch August 28, 2026 20:37
@ovitrif

ovitrif commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator Author

Merged without waiting on review.

This only ships Android consumer keep rules in the AAR (proguard.txt). Those rules are unused until a consuming app enables R8. Bitkit does not do that until synonymdev/bitkit-android#1184 lands, so merging this now does not change runtime behavior for current consumers.

The Android PR is the actual enablement and the place to review the live impact.

These changes were a port of the synonymdev/bitkit-core#145 PR changes which were reviewed and tested on android.

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.

add android r8 consumer keep rules

1 participant