app: a bench build type for P0's benchmark gate
Own application id (.bench suffix) and label ("AI Sessions bench" via a
build-type resValue over the new @string/app_name), release
optimisations, signed with the same key build-apk.sh already generates,
FIXTURE_MODE=true wired through BuildConfig. Its asset source set points
straight at app/bench-fixture/assets rather than a copy under androidApp,
so there is one file to keep in sync with the generator, not two.
build-apk.sh bench builds it; the CA-pinning step is untouched and still
requires a real ca.pem to exist, even though this build never connects --
simplest to let it pin whatever is there rather than special-casing it.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
0be6a571c4
commit
a6cb9a9082
4 files changed
+55
-4
No files matched your search
@@ -102,6 +102,16 @@ android {
|
|||||||
targetSdk = 37
|
targetSdk = 37
|
||||||
versionCode = 1
|
versionCode = 1
|
||||||
versionName = "1.0"
|
versionName = "1.0"
|
||||||
|
// Read by MainActivity to decide, at startup, whether this is the P0 benchmark build
|
||||||
|
// (docs/RUST.md's P0 box) rather than the app somebody enrolled. False everywhere except
|
||||||
|
// the `bench` build type below, which overrides it.
|
||||||
|
buildConfigField("boolean", "FIXTURE_MODE", "false")
|
||||||
|
}
|
||||||
|
buildFeatures {
|
||||||
|
// Only for FIXTURE_MODE above; nothing else here reaches for generated BuildConfig fields.
|
||||||
|
buildConfig = true
|
||||||
|
// Only for the bench build type's resValue("string", "app_name", ...) below.
|
||||||
|
resValues = true
|
||||||
}
|
}
|
||||||
packaging {
|
packaging {
|
||||||
resources { excludes += "/META-INF/{AL2.0,LGPL2.1}" }
|
resources { excludes += "/META-INF/{AL2.0,LGPL2.1}" }
|
||||||
@@ -131,6 +141,35 @@ android {
|
|||||||
isMinifyEnabled = false
|
isMinifyEnabled = false
|
||||||
if (keystore != null) signingConfig = signingConfigs.getByName("release")
|
if (keystore != null) signingConfig = signingConfigs.getByName("release")
|
||||||
}
|
}
|
||||||
|
// P0's benchmark build (docs/RUST.md, docs/DECISIONS.md's 2026-09-05 entry): release
|
||||||
|
// optimisations so a frame time measured here means what release means everywhere else in
|
||||||
|
// this project, its own application id so it installs beside a real enrollment rather than
|
||||||
|
// replacing it, and FIXTURE_MODE so MainActivity opens straight onto the fixture session
|
||||||
|
// instead of asking to be enrolled. Signed with the same key as release -- it never talks
|
||||||
|
// to a real backend, so there is no CA of its own to mismatch, and a second keystore would
|
||||||
|
// be one more secret to keep off this machine's shared mount for no benefit.
|
||||||
|
create("bench") {
|
||||||
|
initWith(getByName("release"))
|
||||||
|
// :link (wg-app-link) has no "bench" build type of its own -- it is a library shared
|
||||||
|
// with dev-updater and has no reason to know this project invented one -- so this says
|
||||||
|
// which of its build types to link against instead.
|
||||||
|
matchingFallbacks += listOf("release")
|
||||||
|
applicationIdSuffix = ".bench"
|
||||||
|
// "AI Sessions bench" everywhere the OS shows the app's name (launcher, recents,
|
||||||
|
// Settings): this resValue overrides res/values/strings.xml's app_name for this
|
||||||
|
// build type alone, and AndroidManifest.xml's android:label reads @string/app_name
|
||||||
|
// rather than a literal so a build type can override it without touching the
|
||||||
|
// manifest.
|
||||||
|
resValue("string", "app_name", "AI Sessions bench")
|
||||||
|
buildConfigField("boolean", "FIXTURE_MODE", "true")
|
||||||
|
if (keystore != null) signingConfig = signingConfigs.getByName("release")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sourceSets {
|
||||||
|
// The fixture both bench builds (this one and iris's) open with; see
|
||||||
|
// app/bench-fixture/README.md. Read directly from its own directory rather than copied
|
||||||
|
// into androidApp/src -- one file to keep in sync with the generator, not two.
|
||||||
|
getByName("bench").assets.directories.add("../bench-fixture/assets")
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility = JavaVersion.VERSION_21
|
sourceCompatibility = JavaVersion.VERSION_21
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
the fix is a judgement about how this app should look. Drop this
|
the fix is a judgement about how this app should look. Drop this
|
||||||
suppression when a real icon lands. -->
|
suppression when a real icon lands. -->
|
||||||
<application
|
<application
|
||||||
android:label="AI Sessions"
|
android:label="@string/app_name"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:theme="@android:style/Theme.Material.Light.NoActionBar"
|
android:theme="@android:style/Theme.Material.Light.NoActionBar"
|
||||||
tools:ignore="MissingApplicationIcon">
|
tools:ignore="MissingApplicationIcon">
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<!-- Overridden by the `bench` build type's resValue (build.gradle.kts) to "AI Sessions bench",
|
||||||
|
so the two are never mistaken for each other in the launcher or in Settings. -->
|
||||||
|
<string name="app_name">AI Sessions</string>
|
||||||
|
</resources>
|
||||||
+9
-3
@@ -4,6 +4,11 @@
|
|||||||
# ./build-apk.sh the release build, signed (what the phone runs)
|
# ./build-apk.sh the release build, signed (what the phone runs)
|
||||||
# ./build-apk.sh debug the debug build, for reproducing something the
|
# ./build-apk.sh debug the debug build, for reproducing something the
|
||||||
# emulator scripts would build anyway
|
# emulator scripts would build anyway
|
||||||
|
# ./build-apk.sh bench P0's benchmark build (own app id, "AI Sessions
|
||||||
|
# bench" label, opens straight onto the fixture
|
||||||
|
# session -- see docs/RUST.md's P0 box and
|
||||||
|
# app/bench-fixture/README.md). Signed the same
|
||||||
|
# as release; never touches the CA it pins.
|
||||||
#
|
#
|
||||||
# Dev Updater's `.dev-updater.ron` at the checkout root spells these out as
|
# Dev Updater's `.dev-updater.ron` at the checkout root spells these out as
|
||||||
# build modes, one command line each; it passes nothing else, so the word
|
# build modes, one command line each; it passes nothing else, so the word
|
||||||
@@ -25,8 +30,9 @@ VARIANT=${1:-release}
|
|||||||
case "$VARIANT" in
|
case "$VARIANT" in
|
||||||
release) TASK=assembleRelease ;;
|
release) TASK=assembleRelease ;;
|
||||||
debug) TASK=assembleDebug ;;
|
debug) TASK=assembleDebug ;;
|
||||||
|
bench) TASK=assembleBench ;;
|
||||||
*)
|
*)
|
||||||
echo "build-apk.sh: unknown variant '$VARIANT' (release, debug)" >&2
|
echo "build-apk.sh: unknown variant '$VARIANT' (release, debug, bench)" >&2
|
||||||
exit 2
|
exit 2
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -81,7 +87,7 @@ fi
|
|||||||
# uninstalling it first: the signatures differ, and Android refuses to
|
# uninstalling it first: the signatures differ, and Android refuses to
|
||||||
# update across them.
|
# update across them.
|
||||||
KEYSTORE="${AI_APP_KEYSTORE:-${XDG_CONFIG_HOME:-$HOME/.config}/ai-app/release.jks}"
|
KEYSTORE="${AI_APP_KEYSTORE:-${XDG_CONFIG_HOME:-$HOME/.config}/ai-app/release.jks}"
|
||||||
if [ "$VARIANT" = release ] && [ ! -f "$KEYSTORE" ]; then
|
if { [ "$VARIANT" = release ] || [ "$VARIANT" = bench ]; } && [ ! -f "$KEYSTORE" ]; then
|
||||||
KEYTOOL="${JAVA_HOME:+$JAVA_HOME/bin/keytool}"
|
KEYTOOL="${JAVA_HOME:+$JAVA_HOME/bin/keytool}"
|
||||||
KEYTOOL="${KEYTOOL:-keytool}"
|
KEYTOOL="${KEYTOOL:-keytool}"
|
||||||
if ! command -v "$KEYTOOL" >/dev/null 2>&1; then
|
if ! command -v "$KEYTOOL" >/dev/null 2>&1; then
|
||||||
@@ -97,7 +103,7 @@ if [ "$VARIANT" = release ] && [ ! -f "$KEYSTORE" ]; then
|
|||||||
-keyalg RSA -keysize 2048 -validity 10000 \
|
-keyalg RSA -keysize 2048 -validity 10000 \
|
||||||
-storepass "$PASSWORD" -keypass "$PASSWORD" -dname "CN=ai-app" >/dev/null 2>&1)
|
-storepass "$PASSWORD" -keypass "$PASSWORD" -dname "CN=ai-app" >/dev/null 2>&1)
|
||||||
fi
|
fi
|
||||||
if [ "$VARIANT" = release ]; then
|
if [ "$VARIANT" = release ] || [ "$VARIANT" = bench ]; then
|
||||||
AI_APP_KEYSTORE="$KEYSTORE"
|
AI_APP_KEYSTORE="$KEYSTORE"
|
||||||
AI_APP_KEYSTORE_PASSWORD=$(cat "$KEYSTORE.password")
|
AI_APP_KEYSTORE_PASSWORD=$(cat "$KEYSTORE.password")
|
||||||
export AI_APP_KEYSTORE AI_APP_KEYSTORE_PASSWORD
|
export AI_APP_KEYSTORE AI_APP_KEYSTORE_PASSWORD
|
||||||
|
|||||||
Reference in new issue
Block a user