summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
authorKalle Lindström <karl.lindstrom@mullvad.net>2025-07-29 15:33:40 +0200
committerKalle Lindström <karl.lindstrom@mullvad.net>2025-07-29 15:33:40 +0200
commit93d42e2e3d688e19bb16c41ddc0a9aa119a80903 (patch)
tree42af0030bd705dc250cb4392ba659290ca974a30 /android
parent7ba43bff99c41a31e9369bc66fe9f8f0492816ad (diff)
parenta794233ae26fc6622c5edad06938d5b88a84ec42 (diff)
downloadmullvadvpn-93d42e2e3d688e19bb16c41ddc0a9aa119a80903.tar.xz
mullvadvpn-93d42e2e3d688e19bb16c41ddc0a9aa119a80903.zip
Merge branch 'add-release-debuginfo-configuration'
Diffstat (limited to 'android')
-rw-r--r--android/app/build.gradle.kts23
-rw-r--r--android/gradle.properties6
2 files changed, 22 insertions, 7 deletions
diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts
index 63c2e477ff..470f23cd97 100644
--- a/android/app/build.gradle.kts
+++ b/android/app/build.gradle.kts
@@ -86,11 +86,6 @@ android {
"proguard-rules.pro",
)
}
- getByName(BuildTypes.DEBUG) {
- if (getBooleanProperty("mullvad.app.build.keepDebugSymbols")) {
- packaging { jniLibs.keepDebugSymbols.add("**/*.so") }
- }
- }
create(BuildTypes.FDROID) {
initWith(buildTypes.getByName(BuildTypes.RELEASE))
signingConfig = null
@@ -164,6 +159,9 @@ android {
}
packaging {
+ if (getBooleanProperty("mullvad.app.build.keepDebugSymbols")) {
+ jniLibs.keepDebugSymbols.add("**/*.so")
+ }
jniLibs.useLegacyPackaging = true
resources {
pickFirsts +=
@@ -248,6 +246,8 @@ junitPlatform {
cargo {
val isReleaseBuild = isReleaseBuild()
+ val generateDebugSymbolsForReleaseBuilds =
+ getBooleanProperty("mullvad.app.build.cargo.generateDebugSymbolsForReleaseBuilds")
val enableBoringTun = getBooleanProperty("mullvad.app.build.boringtun.enable")
val enableApiOverride = !isReleaseBuild || isDevBuild() || isAlphaBuild()
module = repoRootPath
@@ -257,7 +257,7 @@ cargo {
targets = getStringListProperty("mullvad.app.build.cargo.targets")
profile =
if (isReleaseBuild) {
- "release"
+ if (generateDebugSymbolsForReleaseBuilds) "release-debuginfo" else "release"
} else {
"debug"
}
@@ -280,6 +280,17 @@ cargo {
add("--locked")
}
exec = { spec, _ ->
+ // Due to a limitation/bug in rust-android-gradle the profile given to cargo is either
+ // empty (in the default debug case) or specified as `--{profile}` (in the release case).
+ // However, this breaks when custom profiles are used so we need to fix the broken arg here
+ // to use the correct `--profile={CUSTOM_PROFILE}` syntax.
+ spec.commandLine =
+ spec.commandLine.map {
+ if (it == "--release-debuginfo") "--profile=release-debuginfo" else it
+ }
+
+ println("Executing Cargo: ${spec.commandLine.joinToString(" ")}")
+
if (getBooleanProperty("mullvad.app.build.replaceRustPathPrefix"))
spec.environment("RUSTFLAGS", generateRemapArguments())
}
diff --git a/android/gradle.properties b/android/gradle.properties
index 8ea46b2cab..2f55e4e852 100644
--- a/android/gradle.properties
+++ b/android/gradle.properties
@@ -29,9 +29,13 @@ mullvad.app.build.cargo.targets=arm,arm64,x86,x86_64
# Perform a clean the cargo before each build
mullvad.app.build.cargo.cleanBuild=true
-# Keep debug symbols in debug builds, this will cause the debug artifacts
+# If true, debug symbols are generated for release builds and not just debug builds.
+mullvad.app.build.cargo.generateDebugSymbolsForReleaseBuilds=false
+
+# Keep debug symbols if they exist. This will cause the artifacts
# to be substantially larger.
mullvad.app.build.keepDebugSymbols=false
+
# Replace source file path prefixes in the Rust build artifacts with fixed values.
# This must be set to true for the app build to be reprodcible, but should be set to false
# when debugging to the Rust native libs from Android Studio.