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.
|
- All publishing targets are enabled by default. Introduce `publishing.targets` variable to regulate what is added to the module.
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
- JVM plugin in favor of Mpp.
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
- JS plugin. It is deprecated in favor of MPP.
|
||||||
- Unnecessary `dependsOn` for native dependencies.
|
- Unnecessary `dependsOn` for native dependencies.
|
||||||
- Groovy gradle dependency notation.
|
- Groovy gradle dependency notation.
|
||||||
|
|
||||||
|
@ -65,12 +65,6 @@ gradlePlugin {
|
|||||||
description = "Pre-configured JVM project"
|
description = "Pre-configured JVM project"
|
||||||
implementationClass = "space.kscience.gradle.KScienceJVMPlugin"
|
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> {
|
project.configure<KotlinMultiplatformExtension> {
|
||||||
jvm {
|
jvm {
|
||||||
compilations.all {
|
compilations.all {
|
||||||
kotlinOptions {
|
compilerOptions {
|
||||||
freeCompilerArgs = freeCompilerArgs + defaultKotlinJvmArgs
|
freeCompilerArgs.addAll(defaultKotlinJvmArgs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
block()
|
block()
|
||||||
@ -503,44 +503,44 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
|
|||||||
val nativeConfiguration = KScienceNativeConfiguration(this).apply(block)
|
val nativeConfiguration = KScienceNativeConfiguration(this).apply(block)
|
||||||
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
||||||
configure<KotlinMultiplatformExtension> {
|
configure<KotlinMultiplatformExtension> {
|
||||||
nativeConfiguration.targets.values.forEach { nativeTarget ->
|
nativeConfiguration.targets.values.forEach { nativeTarget ->
|
||||||
when (nativeTarget.preset) {
|
when (nativeTarget.preset) {
|
||||||
KotlinNativePreset.linuxX64 -> linuxX64(
|
KotlinNativePreset.linuxX64 -> linuxX64(
|
||||||
nativeTarget.targetName,
|
nativeTarget.targetName,
|
||||||
nativeTarget.targetConfiguration
|
nativeTarget.targetConfiguration
|
||||||
)
|
)
|
||||||
|
|
||||||
KotlinNativePreset.mingwX64 -> mingwX64(
|
KotlinNativePreset.mingwX64 -> mingwX64(
|
||||||
nativeTarget.targetName,
|
nativeTarget.targetName,
|
||||||
nativeTarget.targetConfiguration
|
nativeTarget.targetConfiguration
|
||||||
)
|
)
|
||||||
|
|
||||||
KotlinNativePreset.macosX64 -> macosX64(
|
KotlinNativePreset.macosX64 -> macosX64(
|
||||||
nativeTarget.targetName,
|
nativeTarget.targetName,
|
||||||
nativeTarget.targetConfiguration
|
nativeTarget.targetConfiguration
|
||||||
)
|
)
|
||||||
|
|
||||||
KotlinNativePreset.macosArm64 -> macosArm64(
|
KotlinNativePreset.macosArm64 -> macosArm64(
|
||||||
nativeTarget.targetName,
|
nativeTarget.targetName,
|
||||||
nativeTarget.targetConfiguration
|
nativeTarget.targetConfiguration
|
||||||
)
|
)
|
||||||
|
|
||||||
KotlinNativePreset.iosX64 -> iosX64(
|
KotlinNativePreset.iosX64 -> iosX64(
|
||||||
nativeTarget.targetName,
|
nativeTarget.targetName,
|
||||||
nativeTarget.targetConfiguration
|
nativeTarget.targetConfiguration
|
||||||
)
|
)
|
||||||
|
|
||||||
KotlinNativePreset.iosArm64 -> iosArm64(
|
KotlinNativePreset.iosArm64 -> iosArm64(
|
||||||
nativeTarget.targetName,
|
nativeTarget.targetName,
|
||||||
nativeTarget.targetConfiguration
|
nativeTarget.targetConfiguration
|
||||||
)
|
)
|
||||||
|
|
||||||
KotlinNativePreset.iosSimulatorArm64 -> iosSimulatorArm64(
|
KotlinNativePreset.iosSimulatorArm64 -> iosSimulatorArm64(
|
||||||
nativeTarget.targetName,
|
nativeTarget.targetName,
|
||||||
nativeTarget.targetConfiguration
|
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.gradle.kotlin.dsl.withType
|
||||||
import org.jetbrains.dokka.gradle.DokkaPlugin
|
import org.jetbrains.dokka.gradle.DokkaPlugin
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
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.applySettings
|
||||||
import space.kscience.gradle.internal.defaultKotlinJvmArgs
|
import space.kscience.gradle.internal.defaultKotlinJvmArgs
|
||||||
|
|
||||||
public open class KScienceJVMPlugin : Plugin<Project> {
|
public open class KScienceJVMPlugin : Plugin<Project> {
|
||||||
override fun apply(project: Project): Unit = project.run {
|
override fun apply(project: Project): Unit = project.run {
|
||||||
|
|
||||||
|
logger.warn("KSCience JVM plugin is deprecated. Use MPP.")
|
||||||
if (!plugins.hasPlugin("org.jetbrains.kotlin.jvm")) {
|
if (!plugins.hasPlugin("org.jetbrains.kotlin.jvm")) {
|
||||||
plugins.apply("org.jetbrains.kotlin.jvm")
|
plugins.apply("org.jetbrains.kotlin.jvm")
|
||||||
} else {
|
} else {
|
||||||
@ -27,6 +28,9 @@ public open class KScienceJVMPlugin : Plugin<Project> {
|
|||||||
configure<KotlinJvmProjectExtension> {
|
configure<KotlinJvmProjectExtension> {
|
||||||
sourceSets.all {
|
sourceSets.all {
|
||||||
languageSettings.applySettings()
|
languageSettings.applySettings()
|
||||||
|
compilerOptions{
|
||||||
|
freeCompilerArgs.addAll(defaultKotlinJvmArgs)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets["test"].apply {
|
sourceSets["test"].apply {
|
||||||
@ -42,12 +46,6 @@ public open class KScienceJVMPlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<KotlinCompile> {
|
|
||||||
kotlinOptions {
|
|
||||||
freeCompilerArgs = freeCompilerArgs + defaultKotlinJvmArgs
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<Test> {
|
tasks.withType<Test> {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,11 @@ import org.jetbrains.kotlin.gradle.plugin.LanguageSettingsBuilder
|
|||||||
import space.kscience.gradle.KScienceVersions
|
import space.kscience.gradle.KScienceVersions
|
||||||
|
|
||||||
|
|
||||||
internal val defaultKotlinJvmArgs: List<String> =
|
internal val defaultKotlinJvmArgs: List<String> = listOf(
|
||||||
listOf("-Xjvm-default=all", "-Xlambdas=indy"/* "-Xjdk-release=${KScienceVersions.JVM_TARGET}"*/)
|
"-Xjvm-default=all",
|
||||||
|
"-Xlambdas=indy",
|
||||||
|
/* "-Xjdk-release=${KScienceVersions.JVM_TARGET}"*/
|
||||||
|
)
|
||||||
|
|
||||||
internal fun resolveKotlinVersion(): KotlinVersion {
|
internal fun resolveKotlinVersion(): KotlinVersion {
|
||||||
val (major, minor, patch) = KScienceVersions.kotlinVersion.split(".", "-")
|
val (major, minor, patch) = KScienceVersions.kotlinVersion.split(".", "-")
|
||||||
@ -23,6 +26,7 @@ internal fun LanguageSettingsBuilder.applySettings(
|
|||||||
apiVersion = versionString
|
apiVersion = versionString
|
||||||
progressiveMode = true
|
progressiveMode = true
|
||||||
|
|
||||||
|
|
||||||
optIn("kotlin.RequiresOptIn")
|
optIn("kotlin.RequiresOptIn")
|
||||||
optIn("kotlin.ExperimentalUnsignedTypes")
|
optIn("kotlin.ExperimentalUnsignedTypes")
|
||||||
optIn("kotlin.ExperimentalStdlibApi")
|
optIn("kotlin.ExperimentalStdlibApi")
|
||||||
|
@ -8,9 +8,7 @@ import org.gradle.api.tasks.bundling.Jar
|
|||||||
import org.gradle.kotlin.dsl.*
|
import org.gradle.kotlin.dsl.*
|
||||||
import org.gradle.plugins.signing.SigningExtension
|
import org.gradle.plugins.signing.SigningExtension
|
||||||
import org.gradle.plugins.signing.SigningPlugin
|
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.dsl.KotlinJvmProjectExtension
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.targets
|
|
||||||
import space.kscience.gradle.isInDevelopment
|
import space.kscience.gradle.isInDevelopment
|
||||||
|
|
||||||
internal fun Project.requestPropertyOrNull(propertyName: String): String? = findProperty(propertyName) as? String
|
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") {
|
plugins.withId("maven-publish") {
|
||||||
configure<PublishingExtension> {
|
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") {
|
plugins.withId("org.jetbrains.kotlin.jvm") {
|
||||||
val kotlin = extensions.findByType<KotlinJvmProjectExtension>()!!
|
val kotlin = extensions.findByType<KotlinJvmProjectExtension>()!!
|
||||||
|
|
||||||
@ -46,9 +33,7 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
|
|||||||
}
|
}
|
||||||
|
|
||||||
publications.create<MavenPublication>("jvm") {
|
publications.create<MavenPublication>("jvm") {
|
||||||
project.components.forEach {
|
from(project.components["java"])
|
||||||
from(it)
|
|
||||||
}
|
|
||||||
|
|
||||||
artifact(sourcesJar)
|
artifact(sourcesJar)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user