Skip to content

gradle: improve build reproducibility, pin gradle - #3393

Open
f321x wants to merge 2 commits into
kivy:developfrom
f321x:202610_gradle_reproducible_archives
Open

f321x wants to merge 2 commits into
kivy:developfrom
f321x:202610_gradle_reproducible_archives

Conversation

@f321x

@f321x f321x commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Upstreamed changes for build reproducibility from https://github.com/spesmilo/python-for-android.
See individual commits.

f321x added 2 commits October 14, 2026 14:22
Gradle's Zip, Jar and Tar tasks store file mtimes and use filesystem
order, so their output differs between builds. p4a normalises the tars
it writes itself, but sets nothing on the gradle side.

Under AGP 8.11 no shipped artifact changes: the apk and aab are not
built by archive tasks, and the service_library aar task already gets
both flags from AGP. The point is the default, so an archive task added
later by a newer AGP or by a plugin from --gradle-dependency is
reproducible too.

Refs kivy#3066, kivy#3069.

Upstreamed from https://github.com/spesmilo/python-for-android
Nothing verifies the gradle distribution we download. Adding
distributionSha256Sum alone would not fix that: the checked-in
gradle-wrapper.jar is from Gradle 2.1 (2014), which predates
distribution verification and silently ignores the key. That is worse
than omitting it, because the download then only looks verified. So the
jar has to be replaced for the pin to mean anything.

The new jar is the one Gradle publishes as gradle-8.14.3-wrapper.jar,
sha256
7d3a4ac4de1c32b59bc6a4eb8ecb8e612ccd0cf1ae1e99f66902da64df296172.
The pinned value is Gradle's published checksum for
gradle-8.14.3-all.zip; the -bin.zip one is different.

Checked with this repo's own gradlew: a wrong checksum now aborts the
build, the pinned one downloads, verifies and runs 8.14.3. The first
build after this re-downloads the archive, because the new wrapper names
its cache directory differently.

Version bumps have to move distributionUrl and distributionSha256Sum
together.

Upstreamed from https://github.com/spesmilo/python-for-android
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 63.278%. remained the same — f321x:202610_gradle_reproducible_archives into kivy:develop

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