Skip to content

Commit

Permalink
20240604+1
Browse files Browse the repository at this point in the history
  • Loading branch information
JesusMcCloud committed Jun 4, 2024
1 parent 05c17b7 commit dead895
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Dual-Version Kotlin 1.9.10 / 2.0.0


## 20240604+1
* Fix Kotest multiplatform plugin loading for K2

## 20240604
* Fix Kotest version for K2

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# A-SIT Plus Gradle Conventions Plugin

[![Version](https://img.shields.io/badge/Kotlin_1.9.10-+20240604-gray.svg?style=flat&logo=kotlin&labelColor=blue&logoColor=white)](CHANGELOG.md)
[![Version](https://img.shields.io/badge/Kotlin_2.0.0-+20240604-gray.svg?style=flat&logo=kotlin&labelColor=7463ce&logoColor=white)](CHANGELOG.md)
[![Version](https://img.shields.io/badge/Kotlin_1.9.10-+20240604+1-gray.svg?style=flat&logo=kotlin&labelColor=blue&logoColor=white)](CHANGELOG.md)
[![Version](https://img.shields.io/badge/Kotlin_2.0.0-+20240604+1-gray.svg?style=flat&logo=kotlin&labelColor=7463ce&logoColor=white)](CHANGELOG.md)
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-brightgreen.svg?style=flat&)](http://www.apache.org/licenses/LICENSE-2.0)

**Note: This plugin is still in its early stages and may not work well for edge cases!
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
buildDate=20240604
buildDate=20240604+1
groupId=at.asitplus.gradle
4 changes: 3 additions & 1 deletion k2/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ version = "$kotlinVersion+$buildDate"
group = groupId

dependencies {
api(project(":legacy"))
api(project(":legacy")){
exclude(group = "io.kotest", module = "kotest-framework-multiplatform-plugin-gradle")
}
api("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
api("com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:$ksp")
api("io.kotest:kotest-framework-multiplatform-plugin-gradle:$kotest")
Expand Down
6 changes: 6 additions & 0 deletions k2/src/main/kotlin/at/asitplus/gradle/K2Plugin.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package at.asitplus.gradle

import org.gradle.api.Project
import org.gradle.kotlin.dsl.invoke
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension

Expand All @@ -11,7 +12,12 @@ class AspConventions : AspLegacyConventions() {
kotlin.runCatching {
javaClass.classLoader!!.getResourceAsStream("k2versions.properties").use { aspVersions.versions.load(it) }
}
}

override fun Project.addKotestPlugin(isMultiplatform: Boolean) {

Logger.info("\n Setting up Kotest multiplatform plugin")
plugins.apply("io.kotest.multiplatform")
}

override fun KotlinMultiplatformExtension.setupKotest() {
Expand Down
2 changes: 1 addition & 1 deletion k2/src/main/resources/k2versions.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
kotlin=2.0.0
ksp=1.0.21
kotest=5.9.0
kotest=5.9.0!!
17 changes: 14 additions & 3 deletions legacy/src/main/kotlin/at/asitplus/gradle/Plugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ open class AspLegacyConventions : Plugin<Project> {
}
}

protected open fun Project.addKotestPlugin(isMultiplatform: Boolean) {
if (isMultiplatform) {
afterEvaluate {
Logger.info("\n Setting up Kotest multiplatform plugin")
plugins.apply("io.kotest.multiplatform")
}
}
}

protected open fun versionOverrides(aspVersions: AspVersions) = Unit

override fun apply(target: Project) {
Expand Down Expand Up @@ -189,9 +198,12 @@ open class AspLegacyConventions : Plugin<Project> {
target.plugins.withType<KotlinMultiplatformPluginWrapper> {
isMultiplatform = true
Logger.lifecycle(" ${H}Multiplatform project detected$R")
}
target.addKotestPlugin(isMultiplatform)

target.afterEvaluate {

target.plugins.withType<KotlinMultiplatformPluginWrapper> {
target.afterEvaluate {
val kmpTargets =
extensions.getByType<KotlinMultiplatformExtension>().targets.filter { it.name != "metadata" }
if (kmpTargets.isEmpty())
Expand All @@ -204,8 +216,7 @@ open class AspLegacyConventions : Plugin<Project> {
kmpTargets.forEach { Logger.lifecycle(" * ${it.name}") }


Logger.info("\n Setting up Kotest multiplatform plugin ${AspVersions.kotest}")
plugins.apply("io.kotest.multiplatform")


extensions.getByType<KotlinMultiplatformExtension>().jvm {
Logger.info(" Setting jsr305=strict for JVM nullability annotations")
Expand Down

0 comments on commit dead895

Please sign in to comment.