Keep Firebase's Gradle plugin in the Google Play edition

Only the -gplay edition may read a Google library. The google-services
plugin's classpath moves from the root plugins block into
droid/app/gplay-classpath.gradle and its application into
droid/app/gplay.gradle, both applied only in a Gradle run whose tasks name
gplay. Such a run refuses release or debug tasks beside it, so the Makefile
and the release workflow build the normal and gplay APKs in separate runs,
and the normal and F-Droid builds never resolve the plugin. The Moto check
builds only the normal APK and no longer writes the Firebase config.

CI checks the Gradle files with Kryon's google-free action, the release
workflow checks the normal, per-ABI and -fdroid APKs and finds Play
Billing in the -gplay APK, and the F-Droid workflow checks F-Droid's own APK.
This commit is contained in:
waozi committed 2026-10-29 16:22:59 -03:00
1 parent e2303c3ab4
commit cf1323ac8f
9 files changed
+81 -16

No files matched your search

-5
View File
@@ -106,11 +106,6 @@ jobs:
mkdir -p ~/.android
printf '%s' "$KEYSTORE_BASE64" | base64 -d > ~/.android/inbe-release.keystore
- name: Prepare Firebase config
env:
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}
run: ./scripts/write-google-services-json.sh
- name: Copy Android assets
run: ./scripts/copy-android-assets.sh
+12
View File
@@ -58,6 +58,18 @@ jobs:
fi
python3 scripts/check-file-size.py --since "$base"
google-free:
name: Google libraries only in the gplay edition
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
# The normal and F-Droid builds read no Google library or plugin; only
# gplay-scoped configurations and gplay files may name one.
- name: Keep Google libraries out of the normal and F-Droid build files
uses: kryonlabs/kryon/.github/actions/google-free@7217475dfa7f462939e47e3f0bc918aef248b179
guard-package-urls:
name: Package URLs are public HTTPS
runs-on: ubuntu-latest
+8
View File
@@ -65,6 +65,14 @@ jobs:
- name: Build and scan with F-Droid without cached package sources
run: python3 build/xyz.waozi.inbe/scripts/check-fdroid.py
# F-Droid's scanner checked the source; its APK must hold no Google
# library either.
- name: Keep Google libraries out of F-Droid's APK
uses: kryonlabs/kryon/.github/actions/google-free@7217475dfa7f462939e47e3f0bc918aef248b179
with:
packages: tmp/*.apk
source: ''
- name: Preserve APK, exact metadata and scanner evidence
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
+25 -1
View File
@@ -981,7 +981,13 @@ jobs:
run: |
set -euo pipefail
chmod +x droid/gradlew
./droid/gradlew -p droid assembleRelease assembleGplay \
./droid/gradlew -p droid assembleRelease \
-Pkeystore.path="$HOME/.android/inbe-release.keystore" \
-Pkeystore.alias="$KEY_ALIAS" \
-Pkeystore.password="$KEYSTORE_PASSWORD" \
--stacktrace
# Only the Google Play edition's own Gradle run reads its Google plugin.
./droid/gradlew -p droid assembleGplay \
-Pkeystore.path="$HOME/.android/inbe-release.keystore" \
-Pkeystore.alias="$KEY_ALIAS" \
-Pkeystore.password="$KEYSTORE_PASSWORD" \
@@ -1034,6 +1040,24 @@ jobs:
done
cp "build/android/inbe-$VERSION-gplay.aab" build/release/android/
# Only the Google Play edition may hold a Google library, in its build
# files as in its APK. The universal and both x86 APK names end in a digit.
- name: Keep Google libraries out of the normal and F-Droid APKs
uses: kryonlabs/kryon/.github/actions/google-free@7217475dfa7f462939e47e3f0bc918aef248b179
with:
packages: >-
build/release/android/inbe-*[0-9].apk
build/release/android/inbe-*-arm*.apk
build/release/android/inbe-*-fdroid.apk
# The Google check must still recognise Play Billing, or its passes on
# the other editions prove nothing.
- name: Find Play Billing in the Google Play APK
uses: kryonlabs/kryon/.github/actions/google-free@7217475dfa7f462939e47e3f0bc918aef248b179
with:
packages: build/release/android/inbe-*-gplay.apk
source: ''
expect-google: 'true'
- name: Upload Android Artifacts
uses: actions/upload-artifact@v4
with:
+18 -8
View File
@@ -1,16 +1,26 @@
buildscript {
// Only the Google Play edition may read a Google library or plugin
// (gplay-classpath.gradle, gplay.gradle), so it builds in its own Gradle
// run, apart from the direct and F-Droid builds.
ext.buildingGplay = gradle.startParameter.taskNames.any { it.toLowerCase().contains('gplay') }
if (buildingGplay && gradle.startParameter.taskNames.any {
def name = it.toLowerCase()
name.contains('release') || name.contains('debug')
}) {
throw new GradleException('Build the gplay edition in its own Gradle run')
}
if (buildingGplay) {
apply from: 'gplay-classpath.gradle', to: buildscript
}
}
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
def hasGplayFirebaseConfig = file("src/gplay/google-services.json").exists()
if (hasGplayFirebaseConfig) {
apply plugin: 'com.google.gms.google-services'
tasks.configureEach { task ->
if (task.name == "processDebugGoogleServices" || task.name == "processReleaseGoogleServices") {
task.enabled = false
}
}
if (buildingGplay) {
apply from: 'gplay.gradle'
}
def appOnlyAbi = (project.findProperty('app.onlyAbi') ?: '').toString()
def verificationInstance = (project.findProperty('app.verificationInstance') ?: 'false').toString().toBoolean()
+10
View File
@@ -0,0 +1,10 @@
// The Google Play edition's Firebase Cloud Messaging plugin, which
// build.gradle adds to its own classpath (beside the Android plugin it
// extends) only in a Gradle run that builds the gplay build type.
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.google.gms:google-services:4.5.0'
}
+6
View File
@@ -0,0 +1,6 @@
// Firebase Cloud Messaging for the Google Play edition (classpath in
// gplay-classpath.gradle). CI writes src/gplay/google-services.json; local
// Play builds without it keep push inert.
if (file('src/gplay/google-services.json').exists()) {
apply plugin: 'com.google.gms.google-services'
}
-1
View File
@@ -1,5 +1,4 @@
plugins {
id 'com.android.application' version '8.13.2' apply false
id 'org.jetbrains.kotlin.android' version '2.3.0' apply false
id 'com.google.gms.google-services' version '4.5.0' apply false
}
+2 -1
View File
@@ -47,7 +47,8 @@ android-release:
$(MAKE) android-copy-assets
$(MAKE) android-local-properties
@if [ -n "$(PASSWORD)" ]; then \
$(ANDROID_GRADLE_ENV) $(GRADLE) -p droid assembleRelease assembleGplay -Pkeystore.path="$(ANDROID_KEYSTORE)" -Pkeystore.alias="$(ANDROID_KEY_ALIAS)" -Pkeystore.password="$(PASSWORD)" $(ANDROID_GRADLE_ARGS) || exit $$?; \
$(ANDROID_GRADLE_ENV) $(GRADLE) -p droid assembleRelease -Pkeystore.path="$(ANDROID_KEYSTORE)" -Pkeystore.alias="$(ANDROID_KEY_ALIAS)" -Pkeystore.password="$(PASSWORD)" $(ANDROID_GRADLE_ARGS) || exit $$?; \
$(ANDROID_GRADLE_ENV) $(GRADLE) -p droid assembleGplay -Pkeystore.path="$(ANDROID_KEYSTORE)" -Pkeystore.alias="$(ANDROID_KEY_ALIAS)" -Pkeystore.password="$(PASSWORD)" $(ANDROID_GRADLE_ARGS) || exit $$?; \
else \
echo "Set PASSWORD=your-keystore-password for release builds"; \
exit 1; \