From e568a0b0fca7dfdb273787a3094d29a613c2e257 Mon Sep 17 00:00:00 2001 From: GusWard Date: Fri, 25 Jun 2021 14:35:29 +0100 Subject: [PATCH 1/5] Added gradle config for detekt to both modules and made changes to allow build to pass when running ./gradlew detekt --- HeaderTestModule/build.gradle.kts | 20 +++++++++++++++++++ .../unidays/headertestmodule/HeaderBuilder.kt | 2 +- KMPExampleModule/build.gradle.kts | 19 ++++++++++++++++++ .../com/example/kmpexamplemodule/Platform.kt | 4 ++-- .../example/kmpexamplemodule/androidTest.kt | 2 +- .../com/example/kmpexamplemodule/Greeting.kt | 6 +++--- .../com/example/kmpexamplemodule/Platform.kt | 6 +++--- .../example/kmpexamplemodule/commonTest.kt | 2 +- .../com/example/kmpexamplemodule/Platform.kt | 2 +- .../com/example/kmpexamplemodule/iosTest.kt | 2 +- 10 files changed, 52 insertions(+), 13 deletions(-) diff --git a/HeaderTestModule/build.gradle.kts b/HeaderTestModule/build.gradle.kts index 5e805ed..532ae41 100644 --- a/HeaderTestModule/build.gradle.kts +++ b/HeaderTestModule/build.gradle.kts @@ -5,12 +5,32 @@ plugins { id("com.android.library") id("com.chromaticnoise.multiplatform-swiftpackage") version "2.0.3" id("kotlin-android-extensions") + id("io.gitlab.arturbosch.detekt") version "1.17.1" jacoco + } version = "0.0.1" group = "com.unidays.headertestmodule" +detekt { + buildUponDefaultConfig = true // preconfigure defaults + allRules = false // activate all available (even unstable) rules. + input = files("src/commonMain/kotlin") + + reports { + html.enabled = true + xml.enabled = true + txt.enabled = true + sarif.enabled = true + } +} + +tasks.withType().configureEach { + // Target version of the generated JVM bytecode. It is used for type resolution. + jvmTarget = "1.8" +} + jacoco { toolVersion = "0.8.6" } diff --git a/HeaderTestModule/src/commonMain/kotlin/com/unidays/headertestmodule/HeaderBuilder.kt b/HeaderTestModule/src/commonMain/kotlin/com/unidays/headertestmodule/HeaderBuilder.kt index 1a325c6..4792239 100644 --- a/HeaderTestModule/src/commonMain/kotlin/com/unidays/headertestmodule/HeaderBuilder.kt +++ b/HeaderTestModule/src/commonMain/kotlin/com/unidays/headertestmodule/HeaderBuilder.kt @@ -12,4 +12,4 @@ class HeaderBuilder { const val TEST_HEADER_ID = 1 const val SOME_OTHER_HEADER = "Some other shit" } -} \ No newline at end of file +} diff --git a/KMPExampleModule/build.gradle.kts b/KMPExampleModule/build.gradle.kts index 8c6c945..47dab2a 100644 --- a/KMPExampleModule/build.gradle.kts +++ b/KMPExampleModule/build.gradle.kts @@ -5,12 +5,31 @@ plugins { id("com.android.library") id("com.chromaticnoise.multiplatform-swiftpackage") version "2.0.3" id("kotlin-android-extensions") + id("io.gitlab.arturbosch.detekt") version "1.17.1" jacoco } version = "0.0.1" group = "com.example.kmpexamplemodule" +detekt { + buildUponDefaultConfig = true // preconfigure defaults + allRules = false // activate all available (even unstable) rules. + input = files("src/commonMain/kotlin") + + reports { + html.enabled = true + xml.enabled = true + txt.enabled = true + sarif.enabled = true + } +} + +tasks.withType().configureEach { + // Target version of the generated JVM bytecode. It is used for type resolution. + jvmTarget = "1.8" +} + jacoco { toolVersion = "0.8.6" } diff --git a/KMPExampleModule/src/androidMain/kotlin/com/example/kmpexamplemodule/Platform.kt b/KMPExampleModule/src/androidMain/kotlin/com/example/kmpexamplemodule/Platform.kt index 3874751..27f7784 100644 --- a/KMPExampleModule/src/androidMain/kotlin/com/example/kmpexamplemodule/Platform.kt +++ b/KMPExampleModule/src/androidMain/kotlin/com/example/kmpexamplemodule/Platform.kt @@ -1,5 +1,5 @@ package com.example.kmpexamplemodule -actual class Platform actual constructor() { - actual val platform: String = "Android ${android.os.Build.VERSION.SDK_INT}" +actual class Platform { + actual val name: String = "Android ${android.os.Build.VERSION.SDK_INT}" } \ No newline at end of file diff --git a/KMPExampleModule/src/androidTest/kotlin/com/example/kmpexamplemodule/androidTest.kt b/KMPExampleModule/src/androidTest/kotlin/com/example/kmpexamplemodule/androidTest.kt index cc39b00..8862c4b 100644 --- a/KMPExampleModule/src/androidTest/kotlin/com/example/kmpexamplemodule/androidTest.kt +++ b/KMPExampleModule/src/androidTest/kotlin/com/example/kmpexamplemodule/androidTest.kt @@ -7,6 +7,6 @@ class AndroidGreetingTest { @Test fun testExample() { - assertTrue("Check Android is mentioned", Greeting().greeting().contains("Android")) + assertTrue("Check Android is mentioned", Greeting().build().contains("Android")) } } \ No newline at end of file diff --git a/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Greeting.kt b/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Greeting.kt index e472e44..bbcc792 100644 --- a/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Greeting.kt +++ b/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Greeting.kt @@ -1,7 +1,7 @@ package com.example.kmpexamplemodule class Greeting { - fun greeting(): String { - return "Hello, ${Platform().platform}!" + fun build(): String { + return "Hello, ${Platform().name}!" } -} \ No newline at end of file +} diff --git a/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Platform.kt b/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Platform.kt index 0fb51f5..280bf1d 100644 --- a/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Platform.kt +++ b/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Platform.kt @@ -1,5 +1,5 @@ package com.example.kmpexamplemodule -expect class Platform() { - val platform: String -} \ No newline at end of file +expect class Platform { + val name: String +} diff --git a/KMPExampleModule/src/commonTest/kotlin/com/example/kmpexamplemodule/commonTest.kt b/KMPExampleModule/src/commonTest/kotlin/com/example/kmpexamplemodule/commonTest.kt index 28d6d5d..e46fed0 100644 --- a/KMPExampleModule/src/commonTest/kotlin/com/example/kmpexamplemodule/commonTest.kt +++ b/KMPExampleModule/src/commonTest/kotlin/com/example/kmpexamplemodule/commonTest.kt @@ -7,6 +7,6 @@ class CommonGreetingTest { @Test fun testExample() { - assertTrue(Greeting().greeting().contains("Hello"), "Check 'Hello' is mentioned") + assertTrue(Greeting().build().contains("Hello"), "Check 'Hello' is mentioned") } } \ No newline at end of file diff --git a/KMPExampleModule/src/iosMain/kotlin/com/example/kmpexamplemodule/Platform.kt b/KMPExampleModule/src/iosMain/kotlin/com/example/kmpexamplemodule/Platform.kt index ad1a8b3..f058291 100644 --- a/KMPExampleModule/src/iosMain/kotlin/com/example/kmpexamplemodule/Platform.kt +++ b/KMPExampleModule/src/iosMain/kotlin/com/example/kmpexamplemodule/Platform.kt @@ -3,5 +3,5 @@ package com.example.kmpexamplemodule import platform.UIKit.UIDevice actual class Platform actual constructor() { - actual val platform: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion + actual val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion } \ No newline at end of file diff --git a/KMPExampleModule/src/iosTest/kotlin/com/example/kmpexamplemodule/iosTest.kt b/KMPExampleModule/src/iosTest/kotlin/com/example/kmpexamplemodule/iosTest.kt index 37b2aaf..49c86ba 100644 --- a/KMPExampleModule/src/iosTest/kotlin/com/example/kmpexamplemodule/iosTest.kt +++ b/KMPExampleModule/src/iosTest/kotlin/com/example/kmpexamplemodule/iosTest.kt @@ -7,6 +7,6 @@ class IosGreetingTest { @Test fun testExample() { - assertTrue(Greeting().greeting().contains("iOS"), "Check iOS is mentioned") + assertTrue(Greeting().build().contains("iOS"), "Check iOS is mentioned") } } \ No newline at end of file From 70ba73d79601627c3d1b212a977b9cb8b57a6280 Mon Sep 17 00:00:00 2001 From: GusWard Date: Fri, 25 Jun 2021 14:37:15 +0100 Subject: [PATCH 2/5] disable autocorrect explicitly in config --- HeaderTestModule/build.gradle.kts | 1 + KMPExampleModule/build.gradle.kts | 1 + 2 files changed, 2 insertions(+) diff --git a/HeaderTestModule/build.gradle.kts b/HeaderTestModule/build.gradle.kts index 532ae41..ba955b8 100644 --- a/HeaderTestModule/build.gradle.kts +++ b/HeaderTestModule/build.gradle.kts @@ -17,6 +17,7 @@ detekt { buildUponDefaultConfig = true // preconfigure defaults allRules = false // activate all available (even unstable) rules. input = files("src/commonMain/kotlin") + autoCorrect = false reports { html.enabled = true diff --git a/KMPExampleModule/build.gradle.kts b/KMPExampleModule/build.gradle.kts index 47dab2a..e7e7fb9 100644 --- a/KMPExampleModule/build.gradle.kts +++ b/KMPExampleModule/build.gradle.kts @@ -16,6 +16,7 @@ detekt { buildUponDefaultConfig = true // preconfigure defaults allRules = false // activate all available (even unstable) rules. input = files("src/commonMain/kotlin") + autoCorrect = false reports { html.enabled = true From 42c8789e2d4234035c3e9f46ff22d13189a21734 Mon Sep 17 00:00:00 2001 From: GusWard Date: Mon, 28 Jun 2021 14:37:03 +0100 Subject: [PATCH 3/5] reverted kotlin files and commented out detekt plugin, testCoverage is working again --- HeaderTestModule/build.gradle.kts | 38 +++++++++---------- KMPExampleModule/build.gradle.kts | 38 +++++++++---------- .../com/example/kmpexamplemodule/Platform.kt | 4 +- .../example/kmpexamplemodule/androidTest.kt | 2 +- .../com/example/kmpexamplemodule/Greeting.kt | 4 +- .../com/example/kmpexamplemodule/Platform.kt | 4 +- .../example/kmpexamplemodule/commonTest.kt | 2 +- .../com/example/kmpexamplemodule/Platform.kt | 2 +- .../com/example/kmpexamplemodule/iosTest.kt | 2 +- 9 files changed, 48 insertions(+), 48 deletions(-) diff --git a/HeaderTestModule/build.gradle.kts b/HeaderTestModule/build.gradle.kts index ba955b8..468b69d 100644 --- a/HeaderTestModule/build.gradle.kts +++ b/HeaderTestModule/build.gradle.kts @@ -5,7 +5,7 @@ plugins { id("com.android.library") id("com.chromaticnoise.multiplatform-swiftpackage") version "2.0.3" id("kotlin-android-extensions") - id("io.gitlab.arturbosch.detekt") version "1.17.1" +// id("io.gitlab.arturbosch.detekt") version "1.17.1" jacoco } @@ -13,24 +13,24 @@ plugins { version = "0.0.1" group = "com.unidays.headertestmodule" -detekt { - buildUponDefaultConfig = true // preconfigure defaults - allRules = false // activate all available (even unstable) rules. - input = files("src/commonMain/kotlin") - autoCorrect = false - - reports { - html.enabled = true - xml.enabled = true - txt.enabled = true - sarif.enabled = true - } -} - -tasks.withType().configureEach { - // Target version of the generated JVM bytecode. It is used for type resolution. - jvmTarget = "1.8" -} +//detekt { +// buildUponDefaultConfig = true // preconfigure defaults +// allRules = false // activate all available (even unstable) rules. +// input = files("src/commonMain/kotlin") +// autoCorrect = false +// +// reports { +// html.enabled = true +// xml.enabled = true +// txt.enabled = true +// sarif.enabled = true +// } +//} +// +//tasks.withType().configureEach { +// // Target version of the generated JVM bytecode. It is used for type resolution. +// jvmTarget = "1.8" +//} jacoco { toolVersion = "0.8.6" diff --git a/KMPExampleModule/build.gradle.kts b/KMPExampleModule/build.gradle.kts index e7e7fb9..60d6ca2 100644 --- a/KMPExampleModule/build.gradle.kts +++ b/KMPExampleModule/build.gradle.kts @@ -5,31 +5,31 @@ plugins { id("com.android.library") id("com.chromaticnoise.multiplatform-swiftpackage") version "2.0.3" id("kotlin-android-extensions") - id("io.gitlab.arturbosch.detekt") version "1.17.1" +// id("io.gitlab.arturbosch.detekt") version "1.17.1" jacoco } version = "0.0.1" group = "com.example.kmpexamplemodule" -detekt { - buildUponDefaultConfig = true // preconfigure defaults - allRules = false // activate all available (even unstable) rules. - input = files("src/commonMain/kotlin") - autoCorrect = false - - reports { - html.enabled = true - xml.enabled = true - txt.enabled = true - sarif.enabled = true - } -} - -tasks.withType().configureEach { - // Target version of the generated JVM bytecode. It is used for type resolution. - jvmTarget = "1.8" -} +//detekt { +// buildUponDefaultConfig = true // preconfigure defaults +// allRules = false // activate all available (even unstable) rules. +// input = files("src/commonMain/kotlin") +// autoCorrect = false +// +// reports { +// html.enabled = true +// xml.enabled = true +// txt.enabled = true +// sarif.enabled = true +// } +//} +// +//tasks.withType().configureEach { +// // Target version of the generated JVM bytecode. It is used for type resolution. +// jvmTarget = "1.8" +//} jacoco { toolVersion = "0.8.6" diff --git a/KMPExampleModule/src/androidMain/kotlin/com/example/kmpexamplemodule/Platform.kt b/KMPExampleModule/src/androidMain/kotlin/com/example/kmpexamplemodule/Platform.kt index 27f7784..3874751 100644 --- a/KMPExampleModule/src/androidMain/kotlin/com/example/kmpexamplemodule/Platform.kt +++ b/KMPExampleModule/src/androidMain/kotlin/com/example/kmpexamplemodule/Platform.kt @@ -1,5 +1,5 @@ package com.example.kmpexamplemodule -actual class Platform { - actual val name: String = "Android ${android.os.Build.VERSION.SDK_INT}" +actual class Platform actual constructor() { + actual val platform: String = "Android ${android.os.Build.VERSION.SDK_INT}" } \ No newline at end of file diff --git a/KMPExampleModule/src/androidTest/kotlin/com/example/kmpexamplemodule/androidTest.kt b/KMPExampleModule/src/androidTest/kotlin/com/example/kmpexamplemodule/androidTest.kt index 8862c4b..cc39b00 100644 --- a/KMPExampleModule/src/androidTest/kotlin/com/example/kmpexamplemodule/androidTest.kt +++ b/KMPExampleModule/src/androidTest/kotlin/com/example/kmpexamplemodule/androidTest.kt @@ -7,6 +7,6 @@ class AndroidGreetingTest { @Test fun testExample() { - assertTrue("Check Android is mentioned", Greeting().build().contains("Android")) + assertTrue("Check Android is mentioned", Greeting().greeting().contains("Android")) } } \ No newline at end of file diff --git a/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Greeting.kt b/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Greeting.kt index bbcc792..4087ea5 100644 --- a/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Greeting.kt +++ b/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Greeting.kt @@ -1,7 +1,7 @@ package com.example.kmpexamplemodule class Greeting { - fun build(): String { - return "Hello, ${Platform().name}!" + fun greeting(): String { + return "Hello, ${Platform().platform}!" } } diff --git a/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Platform.kt b/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Platform.kt index 280bf1d..9a9cb50 100644 --- a/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Platform.kt +++ b/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Platform.kt @@ -1,5 +1,5 @@ package com.example.kmpexamplemodule -expect class Platform { - val name: String +expect class Platform() { + val platform: String } diff --git a/KMPExampleModule/src/commonTest/kotlin/com/example/kmpexamplemodule/commonTest.kt b/KMPExampleModule/src/commonTest/kotlin/com/example/kmpexamplemodule/commonTest.kt index e46fed0..28d6d5d 100644 --- a/KMPExampleModule/src/commonTest/kotlin/com/example/kmpexamplemodule/commonTest.kt +++ b/KMPExampleModule/src/commonTest/kotlin/com/example/kmpexamplemodule/commonTest.kt @@ -7,6 +7,6 @@ class CommonGreetingTest { @Test fun testExample() { - assertTrue(Greeting().build().contains("Hello"), "Check 'Hello' is mentioned") + assertTrue(Greeting().greeting().contains("Hello"), "Check 'Hello' is mentioned") } } \ No newline at end of file diff --git a/KMPExampleModule/src/iosMain/kotlin/com/example/kmpexamplemodule/Platform.kt b/KMPExampleModule/src/iosMain/kotlin/com/example/kmpexamplemodule/Platform.kt index f058291..ad1a8b3 100644 --- a/KMPExampleModule/src/iosMain/kotlin/com/example/kmpexamplemodule/Platform.kt +++ b/KMPExampleModule/src/iosMain/kotlin/com/example/kmpexamplemodule/Platform.kt @@ -3,5 +3,5 @@ package com.example.kmpexamplemodule import platform.UIKit.UIDevice actual class Platform actual constructor() { - actual val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion + actual val platform: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion } \ No newline at end of file diff --git a/KMPExampleModule/src/iosTest/kotlin/com/example/kmpexamplemodule/iosTest.kt b/KMPExampleModule/src/iosTest/kotlin/com/example/kmpexamplemodule/iosTest.kt index 49c86ba..37b2aaf 100644 --- a/KMPExampleModule/src/iosTest/kotlin/com/example/kmpexamplemodule/iosTest.kt +++ b/KMPExampleModule/src/iosTest/kotlin/com/example/kmpexamplemodule/iosTest.kt @@ -7,6 +7,6 @@ class IosGreetingTest { @Test fun testExample() { - assertTrue(Greeting().build().contains("iOS"), "Check iOS is mentioned") + assertTrue(Greeting().greeting().contains("iOS"), "Check iOS is mentioned") } } \ No newline at end of file From 80e33fe746e9088f6fcb402edc5f68b1e288e8e8 Mon Sep 17 00:00:00 2001 From: GusWard Date: Mon, 28 Jun 2021 15:49:23 +0100 Subject: [PATCH 4/5] Changed detekt version to 1.15.0 everything working again --- KMPExampleModule/build.gradle.kts | 37 +++++++++---------- .../com/example/kmpexamplemodule/Platform.kt | 2 +- .../example/kmpexamplemodule/androidTest.kt | 2 +- .../com/example/kmpexamplemodule/Greeting.kt | 4 +- .../com/example/kmpexamplemodule/Platform.kt | 5 ++- .../example/kmpexamplemodule/commonTest.kt | 2 +- .../com/example/kmpexamplemodule/Platform.kt | 2 +- .../com/example/kmpexamplemodule/iosTest.kt | 2 +- 8 files changed, 29 insertions(+), 27 deletions(-) diff --git a/KMPExampleModule/build.gradle.kts b/KMPExampleModule/build.gradle.kts index 60d6ca2..68f0798 100644 --- a/KMPExampleModule/build.gradle.kts +++ b/KMPExampleModule/build.gradle.kts @@ -5,31 +5,30 @@ plugins { id("com.android.library") id("com.chromaticnoise.multiplatform-swiftpackage") version "2.0.3" id("kotlin-android-extensions") -// id("io.gitlab.arturbosch.detekt") version "1.17.1" + id("io.gitlab.arturbosch.detekt") version "1.15.0" jacoco } version = "0.0.1" group = "com.example.kmpexamplemodule" -//detekt { -// buildUponDefaultConfig = true // preconfigure defaults -// allRules = false // activate all available (even unstable) rules. -// input = files("src/commonMain/kotlin") -// autoCorrect = false -// -// reports { -// html.enabled = true -// xml.enabled = true -// txt.enabled = true -// sarif.enabled = true -// } -//} -// -//tasks.withType().configureEach { -// // Target version of the generated JVM bytecode. It is used for type resolution. -// jvmTarget = "1.8" -//} +detekt { + buildUponDefaultConfig = true // preconfigure defaults + input = files("src/commonMain/kotlin") + autoCorrect = false + + reports { + html.enabled = true + xml.enabled = true + txt.enabled = true + sarif.enabled = true + } +} + +tasks.withType().configureEach { + // Target version of the generated JVM bytecode. It is used for type resolution. + jvmTarget = "1.8" +} jacoco { toolVersion = "0.8.6" diff --git a/KMPExampleModule/src/androidMain/kotlin/com/example/kmpexamplemodule/Platform.kt b/KMPExampleModule/src/androidMain/kotlin/com/example/kmpexamplemodule/Platform.kt index 3874751..ef53809 100644 --- a/KMPExampleModule/src/androidMain/kotlin/com/example/kmpexamplemodule/Platform.kt +++ b/KMPExampleModule/src/androidMain/kotlin/com/example/kmpexamplemodule/Platform.kt @@ -1,5 +1,5 @@ package com.example.kmpexamplemodule actual class Platform actual constructor() { - actual val platform: String = "Android ${android.os.Build.VERSION.SDK_INT}" + actual val name: String = "Android ${android.os.Build.VERSION.SDK_INT}" } \ No newline at end of file diff --git a/KMPExampleModule/src/androidTest/kotlin/com/example/kmpexamplemodule/androidTest.kt b/KMPExampleModule/src/androidTest/kotlin/com/example/kmpexamplemodule/androidTest.kt index cc39b00..8862c4b 100644 --- a/KMPExampleModule/src/androidTest/kotlin/com/example/kmpexamplemodule/androidTest.kt +++ b/KMPExampleModule/src/androidTest/kotlin/com/example/kmpexamplemodule/androidTest.kt @@ -7,6 +7,6 @@ class AndroidGreetingTest { @Test fun testExample() { - assertTrue("Check Android is mentioned", Greeting().greeting().contains("Android")) + assertTrue("Check Android is mentioned", Greeting().build().contains("Android")) } } \ No newline at end of file diff --git a/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Greeting.kt b/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Greeting.kt index 4087ea5..bbcc792 100644 --- a/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Greeting.kt +++ b/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Greeting.kt @@ -1,7 +1,7 @@ package com.example.kmpexamplemodule class Greeting { - fun greeting(): String { - return "Hello, ${Platform().platform}!" + fun build(): String { + return "Hello, ${Platform().name}!" } } diff --git a/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Platform.kt b/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Platform.kt index 9a9cb50..d537694 100644 --- a/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Platform.kt +++ b/KMPExampleModule/src/commonMain/kotlin/com/example/kmpexamplemodule/Platform.kt @@ -1,5 +1,8 @@ package com.example.kmpexamplemodule +/* we need to suppress this as the expect / actual keywords do not work without an empty constructor. +* those key words are still in beta so this should fix itself eventually */ +@Suppress("EmptyDefaultConstructor") expect class Platform() { - val platform: String + val name: String } diff --git a/KMPExampleModule/src/commonTest/kotlin/com/example/kmpexamplemodule/commonTest.kt b/KMPExampleModule/src/commonTest/kotlin/com/example/kmpexamplemodule/commonTest.kt index 28d6d5d..e46fed0 100644 --- a/KMPExampleModule/src/commonTest/kotlin/com/example/kmpexamplemodule/commonTest.kt +++ b/KMPExampleModule/src/commonTest/kotlin/com/example/kmpexamplemodule/commonTest.kt @@ -7,6 +7,6 @@ class CommonGreetingTest { @Test fun testExample() { - assertTrue(Greeting().greeting().contains("Hello"), "Check 'Hello' is mentioned") + assertTrue(Greeting().build().contains("Hello"), "Check 'Hello' is mentioned") } } \ No newline at end of file diff --git a/KMPExampleModule/src/iosMain/kotlin/com/example/kmpexamplemodule/Platform.kt b/KMPExampleModule/src/iosMain/kotlin/com/example/kmpexamplemodule/Platform.kt index ad1a8b3..f058291 100644 --- a/KMPExampleModule/src/iosMain/kotlin/com/example/kmpexamplemodule/Platform.kt +++ b/KMPExampleModule/src/iosMain/kotlin/com/example/kmpexamplemodule/Platform.kt @@ -3,5 +3,5 @@ package com.example.kmpexamplemodule import platform.UIKit.UIDevice actual class Platform actual constructor() { - actual val platform: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion + actual val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion } \ No newline at end of file diff --git a/KMPExampleModule/src/iosTest/kotlin/com/example/kmpexamplemodule/iosTest.kt b/KMPExampleModule/src/iosTest/kotlin/com/example/kmpexamplemodule/iosTest.kt index 37b2aaf..49c86ba 100644 --- a/KMPExampleModule/src/iosTest/kotlin/com/example/kmpexamplemodule/iosTest.kt +++ b/KMPExampleModule/src/iosTest/kotlin/com/example/kmpexamplemodule/iosTest.kt @@ -7,6 +7,6 @@ class IosGreetingTest { @Test fun testExample() { - assertTrue(Greeting().greeting().contains("iOS"), "Check iOS is mentioned") + assertTrue(Greeting().build().contains("iOS"), "Check iOS is mentioned") } } \ No newline at end of file From b0f2ce41803b2361448f00dc1f94eb3ddbadc04d Mon Sep 17 00:00:00 2001 From: GusWard Date: Mon, 28 Jun 2021 15:52:54 +0100 Subject: [PATCH 5/5] Added code magic step --- codemagic.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/codemagic.yaml b/codemagic.yaml index 359a284..c4cf74f 100644 --- a/codemagic.yaml +++ b/codemagic.yaml @@ -15,6 +15,12 @@ workflows: - &install_java_15 name: Install Java 15.0.2 script: ./codeMagicScripts/installJava15.sh + - &run_static_analysis + name: Run Static Analysis + script: | + source ~/.bash_profile + export JAVA_HOME=$JAVA_LOCATION + ./gradlew -Dorg.gradle.java.home=$JAVA_LOCATION build KMPExampleModule:detekt - &run_unit_tests name: Run Unit Tests script: | @@ -57,6 +63,7 @@ workflows: source: true scripts: - *install_java_15 + - *run_static_analysis - *run_unit_tests - *verify_tests_coverage artifacts: