From b7d4ab93e93f397e619711990351ea741f925038 Mon Sep 17 00:00:00 2001 From: Benjamin AIMONE Date: Thu, 23 Sep 2021 14:52:25 +0200 Subject: [PATCH] Update detekt and publish plugin, fix build on Mac M1 --- CHANGELOG.md | 5 +++++ build.gradle.kts | 15 +++++++++++---- config/detekt/detekt.yml | 1 + gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle.kts | 2 +- .../klaxit/hiddensecrets/HiddenSecretsPlugin.kt | 2 +- src/test/kotlin/CommandNamesTest.kt | 2 +- src/test/kotlin/HiddenSecretsTest.kt | 5 +++-- src/test/kotlin/UtilsTest.kt | 2 +- 9 files changed, 25 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4f66f4..03834e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# v0.1.3 +### Fixes +* Fix build on Mac with M1 chip +### Improvements +* Update Gradle, Detekt, and Kotest # v0.1.2 ### Fixes * Fix call to `customDecode()` in C++ code diff --git a/build.gradle.kts b/build.gradle.kts index 96be158..8b8311f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,6 @@ plugins { - id("com.gradle.plugin-publish") version "0.14.0" - id("io.gitlab.arturbosch.detekt") version "1.16.0" + id("com.gradle.plugin-publish") version "0.16.0" + id("io.gitlab.arturbosch.detekt") version "1.18.1" `kotlin-dsl` `maven-publish` } @@ -14,8 +14,8 @@ repositories { dependencies { implementation("com.android.tools.build:gradle:4.1.3") - testImplementation("io.kotest:kotest-runner-junit5-jvm:4.4.3") - testImplementation("io.kotest:kotest-assertions-core-jvm:4.4.3") + testImplementation("io.kotest:kotest-runner-junit5-jvm:4.6.3") + testImplementation("io.kotest:kotest-assertions-core-jvm:4.6.3") testImplementation("junit:junit:4.13.2") } @@ -43,6 +43,13 @@ gradlePlugin { } } +detekt { + reports { + xml.enabled = false + sarif.enabled = false + } +} + tasks.withType { //Required by Gradle 7.0 duplicatesStrategy = DuplicatesStrategy.INCLUDE diff --git a/config/detekt/detekt.yml b/config/detekt/detekt.yml index 09e9a8c..d70a9c4 100644 --- a/config/detekt/detekt.yml +++ b/config/detekt/detekt.yml @@ -584,6 +584,7 @@ style: excludePackageStatements: true excludeImportStatements: true excludeCommentStatements: false + excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**' ] MayBeConst: active: true ModifierOrder: diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 442d913..0f80bbf 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle.kts b/settings.gradle.kts index 6d2acaa..ef1176c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,5 +2,5 @@ rootProject.name = "HiddenSecretsPlugin" gradle.allprojects { group = "com.klaxit.hiddensecrets" - version = "0.1.2" + version = "0.1.3" } diff --git a/src/main/kotlin/com/klaxit/hiddensecrets/HiddenSecretsPlugin.kt b/src/main/kotlin/com/klaxit/hiddensecrets/HiddenSecretsPlugin.kt index 16e8072..fc5d7c8 100644 --- a/src/main/kotlin/com/klaxit/hiddensecrets/HiddenSecretsPlugin.kt +++ b/src/main/kotlin/com/klaxit/hiddensecrets/HiddenSecretsPlugin.kt @@ -171,7 +171,7 @@ open class HiddenSecretsPlugin : Plugin { * Copy Kotlin file Secrets.kt from the lib to the Android project if it does not exist yet */ fun copyKotlinFile() { - if (getKotlinFile() != null) { + getKotlinFile()?.let { println("$KOTLIN_FILE_NAME already exists") return } diff --git a/src/test/kotlin/CommandNamesTest.kt b/src/test/kotlin/CommandNamesTest.kt index 22b5707..27dd1e0 100644 --- a/src/test/kotlin/CommandNamesTest.kt +++ b/src/test/kotlin/CommandNamesTest.kt @@ -13,4 +13,4 @@ class CommandNamesTest : StringSpec({ HiddenSecretsPlugin.TASK_OBFUSCATE shouldBe "obfuscate" HiddenSecretsPlugin.TASK_PACKAGE_NAME shouldBe "packageName" HiddenSecretsPlugin.TASK_FIND_KOTLIN_FILE shouldBe "findKotlinFile" -}) \ No newline at end of file +}) diff --git a/src/test/kotlin/HiddenSecretsTest.kt b/src/test/kotlin/HiddenSecretsTest.kt index cb71ffe..9cff916 100644 --- a/src/test/kotlin/HiddenSecretsTest.kt +++ b/src/test/kotlin/HiddenSecretsTest.kt @@ -44,7 +44,8 @@ class HiddenSecretsTest : WordSpec({ "Make command ${HiddenSecretsPlugin.TASK_OBFUSCATE} succeed" { val result = gradleRunner.withArguments(HiddenSecretsPlugin.TASK_OBFUSCATE, "-Pkey=$key", "-Ppackage=$packageName").build() println(result.output) - result.output shouldContain "{ 0x15, 0x58, 0xb, 0x43, 0x78, 0x4a, 0x23, 0x6d, 0x1, 0x4b, 0x46, 0x7c, 0x57, 0x41 }" //obfuscated key + //Should contain obfuscated key + result.output shouldContain "{ 0x15, 0x58, 0xb, 0x43, 0x78, 0x4a, 0x23, 0x6d, 0x1, 0x4b, 0x46, 0x7c, 0x57, 0x41 }" } "Make command ${HiddenSecretsPlugin.TASK_PACKAGE_NAME} succeed" { @@ -58,4 +59,4 @@ class HiddenSecretsTest : WordSpec({ println(result.output) } } -}) \ No newline at end of file +}) diff --git a/src/test/kotlin/UtilsTest.kt b/src/test/kotlin/UtilsTest.kt index 2c3bf58..9c97dd6 100644 --- a/src/test/kotlin/UtilsTest.kt +++ b/src/test/kotlin/UtilsTest.kt @@ -64,4 +64,4 @@ class UtilsTest : WordSpec({ kotlinPackage shouldBe "com.test.object" } } -}) \ No newline at end of file +})