publish all targets by default
This commit is contained in:
parent
e1c946cd8f
commit
d12497ebe2
@ -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" }
|
||||||
|
@ -54,7 +54,7 @@ public val Project.isInDevelopment: Boolean
|
|||||||
|
|
||||||
private const val defaultJdkVersion = 17
|
private const val defaultJdkVersion = 17
|
||||||
|
|
||||||
public abstract class KScienceExtension @Inject constructor(public val project: Project): ExtensionAware {
|
public abstract class KScienceExtension @Inject constructor(public val project: Project) : ExtensionAware {
|
||||||
|
|
||||||
public val jdkVersionProperty: Property<Int> = project.objects.property<Int>().apply {
|
public val jdkVersionProperty: Property<Int> = project.objects.property<Int>().apply {
|
||||||
set(defaultJdkVersion)
|
set(defaultJdkVersion)
|
||||||
@ -233,7 +233,7 @@ public abstract class KScienceExtension @Inject constructor(public val project:
|
|||||||
*/
|
*/
|
||||||
public fun useContextReceivers() {
|
public fun useContextReceivers() {
|
||||||
project.tasks.withType<KotlinCompile> {
|
project.tasks.withType<KotlinCompile> {
|
||||||
compilerOptions{
|
compilerOptions {
|
||||||
freeCompilerArgs.add("-Xcontext-receivers")
|
freeCompilerArgs.add("-Xcontext-receivers")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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)
|
||||||
@ -364,7 +341,7 @@ public abstract class KScienceMppExtension @Inject constructor(project: Project)
|
|||||||
project.configure<KotlinMultiplatformExtension> {
|
project.configure<KotlinMultiplatformExtension> {
|
||||||
jvm {
|
jvm {
|
||||||
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||||
compilerOptions{
|
compilerOptions {
|
||||||
freeCompilerArgs.addAll(defaultKotlinJvmArgs)
|
freeCompilerArgs.addAll(defaultKotlinJvmArgs)
|
||||||
}
|
}
|
||||||
block()
|
block()
|
||||||
@ -458,7 +435,7 @@ public abstract class KScienceMppExtension @Inject constructor(project: Project)
|
|||||||
) {
|
) {
|
||||||
js {
|
js {
|
||||||
browser {
|
browser {
|
||||||
commonWebpackConfig{
|
commonWebpackConfig {
|
||||||
outputFileName = bundleName
|
outputFileName = bundleName
|
||||||
}
|
}
|
||||||
browserConfig()
|
browserConfig()
|
||||||
@ -537,7 +514,7 @@ public abstract class KScienceMppExtension @Inject constructor(project: Project)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
internal inline fun <reified T : KScienceExtension> Project.registerKScienceExtension():T {
|
internal inline fun <reified T : KScienceExtension> Project.registerKScienceExtension(): T {
|
||||||
// extensions.findByType<T>()?.let { return it }
|
// extensions.findByType<T>()?.let { return it }
|
||||||
// return constructor(this).also {
|
// return constructor(this).also {
|
||||||
// extensions.add("kscience", it)
|
// extensions.add("kscience", it)
|
||||||
|
Loading…
Reference in New Issue
Block a user