Skip to content

Prepare for AGP 10 migration - #6181

Open
eliotcougar wants to merge 5 commits into
2dust:masterfrom
eliotcougar:build/agp-modernization
Open

eliotcougar wants to merge 5 commits into
2dust:masterfrom
eliotcougar:build/agp-modernization

Conversation

@eliotcougar

@eliotcougar eliotcougar commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Prepare for AGP 10 by replacing legacy Android DSL and private variant APIs while retaining current upstream's AGP 9.4.1, Gradle 9.6.0, Kotlin/Compose compiler 2.4.20 and license plugin 0.9.91. The app stays on AGP 9; release shrinking remains disabled.

The branch includes upstream/master through 53fce9a8f. Dependency versions, version 2.3.8, application source and native-library revisions match that upstream base. The remaining diff is limited to build-system migration.

Changes

  • Enable the modern Android DSL and built-in Kotlin. Remove the standalone Kotlin Android plugin and compatibility opt-outs. Supply the version-catalog KGP dependency on the root buildscript classpath so built-in Kotlin stays aligned with the Compose compiler. Retain JVM target 17.
  • Replace applicationVariants and private ApkVariantOutputImpl casts with androidComponents.onVariants, public output properties and BuildConfigField. Retain the exact DISTRIBUTION values, ABI filtering and universal APK behavior. Use the modern jniLibs.directories API.
  • Retain the regenerated Gradle 9.6 wrapper scripts/JAR and pinned distribution SHA-256. Upstream now selects the same Gradle version; this PR keeps the complete wrapper update and integrity settings.
  • Remove the old SDK, R-class, dependency, resource-value and shrinker compatibility switches. BuildConfig and Compose remain explicitly enabled; this does not enable R8 or resource shrinking.
  • Replace CI's line-number-dependent sed insertion with an NDK_VERSION job value used for installation, NDK_HOME and both Gradle invocations. Pin the ordinary Gradle default as well:
ndkVersion = providers.gradleProperty("NDK_VERSION").getOrElse("29.0.14206865")

The NDK strips native libraries, so a plain rebuild needs the release NDK to avoid differing native-library bytes. This preserves intentional overrides and implements the compatibility recommendation from #6219; its JDK pin and exact-tag workflow checks remain independent.

Preserved APK contract

Distribution Filename Version code
Play Store v2rayNG_<version>_<abi>.apk 4_000_000 + baseVersionCode
F-Droid v2rayNG_<version>-fdroid_<abi>.apk 5_000_000 + 100 * baseVersionCode + abiOffset

F-Droid offsets remain universal=0, arm64-v8a=1, armeabi-v7a=2, x86_64=3 and x86=4. Package IDs, default four-ABI plus universal output, explicit ABI_FILTERS behavior and artifact-upload patterns are preserved.

Validation

Validated at merge commit cf329109, based on upstream 53fce9a8f:

  • Play Store and F-Droid debug/release assembly plus both unit-test suites: 201 tasks executed, build successful.
  • 81 tests per flavor, 162 total, with zero failures, errors or skips.
  • All 20 APKs checked for current version 2.3.8, package IDs, filenames, version-code formulas, ABI sets and required geodata. Every requested ABI includes both HEV libraries and libgojni.so, matching the native-stripping outputs.
  • Exact generated DISTRIBUTION values verified in all four variants.
  • AGP resolves the default and installed toolchain to NDK 29.0.14206865 without an override; no unstripped-library fallback warnings.
  • Strict configuration-cache storage passed with JDK 21, Gradle 9.6.0, two workers and in-process Kotlin compilation.
  • Official AndroidLibXrayLite v26.9.9 AAR matches upstream gitlink d0c6c4ae and GitHub's release SHA-256; all four JNI ABIs and geodata verified. Existing HEV inputs retained for unchanged gitlink 64cc609f.
  • actionlint 1.7.12 passed with the existing ubuntu-26.04 runner-label exception; git diff --check and instruction-file boundary checks passed.

Not run: production signing CI, device runtime checks or independent cross-machine byte-for-byte reproducibility. The local builds reuse the official native release inputs; this PR prepares the build-system migration and aligns NDK selection without claiming complete reproducibility.

AcideFluorhydrique added a commit to AcideFluorhydrique/v2rayNG that referenced this pull request Sep 14, 2026
2dust#6181 also drops the sed, and for a better reason: it adds imports for
the public variant API, which moves the line the sed counts to. It passes
the version as -PNDK_VERSION instead, with AGP's default applying when the
property is absent.

That default is the problem for reproducibility. Someone rebuilding a
published APK runs Gradle without knowing about the property, gets AGP's
default NDK, and strips the jniLibs with a different one, so the bytes
differ with nothing to indicate why.

Read the property and keep the pinned value as its default, so both hold:
CI or a local build can override it, and a plain Gradle invocation still
uses the NDK the release was built with.
@eliotcougar
eliotcougar marked this pull request as ready for review September 15, 2026 17:26
Use the current Gradle 9.8 distribution with its verified checksum, preserve the upstream JUnit Platform setup and dependency versions, and align local and CI NDK defaults with upstream r30. Retain the AGP migration, public variant API and distribution-specific artifact/version-code mapping.

Validation: Play Store and F-Droid JVM suites and debug APKs passed; both release variants assembled. Version-code ranges, output names and four-ABI native packaging checked. Workflow lint passed apart from the inherited ubuntu-26.04 label unsupported by the installed actionlint catalog. Production signing and byte-for-byte reproducibility were not run.
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.

1 participant