From c095427835169778860362089a2b373e94b2dab7 Mon Sep 17 00:00:00 2001 From: ThomasSession Date: Mon, 7 Oct 2024 11:59:57 +1100 Subject: [PATCH] Build process update Cleaned up the variant outputs for the huawei build Added local signing configs Made sure the output names were formatted properly --- app/build.gradle | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 32b75caf37..7ecb6e45f5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -56,7 +56,7 @@ android { splits { abi { - enable true + enable !project.hasProperty('huawei') // huawei builds do not need the split variants reset() include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' universalApk true @@ -118,6 +118,25 @@ android { } } + signingConfigs { + play { + if (project.hasProperty('SESSION_STORE_FILE')) { + storeFile file(SESSION_STORE_FILE) + storePassword SESSION_STORE_PASSWORD + keyAlias SESSION_KEY_ALIAS + keyPassword SESSION_KEY_PASSWORD + } + } + huawei { + if (project.hasProperty('SESSION_HUAWEI_STORE_FILE')) { + storeFile file(SESSION_HUAWEI_STORE_FILE) + storePassword SESSION_HUAWEI_STORE_PASSWORD + keyAlias SESSION_HUAWEI_KEY_ALIAS + keyPassword SESSION_HUAWEI_KEY_PASSWORD + } + } + } + flavorDimensions "distribution" productFlavors { play { @@ -129,6 +148,7 @@ android { buildConfigField "org.session.libsession.utilities.Device", "DEVICE", "org.session.libsession.utilities.Device.ANDROID" buildConfigField "String", "NOPLAY_UPDATE_URL", "$ext.websiteUpdateUrl" buildConfigField 'String', 'PUSH_KEY_SUFFIX', '\"\"' + signingConfig signingConfigs.play } huawei { @@ -138,6 +158,7 @@ android { buildConfigField "org.session.libsession.utilities.Device", "DEVICE", "org.session.libsession.utilities.Device.HUAWEI" buildConfigField "String", "NOPLAY_UPDATE_URL", "$ext.websiteUpdateUrl" buildConfigField 'String', 'PUSH_KEY_SUFFIX', '\"_HUAWEI\"' + signingConfig signingConfigs.huawei } website { @@ -150,13 +171,15 @@ android { } } - applicationVariants.forEach { variant -> + applicationVariants.configureEach { variant -> variant.outputs.each { output -> def abiName = output.getFilter("ABI") ?: 'universal' def postFix = abiPostFix.get(abiName, 0) + def flavour = (variant.flavorName == 'huawei') ? "-huawei" : "" + if (postFix >= postFixSize) throw new AssertionError("postFix is too large") - output.outputFileName = output.outputFileName = "session-${variant.versionName}-${abiName}.apk" + output.outputFileName = output.outputFileName = "session-${variant.versionName}-${abiName}${flavour}.apk" output.versionCodeOverride = canonicalVersionCode * postFixSize + postFix } }