Skip to content

Commit

Permalink
Merge pull request #6 from StringCare/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
efraespada authored Oct 9, 2019
2 parents 57c0428 + bdf07dd commit 7a1ae4f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 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.4'
version '3.5'

def siteUrl = 'https://github.com/StringCare/KotlinGradlePlugin'
def gitUrl = 'https://github.com/StringCare/KotlinGradlePlugin.git'
Expand Down
15 changes: 13 additions & 2 deletions src/main/kotlin/StringCare.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ open class StringCare : Plugin<Project> {
@JvmStatic
internal val moduleMap: MutableMap<String, Configuration> = mutableMapOf()

@JvmStatic
internal val variantMap: MutableMap<String, VariantApplicationId> = mutableMapOf()

@JvmStatic
internal var mainModule: String = defaultMainModule

Expand Down Expand Up @@ -63,6 +66,13 @@ open class StringCare : Plugin<Project> {
moduleMap[module.name]!!.stringFiles.addAll(defaultConfig().stringFiles)
}
}
extension.variants.forEach { variant ->
variantMap[variant.name] = VariantApplicationId(variant.name).apply {
applicationId = variant.applicationId
mockedFingerprint = variant.mockedFingerprint
skip = variant.skip
}
}
this.project.registerTask()
}
this.project.gradle.addBuildListener(ExecutionListener(
Expand All @@ -71,7 +81,7 @@ open class StringCare : Plugin<Project> {
// nothing to do here
},
mergeResourcesStart = { module, variant ->
fingerPrint(module, variant, extension.debug) { key ->
fingerPrint(variantMap, module, variant, extension.debug) { key ->
if ("none" == key) {
return@fingerPrint
}
Expand Down Expand Up @@ -130,7 +140,7 @@ open class StringCare : Plugin<Project> {
restoreResourceFiles(absoluteProjectPath, module)
},
mergeAssetsStart = { module, variant ->
fingerPrint(module, variant, extension.debug) { key ->
fingerPrint(variantMap, module, variant, extension.debug) { key ->
if ("none" == key) {
return@fingerPrint
}
Expand Down Expand Up @@ -213,6 +223,7 @@ open class StringCare : Plugin<Project> {

open class VariantApplicationId(var name: String) {
var applicationId = ""
var mockedFingerprint = ""
var skip = false
}

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(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)
return
}
}
signingReportTask().runCommand { _, report ->
keyFound(report.extractFingerprint(module, variant, debug))
}
Expand Down
2 changes: 1 addition & 1 deletion 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.3"
internal const val version = "3.5"
internal const val testProjectName = "KotlinSample"
internal const val defaultDebug = false
internal const val defaultMainModule = "app"
Expand Down
Binary file modified src/main/kotlin/components/jni/libsignKey.dylib
Binary file not shown.

0 comments on commit 7a1ae4f

Please sign in to comment.