From f13863a800318cf92c26d03ae812babfa1c6de57 Mon Sep 17 00:00:00 2001 From: ale5000 <15793015+ale5000-git@users.noreply.github.com> Date: Sat, 2 Sep 2023 15:21:06 +0200 Subject: [PATCH] Minor changes --- build.gradle | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index c80c026d..cbd0af87 100644 --- a/build.gradle +++ b/build.gradle @@ -16,13 +16,12 @@ plugins { /* ===FUNCTIONS=== */ private void initialize() { - println name + Properties props = new Properties() - project.buildDir = "${project.projectDir}/output" defaultTasks 'tasks' - Properties props = new Properties() - file("${project.projectDir}/zip-content/module.prop").withInputStream { props.load(it) } + project.buildDir = project.file("output") + project.file('zip-content/module.prop').withInputStream { props.load(it) } description = String.valueOf(props.getProperty('description')) version = String.valueOf(props.getProperty('version')).toLowerCase(Locale.ENGLISH).trim() @@ -32,6 +31,7 @@ private void initialize() { //ext.isAlpha = version.endsWith('-alpha') //ext.isSnapshot = version.endsWith('-snapshot') + println name println 'Version: ' + version println 'OS: ' + System.properties['os.name'] @@ -49,6 +49,39 @@ private String getOurArchivesBaseName() return "${val}" } +private void configureSigning(def android, File keystorePropsFile) +{ + if(!keystorePropsFile.exists()) return + if(android == null) throw new GradleException('android is null inside configureSigning()') + + println 'Signed build' + + Properties keystoreProps = new Properties() + keystoreProps.load(new FileInputStream(keystorePropsFile)) + + String keyStorePassword + boolean fallbackToEnv = keystoreProps.containsKey('fallbackToEnv') && keystoreProps['fallbackToEnv'] == 'true' + + if(keystoreProps.containsKey('keyStorePassword')) + keyStorePassword = keystoreProps['keyStorePassword'] + else if(fallbackToEnv) + keyStorePassword = System.getenv('KEYSTORE_PASSWORD') + + if(keyStorePassword == null || keyStorePassword.isEmpty()) + throw new InvalidUserDataException('Keystore password is empty') + + android.signingConfigs { + config { + storeFile = rootProject.file(keystoreProps['storeFile']) + storePassword = keyStorePassword + keyAlias = keystoreProps['keyAlias'] + keyPassword = keyStorePassword + } + } + + android.buildTypes.release.signingConfig android.signingConfigs.config +} + initialize() /* ===BLOCKS=== */