bump Kotlin to 1.9.23, enable additional Kotlin Multiplatform targets (#15)
* bump Kotlin to 1.9.23, enable additional Kotlin Multiplatform targets * replace soon-to-be-deprecated kotlinOptions with newer compilerOptions
This commit is contained in:
parent
171570159e
commit
8890fef665
6 changed files with 134 additions and 173 deletions
|
@ -6,6 +6,6 @@ dependencies {
|
||||||
implementation("com.github.ben-manes:gradle-versions-plugin:0.51.0")
|
implementation("com.github.ben-manes:gradle-versions-plugin:0.51.0")
|
||||||
implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.1")
|
implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.1")
|
||||||
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.9.10")
|
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.9.10")
|
||||||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.10")
|
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23")
|
||||||
implementation("org.jetbrains.kotlinx:kover-gradle-plugin:0.7.4")
|
implementation("org.jetbrains.kotlinx:kover-gradle-plugin:0.7.4")
|
||||||
}
|
}
|
|
@ -3,7 +3,9 @@ package buildsrc.conventions.lang
|
||||||
import buildsrc.utils.Rife2TestListener
|
import buildsrc.utils.Rife2TestListener
|
||||||
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
|
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
|
||||||
import org.gradle.api.tasks.testing.logging.TestLogEvent
|
import org.gradle.api.tasks.testing.logging.TestLogEvent
|
||||||
|
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
||||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
|
||||||
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
|
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
|
||||||
|
|
||||||
|
@ -24,29 +26,21 @@ plugins {
|
||||||
kotlin {
|
kotlin {
|
||||||
//jvmToolchain(11)
|
//jvmToolchain(11)
|
||||||
|
|
||||||
targets.configureEach {
|
applyDefaultHierarchyTemplate()
|
||||||
compilations.configureEach {
|
|
||||||
kotlinOptions {
|
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||||
languageVersion = "1.6"
|
compilerOptions {
|
||||||
}
|
languageVersion = KotlinVersion.KOTLIN_1_6
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// configure all Kotlin/JVM Tests to use JUnit
|
// configure all Kotlin/JVM Tests to use JUnit
|
||||||
targets.withType<KotlinJvmTarget>().configureEach {
|
targets.withType<KotlinJvmTarget>().configureEach {
|
||||||
testRuns.configureEach {
|
testRuns.configureEach {
|
||||||
executionTask.configure {
|
executionTask.configure {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets.configureEach {
|
|
||||||
languageSettings {
|
|
||||||
// languageVersion =
|
|
||||||
// apiVersion =
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package buildsrc.conventions.lang
|
package buildsrc.conventions.lang
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
|
||||||
|
|
||||||
/** conventions for a Kotlin/JS subproject */
|
/** conventions for a Kotlin/JS subproject */
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
|
@ -7,12 +9,38 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
js(IR) {
|
||||||
js(IR) {
|
browser()
|
||||||
browser()
|
nodejs()
|
||||||
nodejs()
|
}
|
||||||
}
|
|
||||||
|
@OptIn(ExperimentalWasmDsl::class)
|
||||||
|
wasmJs {
|
||||||
|
browser()
|
||||||
|
nodejs()
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalWasmDsl::class)
|
||||||
|
wasmWasi {
|
||||||
|
nodejs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
relocateKotlinJsStore()
|
relocateKotlinJsStore()
|
||||||
|
|
||||||
|
|
||||||
|
//region FIXME: WORKAROUND https://youtrack.jetbrains.com/issue/KT-65864
|
||||||
|
rootProject.plugins.withType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin> {
|
||||||
|
rootProject.extensions.configure<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension> {
|
||||||
|
// Use a Node.js version current enough to support Kotlin/Wasm
|
||||||
|
nodeVersion = "22.0.0-nightly2024010568c8472ed9"
|
||||||
|
logger.lifecycle("Using Node.js $nodeVersion to support Kotlin/Wasm")
|
||||||
|
nodeDownloadBaseUrl = "https://nodejs.org/download/nightly"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.tasks.withType<org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask>().configureEach {
|
||||||
|
// Prevent Yarn from complaining about newer Node.js versions.
|
||||||
|
args.add("--ignore-engines")
|
||||||
|
}
|
||||||
|
//endregion
|
||||||
|
|
|
@ -7,94 +7,26 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
|
|
||||||
// Native targets all extend commonMain and commonTest.
|
|
||||||
//
|
|
||||||
// Some targets (ios, tvos, watchos) are shortcuts provided by the Kotlin DSL, that
|
|
||||||
// provide additional targets, except for 'simulators' which must be defined manually.
|
|
||||||
// https://kotlinlang.org/docs/multiplatform-share-on-platforms.html#use-target-shortcuts
|
|
||||||
//
|
|
||||||
// common/
|
|
||||||
// └── native/
|
|
||||||
// ├── linuxX64
|
|
||||||
// ├── mingwX64
|
|
||||||
// ├── macosX64
|
|
||||||
// ├── macosArm64
|
|
||||||
// ├── ios/ (shortcut)
|
|
||||||
// │ ├── iosArm64
|
|
||||||
// │ ├── iosX64
|
|
||||||
// │ └── iosSimulatorArm64
|
|
||||||
// ├── tvos/ (shortcut)
|
|
||||||
// │ ├── tvosArm64
|
|
||||||
// │ ├── tvosX64
|
|
||||||
// │ └── tvosSimulatorArm64Main
|
|
||||||
// └── watchos/ (shortcut)
|
|
||||||
// ├── watchosArm32
|
|
||||||
// ├── watchosArm64
|
|
||||||
// ├── watchosX64
|
|
||||||
// └── watchosSimulatorArm64Main
|
|
||||||
|
|
||||||
linuxX64()
|
linuxX64()
|
||||||
|
|
||||||
mingwX64()
|
mingwX64()
|
||||||
|
|
||||||
|
linuxArm64()
|
||||||
|
|
||||||
macosX64()
|
macosX64()
|
||||||
macosArm64()
|
macosArm64()
|
||||||
|
|
||||||
// https://kotlinlang.org/docs/multiplatform-share-on-platforms.html#use-target-shortcuts
|
iosArm64()
|
||||||
ios() // iosArm64, iosX64
|
iosX64()
|
||||||
watchos() // watchosArm32, watchosArm64, watchosX64
|
|
||||||
tvos() // tvosArm64, tvosX64
|
|
||||||
|
|
||||||
iosSimulatorArm64()
|
iosSimulatorArm64()
|
||||||
tvosSimulatorArm64()
|
|
||||||
|
watchosArm32()
|
||||||
|
watchosArm64()
|
||||||
|
watchosX64()
|
||||||
watchosSimulatorArm64()
|
watchosSimulatorArm64()
|
||||||
|
watchosDeviceArm64()
|
||||||
|
|
||||||
@Suppress("UNUSED_VARIABLE")
|
tvosArm64()
|
||||||
sourceSets {
|
tvosX64()
|
||||||
val commonMain by getting {}
|
tvosSimulatorArm64()
|
||||||
val commonTest by getting {}
|
|
||||||
|
|
||||||
val nativeMain by creating { dependsOn(commonMain) }
|
|
||||||
val nativeTest by creating { dependsOn(commonTest) }
|
|
||||||
|
|
||||||
// Linux
|
|
||||||
val linuxX64Main by getting { dependsOn(nativeMain) }
|
|
||||||
val linuxX64Test by getting { dependsOn(nativeTest) }
|
|
||||||
|
|
||||||
// Windows - MinGW
|
|
||||||
val mingwX64Main by getting { dependsOn(nativeMain) }
|
|
||||||
val mingwX64Test by getting { dependsOn(nativeTest) }
|
|
||||||
|
|
||||||
// Apple - macOS
|
|
||||||
val macosArm64Main by getting { dependsOn(nativeMain) }
|
|
||||||
val macosArm64Test by getting { dependsOn(nativeTest) }
|
|
||||||
|
|
||||||
val macosX64Main by getting { dependsOn(nativeMain) }
|
|
||||||
val macosX64Test by getting { dependsOn(nativeTest) }
|
|
||||||
|
|
||||||
// Apple - iOS
|
|
||||||
val iosMain by getting { dependsOn(nativeMain) }
|
|
||||||
val iosTest by getting { dependsOn(nativeTest) }
|
|
||||||
|
|
||||||
val iosSimulatorArm64Main by getting { dependsOn(iosMain) }
|
|
||||||
// val iosSimulatorArm64Test by getting { dependsOn(iosTest) }
|
|
||||||
|
|
||||||
// // Apple - tvOS
|
|
||||||
// val tvosMain by getting { dependsOn(nativeMain) }
|
|
||||||
// val tvosTest by getting { dependsOn(nativeTest) }
|
|
||||||
|
|
||||||
// val tvosSimulatorArm64Main by getting { dependsOn(tvosMain) }
|
|
||||||
// val tvosSimulatorArm64Test by getting { dependsOn(tvosTest) }
|
|
||||||
|
|
||||||
// // Apple - watchOS
|
|
||||||
// val watchosMain by getting { dependsOn(nativeMain) }
|
|
||||||
// val watchosTest by getting { dependsOn(nativeTest) }
|
|
||||||
|
|
||||||
// val watchosSimulatorArm64Main by getting { dependsOn(watchosMain) }
|
|
||||||
// val watchosSimulatorArm64Test by getting { dependsOn(watchosTest) }
|
|
||||||
|
|
||||||
// val iosArm32Main by getting { dependsOn(desktopMain) }
|
|
||||||
// val iosArm32Test by getting { dependsOn(nativeTest) }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,82 +1,90 @@
|
||||||
rootProject.name = "urlencoder"
|
rootProject.name = "urlencoder"
|
||||||
|
|
||||||
pluginManagement {
|
pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("UnstableApiUsage")
|
@Suppress("UnstableApiUsage")
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://oss.sonatype.org/content/repositories/snapshots") {
|
maven("https://oss.sonatype.org/content/repositories/snapshots") {
|
||||||
name = "Sonatype Snapshots"
|
name = "Sonatype Snapshots"
|
||||||
mavenContent { snapshotsOnly() }
|
mavenContent { snapshotsOnly() }
|
||||||
}
|
|
||||||
|
|
||||||
// Declare the Node.js & Yarn download repositories
|
|
||||||
exclusiveContent {
|
|
||||||
forRepository {
|
|
||||||
ivy("https://nodejs.org/dist/") {
|
|
||||||
name = "Node Distributions at $url"
|
|
||||||
patternLayout { artifact("v[revision]/[artifact](-v[revision]-[classifier]).[ext]") }
|
|
||||||
metadataSources { artifact() }
|
|
||||||
content { includeModule("org.nodejs", "node") }
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
filter { includeGroup("org.nodejs") }
|
|
||||||
}
|
|
||||||
|
|
||||||
exclusiveContent {
|
// Declare the Node.js & Yarn download repositories
|
||||||
forRepository {
|
exclusiveContent {
|
||||||
ivy("https://github.com/yarnpkg/yarn/releases/download") {
|
forRepositories(
|
||||||
name = "Yarn Distributions at $url"
|
ivy("https://nodejs.org/dist/") {
|
||||||
patternLayout { artifact("v[revision]/[artifact](-v[revision]).[ext]") }
|
name = "Node Distributions at $url"
|
||||||
metadataSources { artifact() }
|
patternLayout { artifact("v[revision]/[artifact](-v[revision]-[classifier]).[ext]") }
|
||||||
content { includeModule("com.yarnpkg", "yarn") }
|
metadataSources { artifact() }
|
||||||
|
},
|
||||||
|
ivy("https://nodejs.org/download/v8-canary/") {
|
||||||
|
name = "Node Canary Distributions at $url"
|
||||||
|
patternLayout { artifact("v[revision]/[artifact](-v[revision]-[classifier]).[ext]") }
|
||||||
|
metadataSources { artifact() }
|
||||||
|
},
|
||||||
|
ivy("https://nodejs.org/download/nightly/") {
|
||||||
|
name = "Node Nightly Distributions at $url"
|
||||||
|
patternLayout { artifact("v[revision]/[artifact](-v[revision]-[classifier]).[ext]") }
|
||||||
|
metadataSources { artifact() }
|
||||||
|
},
|
||||||
|
)
|
||||||
|
filter { includeGroup("org.nodejs") }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
filter { includeGroup("com.yarnpkg") }
|
|
||||||
}
|
|
||||||
|
|
||||||
// workaround for https://youtrack.jetbrains.com/issue/KT-51379
|
exclusiveContent {
|
||||||
exclusiveContent {
|
forRepository {
|
||||||
forRepository {
|
ivy("https://github.com/yarnpkg/yarn/releases/download") {
|
||||||
ivy("https://download.jetbrains.com/kotlin/native/builds") {
|
name = "Yarn Distributions at $url"
|
||||||
name = "Kotlin Native"
|
patternLayout { artifact("v[revision]/[artifact](-v[revision]).[ext]") }
|
||||||
patternLayout {
|
metadataSources { artifact() }
|
||||||
// example download URLs:
|
}
|
||||||
// https://download.jetbrains.com/kotlin/native/builds/releases/1.7.20/linux-x86_64/kotlin-native-prebuilt-linux-x86_64-1.7.20.tar.gz
|
|
||||||
// https://download.jetbrains.com/kotlin/native/builds/releases/1.7.20/windows-x86_64/kotlin-native-prebuilt-windows-x86_64-1.7.20.zip
|
|
||||||
// https://download.jetbrains.com/kotlin/native/builds/releases/1.7.20/macos-x86_64/kotlin-native-prebuilt-macos-x86_64-1.7.20.tar.gz
|
|
||||||
listOf(
|
|
||||||
"macos-x86_64",
|
|
||||||
"macos-aarch64",
|
|
||||||
"osx-x86_64",
|
|
||||||
"osx-aarch64",
|
|
||||||
"linux-x86_64",
|
|
||||||
"windows-x86_64",
|
|
||||||
).forEach { os ->
|
|
||||||
listOf("dev", "releases").forEach { stage ->
|
|
||||||
artifact("$stage/[revision]/$os/[artifact]-[revision].[ext]")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
filter { includeGroup("com.yarnpkg") }
|
||||||
metadataSources { artifact() }
|
}
|
||||||
|
|
||||||
|
// workaround for https://youtrack.jetbrains.com/issue/KT-51379
|
||||||
|
exclusiveContent {
|
||||||
|
forRepository {
|
||||||
|
ivy("https://download.jetbrains.com/kotlin/native/builds") {
|
||||||
|
name = "Kotlin Native"
|
||||||
|
patternLayout {
|
||||||
|
// example download URLs:
|
||||||
|
// https://download.jetbrains.com/kotlin/native/builds/releases/1.7.20/linux-x86_64/kotlin-native-prebuilt-linux-x86_64-1.7.20.tar.gz
|
||||||
|
// https://download.jetbrains.com/kotlin/native/builds/releases/1.7.20/windows-x86_64/kotlin-native-prebuilt-windows-x86_64-1.7.20.zip
|
||||||
|
// https://download.jetbrains.com/kotlin/native/builds/releases/1.7.20/macos-x86_64/kotlin-native-prebuilt-macos-x86_64-1.7.20.tar.gz
|
||||||
|
listOf(
|
||||||
|
"macos-x86_64",
|
||||||
|
"macos-aarch64",
|
||||||
|
"osx-x86_64",
|
||||||
|
"osx-aarch64",
|
||||||
|
"linux-x86_64",
|
||||||
|
"windows-x86_64",
|
||||||
|
).forEach { os ->
|
||||||
|
listOf("dev", "releases").forEach { stage ->
|
||||||
|
artifact("$stage/[revision]/$os/[artifact]-[revision].[ext]")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
metadataSources { artifact() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filter { includeModuleByRegex(".*", ".*kotlin-native-prebuilt.*") }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
filter { includeModuleByRegex(".*", ".*kotlin-native-prebuilt.*") }
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
||||||
|
|
||||||
include(
|
include(
|
||||||
":urlencoder-app",
|
":urlencoder-app",
|
||||||
":urlencoder-lib",
|
":urlencoder-lib",
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,17 +1,21 @@
|
||||||
import org.jetbrains.dokka.gradle.DokkaTask
|
import org.jetbrains.dokka.gradle.DokkaTask
|
||||||
|
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
buildsrc.conventions.lang.`kotlin-multiplatform-jvm`
|
buildsrc.conventions.lang.`kotlin-multiplatform-jvm`
|
||||||
// buildsrc.conventions.lang.`kotlin-multiplatform-js`
|
|
||||||
// buildsrc.conventions.lang.`kotlin-multiplatform-native`
|
|
||||||
buildsrc.conventions.publishing
|
buildsrc.conventions.publishing
|
||||||
id("application")
|
|
||||||
id("com.github.ben-manes.versions")
|
id("com.github.ben-manes.versions")
|
||||||
}
|
}
|
||||||
|
|
||||||
val urlEncoderMainClass = "net.thauvin.erik.urlencoder.UrlEncoder"
|
val urlEncoderMainClass = "net.thauvin.erik.urlencoder.UrlEncoder"
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
|
jvm {
|
||||||
|
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||||
|
mainRun {
|
||||||
|
mainClass.set(urlEncoderMainClass)
|
||||||
|
}
|
||||||
|
}
|
||||||
sourceSets {
|
sourceSets {
|
||||||
commonMain {
|
commonMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -32,10 +36,6 @@ base {
|
||||||
archivesName.set(rootProject.name)
|
archivesName.set(rootProject.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
application {
|
|
||||||
mainClass.set(urlEncoderMainClass)
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
jvmJar {
|
jvmJar {
|
||||||
manifest {
|
manifest {
|
||||||
|
@ -45,14 +45,13 @@ tasks {
|
||||||
|
|
||||||
val fatJar by registering(Jar::class) {
|
val fatJar by registering(Jar::class) {
|
||||||
group = LifecycleBasePlugin.BUILD_GROUP
|
group = LifecycleBasePlugin.BUILD_GROUP
|
||||||
dependsOn.addAll(listOf("compileJava", "compileKotlinJvm", "processResources"))
|
|
||||||
archiveClassifier.set("all")
|
archiveClassifier.set("all")
|
||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
manifest { attributes(mapOf("Main-Class" to application.mainClass)) }
|
manifest { attributes(mapOf("Main-Class" to urlEncoderMainClass)) }
|
||||||
from(sourceSets.main.get().output)
|
from(sourceSets.main.map { it.output })
|
||||||
dependsOn(configurations.jvmRuntimeClasspath)
|
dependsOn(configurations.jvmRuntimeClasspath)
|
||||||
from(configurations.jvmRuntimeClasspath.map { classpath ->
|
from(configurations.jvmRuntimeClasspath.map { classpath ->
|
||||||
classpath.incoming.artifacts.artifactFiles.files.filter { it.name.endsWith("jar") }.map { zipTree(it) }
|
classpath.filter { it.name.endsWith(".jar") }.map { zipTree(it) }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue