publish all targets by default

This commit is contained in:
Alexander Nozik 2024-12-21 09:02:58 +03:00
parent e1c946cd8f
commit d12497ebe2
2 changed files with 21 additions and 43 deletions

View File

@ -95,6 +95,7 @@ kotlinx-serialization-hocon = { module = "org.jetbrains.kotlinx:kotlinx-serializ
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" } kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" }
kotlinx-serialization-properties = { module = "org.jetbrains.kotlinx:kotlinx-serialization-properties", version.ref = "kotlinx-serialization" } kotlinx-serialization-properties = { module = "org.jetbrains.kotlinx:kotlinx-serialization-properties", version.ref = "kotlinx-serialization" }
kotlinx-serialization-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "kotlinx-serialization" } kotlinx-serialization-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "kotlinx-serialization" }
kotlinx-browser = "org.jetbrains.kotlinx:kotlinx-browser:0.3"
ksp-api = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" } ksp-api = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" }
ktor-bom = { module = "io.ktor:ktor-bom", version.ref = "ktor" } ktor-bom = { module = "io.ktor:ktor-bom", version.ref = "ktor" }
logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" } logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }

View File

@ -287,13 +287,10 @@ public class KScienceNativeConfiguration(private val project: Project) {
internal companion object { internal companion object {
private fun defaultNativeTargets(project: Project): Map<KotlinNativePreset, KScienceNativeTarget> { private fun defaultNativeTargets(project: Project): Map<KotlinNativePreset, KScienceNativeTarget> =
val hostOs = System.getProperty("os.name") when (val targets = project.requestPropertyOrNull("publishing.targets")) {
null -> {
val targets = project.requestPropertyOrNull("publishing.targets") listOf(
return when {
targets == "all" -> listOf(
KScienceNativeTarget.linuxX64, KScienceNativeTarget.linuxX64,
KScienceNativeTarget.mingwX64, KScienceNativeTarget.mingwX64,
KScienceNativeTarget.macosX64, KScienceNativeTarget.macosX64,
@ -302,32 +299,12 @@ public class KScienceNativeConfiguration(private val project: Project) {
KScienceNativeTarget.iosArm64, KScienceNativeTarget.iosArm64,
KScienceNativeTarget.iosSimulatorArm64, KScienceNativeTarget.iosSimulatorArm64,
) )
}
targets != null -> { else -> {
targets.split(",").map { KScienceNativeTarget(KotlinNativePreset.valueOf(it)) } targets.split(",").map { KScienceNativeTarget(KotlinNativePreset.valueOf(it)) }
} }
hostOs.startsWith("Windows") -> listOf(
KScienceNativeTarget.linuxX64,
KScienceNativeTarget.mingwX64
)
hostOs == "Mac OS X" -> listOf(
KScienceNativeTarget.macosX64,
KScienceNativeTarget.macosArm64,
KScienceNativeTarget.iosX64,
KScienceNativeTarget.iosArm64,
KScienceNativeTarget.iosSimulatorArm64,
)
hostOs == "Linux" -> listOf(KScienceNativeTarget.linuxX64)
else -> {
emptyList()
}
}.associateBy { it.preset } }.associateBy { it.preset }
} }
}
internal var targets: Map<KotlinNativePreset, KScienceNativeTarget> = defaultNativeTargets(project) internal var targets: Map<KotlinNativePreset, KScienceNativeTarget> = defaultNativeTargets(project)