From 0b4dd63d360a3f5d3e67489fda33d4adf55627ef Mon Sep 17 00:00:00 2001 From: vvb2060 Date: Sun, 6 Dec 2020 06:30:45 +0800 Subject: [PATCH] Stub module always use release build --- build.gradle.kts | 12 ++++++------ build.py | 6 ++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 5d8e668dc..b500ca833 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,7 +19,7 @@ buildscript { dependencies { classpath("com.android.tools.build:gradle:4.1.1") - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.20") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21") classpath("androidx.navigation:navigation-safe-args-gradle-plugin:${vNav}") // NOTE: Do not place your application dependencies here; they belong @@ -27,7 +27,7 @@ buildscript { } } -tasks.register("clean",Delete::class){ +tasks.register("clean", Delete::class) { delete(rootProject.buildDir) } @@ -110,12 +110,12 @@ subprojects { buildTypes { signingConfigs.getByName("config").also { getByName("debug") { - // If keystore exists, sign the APK with custom signature - if (it.storeFile?.exists() == true) - signingConfig = it + signingConfig = if (it.storeFile?.exists() == true) it + else signingConfigs.getByName("debug") } getByName("release") { - signingConfig = it + signingConfig = if (it.storeFile?.exists() == true) it + else signingConfigs.getByName("debug") } } } diff --git a/build.py b/build.py index aaf3f9c20..6bbae2e1d 100755 --- a/build.py +++ b/build.py @@ -274,9 +274,7 @@ def dump_bin_headers(): binary_dump(src, out, 'magisk_xz') stub = op.join(config['outdir'], 'stub-release.apk') if not op.exists(stub): - stub = op.join(config['outdir'], 'stub-debug.apk') - if not op.exists(stub): - error('Build stub APK before building "magiskinit"') + error('Build stub APK before building "magiskinit"') with open(op.join('native', 'out', 'binaries.h'), 'w') as out: with open(stub, 'rb') as src: binary_dump(src, out, 'manager_xz') @@ -334,7 +332,7 @@ def build_binary(args): def build_apk(args, module): - build_type = 'Release' if args.release else 'Debug' + build_type = 'Release' if args.release or module == 'stub' else 'Debug' proc = execv([gradlew, f'{module}:assemble{build_type}', '-PconfigPath=' + op.abspath(args.config)])