From 5bbac2ccee2257710cbbf0d1b08e5ebd1900cd51 Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Mon, 14 Oct 2019 13:31:13 +0200 Subject: [PATCH 1/2] macos execution bugfix --- src/main/kotlin/StringCare.kt | 20 ++++++++++++++------ src/main/kotlin/components/Extensions.kt | 8 ++++---- src/main/kotlin/components/Fingerprint.kt | 8 +++++++- src/main/kotlin/components/PrintUtils.kt | 2 +- src/main/kotlin/components/Vars.kt | 2 +- 5 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/main/kotlin/StringCare.kt b/src/main/kotlin/StringCare.kt index 403ef5b..1e2e950 100644 --- a/src/main/kotlin/StringCare.kt +++ b/src/main/kotlin/StringCare.kt @@ -82,9 +82,6 @@ open class StringCare : Plugin { }, mergeResourcesStart = { module, variant -> fingerPrint(variantMap, module, variant, extension.debug) { key -> - if ("none" == key) { - return@fingerPrint - } when { moduleMap.containsKey(module) -> { val variantOrFlavor = extension.variants.find { @@ -95,6 +92,11 @@ open class StringCare : Plugin { return@fingerPrint } + if ("none" == key || key.trim().isEmpty()) { + PrintUtils.print("No SHA1 key found for :$module:$variant") + return@fingerPrint + } + PrintUtils.print(module, "$variant:$key") PrintUtils.print(module, backupStringRes) moduleMap[module]?.let { configuration -> @@ -116,6 +118,10 @@ open class StringCare : Plugin { val defaultConfiguration = defaultConfig().apply { name = module } + if ("none" == key || key.trim().isEmpty()) { + PrintUtils.print("No SHA1 key found for :$module:$variant") + return@fingerPrint + } PrintUtils.print(module, "$variant:$key") PrintUtils.print(module, backupStringRes) backupResourceFiles(absoluteProjectPath, defaultConfiguration) @@ -141,9 +147,6 @@ open class StringCare : Plugin { }, mergeAssetsStart = { module, variant -> fingerPrint(variantMap, module, variant, extension.debug) { key -> - if ("none" == key) { - return@fingerPrint - } when { moduleMap.containsKey(module) -> { val variantOrFlavor = extension.variants.find { @@ -154,6 +157,11 @@ open class StringCare : Plugin { return@fingerPrint } + if ("none" == key || key.trim().isEmpty()) { + PrintUtils.print("No SHA1 key found for :$module:$variant") + return@fingerPrint + } + PrintUtils.print(module, "$variant:$key") PrintUtils.print(module, backupAssets) moduleMap[module]?.let { configuration -> diff --git a/src/main/kotlin/components/Extensions.kt b/src/main/kotlin/components/Extensions.kt index 33efaa6..835c870 100644 --- a/src/main/kotlin/components/Extensions.kt +++ b/src/main/kotlin/components/Extensions.kt @@ -107,8 +107,8 @@ fun File.validForXMLConfiguration(configuration: Configuration): Boolean { } } } - if (configuration.debug && excludedForXML().not()) { - println("${if (valid) "✔ " else "❌ not"} valid file ${this.absolutePath}") + if (configuration.debug && excludedForXML().not() && valid) { + println("✔ valid file ${this.absolutePath}") } return valid } @@ -131,8 +131,8 @@ fun File.validForAssetsConfiguration(configuration: Configuration): Boolean { } } } - if (configuration.debug && excludedForAssets().not()) { - println("${if (valid) "✔ " else "❌ not"} valid file ${this.absolutePath}") + if (configuration.debug && excludedForAssets().not() && valid) { + println("✔ valid file ${this.absolutePath}") } return valid } diff --git a/src/main/kotlin/components/Fingerprint.kt b/src/main/kotlin/components/Fingerprint.kt index c8f86e3..a01018e 100644 --- a/src/main/kotlin/components/Fingerprint.kt +++ b/src/main/kotlin/components/Fingerprint.kt @@ -75,7 +75,13 @@ private class Fingerprint { /** * Gets the signing report trace and extracts the fingerprint */ -fun fingerPrint(variantMap: MutableMap, module: String, variant: String, debug: Boolean, keyFound: (key: String) -> Unit) { +fun fingerPrint( + variantMap: MutableMap, + module: String, + variant: String, + debug: Boolean, + keyFound: (key: String) -> Unit +) { if (variantMap.containsKey(variant)) { if (variantMap[variant]!!.mockedFingerprint.isNotEmpty()) { keyFound(variantMap[variant]!!.mockedFingerprint) diff --git a/src/main/kotlin/components/PrintUtils.kt b/src/main/kotlin/components/PrintUtils.kt index 16080f6..3b16bf5 100644 --- a/src/main/kotlin/components/PrintUtils.kt +++ b/src/main/kotlin/components/PrintUtils.kt @@ -16,7 +16,7 @@ class PrintUtils { } private fun _print(value: String) { - logger.info(value) + println(value) } fun print(message: String, tab: Boolean = false) { diff --git a/src/main/kotlin/components/Vars.kt b/src/main/kotlin/components/Vars.kt index 8e6fea5..b332141 100644 --- a/src/main/kotlin/components/Vars.kt +++ b/src/main/kotlin/components/Vars.kt @@ -13,7 +13,7 @@ internal const val gradleTaskNameObfuscate = "stringcareTestObfuscate" internal const val extensionName = "stringcare" internal const val winLib = "libsignKey.dll" internal const val osxLib = "libsignKey.dylib" -internal const val wrapperOsX = "./gradlew" +internal const val wrapperOsX = "sh gradlew" internal const val wrapperWindows = "gradlew.bat" internal const val copyCommandOsX = "cp" internal const val copyCommandWindows = "copy" From 5edf8b4f2adaea523a5eaa0c22aca824a50118d9 Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Mon, 14 Oct 2019 13:43:10 +0200 Subject: [PATCH 2/2] v3.6 --- build.gradle | 2 +- src/main/kotlin/components/Vars.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 4e6fc69..46491de 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ plugins { } group 'com.stringcare' -version '3.5' +version '3.6' def siteUrl = 'https://github.com/StringCare/KotlinGradlePlugin' def gitUrl = 'https://github.com/StringCare/KotlinGradlePlugin.git' diff --git a/src/main/kotlin/components/Vars.kt b/src/main/kotlin/components/Vars.kt index b332141..3a7a85a 100644 --- a/src/main/kotlin/components/Vars.kt +++ b/src/main/kotlin/components/Vars.kt @@ -2,7 +2,7 @@ package components import java.io.File -internal const val version = "3.5" +internal const val version = "3.6" internal const val testProjectName = "KotlinSample" internal const val defaultDebug = false internal const val defaultMainModule = "app"