Skip to content

0.9.3: dist-apk carries the graph's shared libraries, and the manifest template gains the version tokens - #23

Merged
Sunrisepeak merged 1 commit into
mainfrom
fix/apk-needed-shared-libs-and-version-tokens
Sep 13, 2026
Merged

0.9.3: dist-apk carries the graph's shared libraries, and the manifest template gains the version tokens#23
Sunrisepeak merged 1 commit into
mainfrom
fix/apk-needed-shared-libs-and-version-tokens

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

Two things an application whose framework is a separate lib<fw>.so on Android — the shape Gradle builds, and the shape a Java host that calls System.loadLibrary("<fw>") requires — hits against 0.9.2.

The graph's shared libraries never reached the APK

A dependency declared linkage = "shared" in the root's Android row is linked as lib<dep>.so beside the app's object in the ordinary build's bin/, and the app's dynamic section NEEDs it by name. The engine stages the app's own object and the deployed files (2026.9.13.2, #630 3a), but the closure on this row is not-walked — a host cannot run an Android artifact — so lib/ carried the app and libc++_shared.so only, and the APK installed and died at dlopen (measured with HuxerUI's framework as a shared library: NEEDED libhuxerui.so, 100 MB dev, absent from the archive).

apk:needed walks NEEDED from ${mcpp.target_file:<app>} at command time (llvm-readelf -d from the toolchain that linked it, the same reader needs_libcxx_shared uses) and copies every name that exists beside the object, recursively, into lib/<abi>/. Platform libraries (libandroid.so, libc.so) live nowhere beside it and are skipped; libc++_shared.so stays the plan-time copy. The engine's side of this — a declared, graph-built shared library is not a closure discovery and could be staged before the walk, as deployed files are — is worth an mcpp note; this member does not need it.

{{version_name}} / {{version_code}}

The manifest template gains the two tokens: the package version as written, and Android's integer as major * 1000000 + minor * 1000 + patch over the leading numeric segments (1 when none parses; Android refuses 0). A template can now carry android:versionName / android:versionCode without a second spelling of the version. The built-in default stays byte-identical to 0.8.0's (criterion (a)).

Tests

  • tests/apk-consumer-shared: an app with a path dependency declared linkage = "shared" on the Android row; the APK lists lib/x86_64/libapk-consumer-dep.so beside the app's own object. New CI step.
  • tests/apk-consumer criterion (h): a template with both tokens; aapt2 dump badging reports versionName='0.3.0', versionCode='3000'.
  • Locally, mcpp 2026.9.13.2: (a) to (h) pass; the shared fixture packs and lists the three .so.

Version 0.9.3.

…t template gains the version tokens

Two things an application whose framework is a separate `lib<fw>.so`
on Android (the shape Gradle builds) hits against 0.9.2.

The graph's shared libraries never reached the APK. A dependency declared
`linkage = "shared"` is linked as `lib<dep>.so` beside the app's object
in the ordinary build's `bin/` and NEEDed by name; the engine stages the
app's own object and the deployed files, but the closure on this row is
`not-walked` (a host cannot run an Android artifact), so `lib/` carried
the app and `libc++_shared.so` only, and the APK installed and died at
`dlopen`. `apk:needed` now walks NEEDED from the app's own object at
command time -- the set is not knowable at plan time without the
closure -- and copies every name that exists beside the object,
recursively, into `lib/<abi>/`; platform libraries live nowhere beside
it and are skipped.

The manifest template gains `{{version_name}}` (the package version as
written) and `{{version_code}}` (major * 1000000 + minor * 1000 +
patch over the leading numeric segments, 1 when none parses), so a
template can carry `android:versionName` / `android:versionCode`
without a second spelling of the version. The built-in default stays
byte-identical to 0.8.0's.

`tests/apk-consumer-shared` (a path dependency shared on the Android
row; the APK lists `lib/x86_64/libapk-consumer-dep.so`) and criterion
(h) of `tests/apk-consumer` (versionName 0.3.0, versionCode 3000).
Both measured locally with mcpp 2026.9.13.2; (a) to (g) unchanged.
@Sunrisepeak
Sunrisepeak merged commit 9301832 into main Sep 13, 2026
7 of 9 checks passed
@Sunrisepeak
Sunrisepeak deleted the fix/apk-needed-shared-libs-and-version-tokens branch September 13, 2026 17:34
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.

2 participants