Stub to exclude kotlin-stdlib dependency from jvm target
This commit is contained in:
parent
5de503dcb3
commit
647dcbb363
@ -1,3 +1,4 @@
|
|||||||
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
|
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
|
||||||
import ru.landgrafhomyak.kotlin.kmp_gradle_build_helper.*
|
import ru.landgrafhomyak.kotlin.kmp_gradle_build_helper.*
|
||||||
import ru.landgrafhomyak.kotlin.kmp_gradle_build_helper.plugin.xomrk
|
import ru.landgrafhomyak.kotlin.kmp_gradle_build_helper.plugin.xomrk
|
||||||
@ -14,11 +15,10 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "ru.landgrafhomyak.utility"
|
group = "ru.landgrafhomyak.utility"
|
||||||
version = "0.1"
|
version = "0.5"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://maven.landgrafhomyak.ru/")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xomrk {
|
xomrk {
|
||||||
@ -26,16 +26,72 @@ xomrk {
|
|||||||
setCompatibilityWithKotlin(KotlinVersion.KOTLIN_2_0)
|
setCompatibilityWithKotlin(KotlinVersion.KOTLIN_2_0)
|
||||||
optInContracts()
|
optInContracts()
|
||||||
explicitApi()
|
explicitApi()
|
||||||
|
noWarnExpectActual()
|
||||||
|
warningsAsErrors()
|
||||||
|
|
||||||
defineAllMultiplatformTargets()
|
defineAllMultiplatformTargets()
|
||||||
|
|
||||||
|
jvmToolchain(8)
|
||||||
|
jvm {
|
||||||
|
withJava()
|
||||||
|
|
||||||
|
compilations.configureEach {
|
||||||
|
compileJavaTaskProvider?.configure {
|
||||||
|
targetCompatibility = "1.8"
|
||||||
|
}
|
||||||
|
compileTaskProvider.configure {
|
||||||
|
compilerOptions {
|
||||||
|
jvmTarget = JvmTarget.JVM_1_8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named { t -> t == "${this@jvm.name}Test" }.configureEach {
|
||||||
|
this as Test
|
||||||
|
useTestNG()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
commonMain {
|
// if use kotlin("stdlib") gitea ui brokes at paragraph with dependency versions
|
||||||
|
val kotlinStdlibDependency = "org.jetbrains.kotlin:kotlin-stdlib:${this@kotlin.coreLibrariesVersion}"
|
||||||
|
|
||||||
|
val commonMain by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
|
compileOnly(kotlinStdlibDependency)
|
||||||
implementation("org.jetbrains.kotlinx:atomicfu:0.27.0")
|
implementation("org.jetbrains.kotlinx:atomicfu:0.27.0")
|
||||||
implementation("ru.landgrafhomyak.utility:highlevel-try-finally:0.5")
|
implementation("ru.landgrafhomyak.utility:highlevel-try-finally:0.5")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val jvmMain by getting {
|
||||||
|
dependencies {
|
||||||
|
compileOnly(kotlinStdlibDependency)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val nonJvmMain by creating {
|
||||||
|
dependsOn(commonMain)
|
||||||
|
dependencies {
|
||||||
|
implementation(kotlinStdlibDependency)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jvmTest {
|
||||||
|
dependencies {
|
||||||
|
implementation("org.testng:testng:7.5.1")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
configureEach {
|
||||||
|
when {
|
||||||
|
// commonMain !in dependsOn -> return@configureEach
|
||||||
|
!name.endsWith("Main") -> return@configureEach
|
||||||
|
this@configureEach === commonMain -> return@configureEach
|
||||||
|
this@configureEach === jvmMain -> return@configureEach
|
||||||
|
this@configureEach === nonJvmMain -> return@configureEach
|
||||||
|
}
|
||||||
|
dependsOn(nonJvmMain)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user