From 2d7c1da74142424fca96f80cb2b37a5e12712f9c Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Thu, 6 Sep 2018 14:25:35 -0400 Subject: [PATCH] Better support for external config file --- app/build.gradle | 3 ++- build.py | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 41bdb66db..1a747b4fb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,7 +1,8 @@ apply plugin: 'com.android.application' def configProps = new Properties() -configProps.load(new FileInputStream(rootProject.file('config.prop'))) +def configPath = project.hasProperty('configPath') ? project.configPath : rootProject.file('config.prop') +configProps.load(new FileInputStream(configPath)) android { compileSdkVersion rootProject.ext.compileSdkVersion diff --git a/build.py b/build.py index 4b33c310e..b106f0cb8 100755 --- a/build.py +++ b/build.py @@ -226,7 +226,7 @@ def build_apk(args, flavor): buildType = 'Release' if args.release else 'Debug' - proc = execv([gradlew, 'app:assemble' + flavor + buildType]) + proc = execv([gradlew, 'app:assemble' + flavor + buildType, '-PconfigPath=' + os.path.abspath(args.config)]) if proc.returncode != 0: error('Build Magisk Manager failed!') @@ -322,7 +322,7 @@ def zip_main(args): # End of zipping - output = os.path.join(config['outdir'], 'Magisk-v{}.zip'.format(config['version']) if config['prettyName'] else + output = os.path.join(config['outdir'], 'Magisk-v{}.zip'.format(config['version']) if config['prettyName'] else 'magisk-release.zip' if args.release else 'magisk-debug.zip') sign_zip(unsigned, output, args.release) header('Output: ' + output) @@ -366,7 +366,7 @@ def zip_uninstaller(args): # End of zipping - output = os.path.join(config['outdir'], 'Magisk-uninstaller-{}.zip'.format(datetime.datetime.now().strftime('%Y%m%d')) + output = os.path.join(config['outdir'], 'Magisk-uninstaller-{}.zip'.format(datetime.datetime.now().strftime('%Y%m%d')) if config['prettyName'] else 'magisk-uninstaller.zip') sign_zip(unsigned, output, args.release) header('Output: ' + output)