remove Js plugin and deprecated JVM
This commit is contained in:
parent
4f41d90308
commit
b27624bf1c
@ -15,8 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- All publishing targets are enabled by default. Introduce `publishing.targets` variable to regulate what is added to the module.
|
||||
|
||||
### Deprecated
|
||||
- JVM plugin in favor of Mpp.
|
||||
|
||||
### Removed
|
||||
- JS plugin. It is deprecated in favor of MPP.
|
||||
- Unnecessary `dependsOn` for native dependencies.
|
||||
- Groovy gradle dependency notation.
|
||||
|
||||
|
@ -65,12 +65,6 @@ gradlePlugin {
|
||||
description = "Pre-configured JVM project"
|
||||
implementationClass = "space.kscience.gradle.KScienceJVMPlugin"
|
||||
}
|
||||
|
||||
create("js") {
|
||||
id = "space.kscience.gradle.js"
|
||||
description = "Pre-configured JS project"
|
||||
implementationClass = "space.kscience.gradle.KScienceJSPlugin"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -373,8 +373,8 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
|
||||
project.configure<KotlinMultiplatformExtension> {
|
||||
jvm {
|
||||
compilations.all {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs = freeCompilerArgs + defaultKotlinJvmArgs
|
||||
compilerOptions {
|
||||
freeCompilerArgs.addAll(defaultKotlinJvmArgs)
|
||||
}
|
||||
}
|
||||
block()
|
||||
@ -503,44 +503,44 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
|
||||
val nativeConfiguration = KScienceNativeConfiguration(this).apply(block)
|
||||
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
||||
configure<KotlinMultiplatformExtension> {
|
||||
nativeConfiguration.targets.values.forEach { nativeTarget ->
|
||||
when (nativeTarget.preset) {
|
||||
KotlinNativePreset.linuxX64 -> linuxX64(
|
||||
nativeTarget.targetName,
|
||||
nativeTarget.targetConfiguration
|
||||
)
|
||||
nativeConfiguration.targets.values.forEach { nativeTarget ->
|
||||
when (nativeTarget.preset) {
|
||||
KotlinNativePreset.linuxX64 -> linuxX64(
|
||||
nativeTarget.targetName,
|
||||
nativeTarget.targetConfiguration
|
||||
)
|
||||
|
||||
KotlinNativePreset.mingwX64 -> mingwX64(
|
||||
nativeTarget.targetName,
|
||||
nativeTarget.targetConfiguration
|
||||
)
|
||||
KotlinNativePreset.mingwX64 -> mingwX64(
|
||||
nativeTarget.targetName,
|
||||
nativeTarget.targetConfiguration
|
||||
)
|
||||
|
||||
KotlinNativePreset.macosX64 -> macosX64(
|
||||
nativeTarget.targetName,
|
||||
nativeTarget.targetConfiguration
|
||||
)
|
||||
KotlinNativePreset.macosX64 -> macosX64(
|
||||
nativeTarget.targetName,
|
||||
nativeTarget.targetConfiguration
|
||||
)
|
||||
|
||||
KotlinNativePreset.macosArm64 -> macosArm64(
|
||||
nativeTarget.targetName,
|
||||
nativeTarget.targetConfiguration
|
||||
)
|
||||
KotlinNativePreset.macosArm64 -> macosArm64(
|
||||
nativeTarget.targetName,
|
||||
nativeTarget.targetConfiguration
|
||||
)
|
||||
|
||||
KotlinNativePreset.iosX64 -> iosX64(
|
||||
nativeTarget.targetName,
|
||||
nativeTarget.targetConfiguration
|
||||
)
|
||||
KotlinNativePreset.iosX64 -> iosX64(
|
||||
nativeTarget.targetName,
|
||||
nativeTarget.targetConfiguration
|
||||
)
|
||||
|
||||
KotlinNativePreset.iosArm64 -> iosArm64(
|
||||
nativeTarget.targetName,
|
||||
nativeTarget.targetConfiguration
|
||||
)
|
||||
KotlinNativePreset.iosArm64 -> iosArm64(
|
||||
nativeTarget.targetName,
|
||||
nativeTarget.targetConfiguration
|
||||
)
|
||||
|
||||
KotlinNativePreset.iosSimulatorArm64 -> iosSimulatorArm64(
|
||||
nativeTarget.targetName,
|
||||
nativeTarget.targetConfiguration
|
||||
)
|
||||
}
|
||||
KotlinNativePreset.iosSimulatorArm64 -> iosSimulatorArm64(
|
||||
nativeTarget.targetName,
|
||||
nativeTarget.targetConfiguration
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,56 +0,0 @@
|
||||
package space.kscience.gradle
|
||||
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.tasks.Copy
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.get
|
||||
import org.jetbrains.dokka.gradle.DokkaPlugin
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
|
||||
import space.kscience.gradle.internal.applySettings
|
||||
import space.kscience.gradle.internal.fromJsDependencies
|
||||
|
||||
public open class KScienceJSPlugin : Plugin<Project> {
|
||||
override fun apply(project: Project): Unit = project.run {
|
||||
if (!plugins.hasPlugin("org.jetbrains.kotlin.js")) {
|
||||
plugins.apply("org.jetbrains.kotlin.js")
|
||||
} else {
|
||||
logger.info("Kotlin JS plugin is already present")
|
||||
}
|
||||
registerKScienceExtension(::KScienceExtension)
|
||||
|
||||
//logger.info("Applying KScience configuration for JS project")
|
||||
configure<KotlinJsProjectExtension> {
|
||||
js(IR) { browser { } }
|
||||
|
||||
sourceSets.all {
|
||||
languageSettings.applySettings()
|
||||
}
|
||||
|
||||
sourceSets["main"].apply {
|
||||
dependencies {
|
||||
api(project.dependencies.platform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${KScienceVersions.jsBom}"))
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets["test"].apply {
|
||||
dependencies {
|
||||
implementation(kotlin("test-js"))
|
||||
}
|
||||
}
|
||||
|
||||
if (explicitApi == null) explicitApiWarning()
|
||||
}
|
||||
|
||||
(tasks.findByName("processResources") as? Copy)?.apply {
|
||||
fromJsDependencies("runtimeClasspath")
|
||||
}
|
||||
|
||||
|
||||
// apply dokka for all projects
|
||||
if (!plugins.hasPlugin("org.jetbrains.dokka")) {
|
||||
apply<DokkaPlugin>()
|
||||
}
|
||||
}
|
||||
}
|
@ -10,12 +10,13 @@ import org.gradle.kotlin.dsl.get
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
import org.jetbrains.dokka.gradle.DokkaPlugin
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
import space.kscience.gradle.internal.applySettings
|
||||
import space.kscience.gradle.internal.defaultKotlinJvmArgs
|
||||
|
||||
public open class KScienceJVMPlugin : Plugin<Project> {
|
||||
override fun apply(project: Project): Unit = project.run {
|
||||
|
||||
logger.warn("KSCience JVM plugin is deprecated. Use MPP.")
|
||||
if (!plugins.hasPlugin("org.jetbrains.kotlin.jvm")) {
|
||||
plugins.apply("org.jetbrains.kotlin.jvm")
|
||||
} else {
|
||||
@ -27,6 +28,9 @@ public open class KScienceJVMPlugin : Plugin<Project> {
|
||||
configure<KotlinJvmProjectExtension> {
|
||||
sourceSets.all {
|
||||
languageSettings.applySettings()
|
||||
compilerOptions{
|
||||
freeCompilerArgs.addAll(defaultKotlinJvmArgs)
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets["test"].apply {
|
||||
@ -42,12 +46,6 @@ public open class KScienceJVMPlugin : Plugin<Project> {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs = freeCompilerArgs + defaultKotlinJvmArgs
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<Test> {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
@ -7,8 +7,11 @@ import org.jetbrains.kotlin.gradle.plugin.LanguageSettingsBuilder
|
||||
import space.kscience.gradle.KScienceVersions
|
||||
|
||||
|
||||
internal val defaultKotlinJvmArgs: List<String> =
|
||||
listOf("-Xjvm-default=all", "-Xlambdas=indy"/* "-Xjdk-release=${KScienceVersions.JVM_TARGET}"*/)
|
||||
internal val defaultKotlinJvmArgs: List<String> = listOf(
|
||||
"-Xjvm-default=all",
|
||||
"-Xlambdas=indy",
|
||||
/* "-Xjdk-release=${KScienceVersions.JVM_TARGET}"*/
|
||||
)
|
||||
|
||||
internal fun resolveKotlinVersion(): KotlinVersion {
|
||||
val (major, minor, patch) = KScienceVersions.kotlinVersion.split(".", "-")
|
||||
@ -23,6 +26,7 @@ internal fun LanguageSettingsBuilder.applySettings(
|
||||
apiVersion = versionString
|
||||
progressiveMode = true
|
||||
|
||||
|
||||
optIn("kotlin.RequiresOptIn")
|
||||
optIn("kotlin.ExperimentalUnsignedTypes")
|
||||
optIn("kotlin.ExperimentalStdlibApi")
|
||||
|
@ -8,9 +8,7 @@ import org.gradle.api.tasks.bundling.Jar
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.gradle.plugins.signing.SigningExtension
|
||||
import org.gradle.plugins.signing.SigningPlugin
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.targets
|
||||
import space.kscience.gradle.isInDevelopment
|
||||
|
||||
internal fun Project.requestPropertyOrNull(propertyName: String): String? = findProperty(propertyName) as? String
|
||||
@ -24,17 +22,6 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
|
||||
plugins.withId("maven-publish") {
|
||||
configure<PublishingExtension> {
|
||||
|
||||
plugins.withId("org.jetbrains.kotlin.js") {
|
||||
val kotlin: KotlinJsProjectExtension = extensions.findByType()!!
|
||||
|
||||
publications.create<MavenPublication>("js") {
|
||||
kotlin.targets.flatMap { it.components }.forEach {
|
||||
from(it)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
plugins.withId("org.jetbrains.kotlin.jvm") {
|
||||
val kotlin = extensions.findByType<KotlinJvmProjectExtension>()!!
|
||||
|
||||
@ -46,9 +33,7 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
|
||||
}
|
||||
|
||||
publications.create<MavenPublication>("jvm") {
|
||||
project.components.forEach {
|
||||
from(it)
|
||||
}
|
||||
from(project.components["java"])
|
||||
|
||||
artifact(sourcesJar)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user