Skip to content

Commit

Permalink
Merge pull request #7 from StringCare/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
efraespada authored Oct 14, 2019
2 parents 7a1ae4f + 5edf8b4 commit ad74fe8
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 15 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
20 changes: 14 additions & 6 deletions src/main/kotlin/StringCare.kt
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ open class StringCare : Plugin<Project> {
},
mergeResourcesStart = { module, variant ->
fingerPrint(variantMap, module, variant, extension.debug) { key ->
if ("none" == key) {
return@fingerPrint
}
when {
moduleMap.containsKey(module) -> {
val variantOrFlavor = extension.variants.find {
Expand All @@ -95,6 +92,11 @@ open class StringCare : Plugin<Project> {
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 ->
Expand All @@ -116,6 +118,10 @@ open class StringCare : Plugin<Project> {
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)
Expand All @@ -141,9 +147,6 @@ open class StringCare : Plugin<Project> {
},
mergeAssetsStart = { module, variant ->
fingerPrint(variantMap, module, variant, extension.debug) { key ->
if ("none" == key) {
return@fingerPrint
}
when {
moduleMap.containsKey(module) -> {
val variantOrFlavor = extension.variants.find {
Expand All @@ -154,6 +157,11 @@ open class StringCare : Plugin<Project> {
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 ->
Expand Down
8 changes: 4 additions & 4 deletions src/main/kotlin/components/Extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
8 changes: 7 additions & 1 deletion src/main/kotlin/components/Fingerprint.kt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ private class Fingerprint {
/**
* Gets the signing report trace and extracts the fingerprint
*/
fun fingerPrint(variantMap: MutableMap<String, StringCare.VariantApplicationId>, module: String, variant: String, debug: Boolean, keyFound: (key: String) -> Unit) {
fun fingerPrint(
variantMap: MutableMap<String, StringCare.VariantApplicationId>,
module: String,
variant: String,
debug: Boolean,
keyFound: (key: String) -> Unit
) {
if (variantMap.containsKey(variant)) {
if (variantMap[variant]!!.mockedFingerprint.isNotEmpty()) {
keyFound(variantMap[variant]!!.mockedFingerprint)
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/components/PrintUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class PrintUtils {
}

private fun _print(value: String) {
logger.info(value)
println(value)
}

fun print(message: String, tab: Boolean = false) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/components/Vars.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down

0 comments on commit ad74fe8

Please sign in to comment.