File tree Expand file tree Collapse file tree 5 files changed +29
-43
lines changed
plugins/src/main/kotlin/com/saveourtool/template/build Expand file tree Collapse file tree 5 files changed +29
-43
lines changed Original file line number Diff line number Diff line change 11plugins {
2- id(" com.saveourtool.template.build.kotlin-mpp-configuration" )
2+ id(" com.saveourtool.template.build.kotlin-mpp-with-jvm- configuration" )
33}
44
55kotlin {
88 sourceSets {
99 commonMain {
1010 dependencies {
11- implementation(" org.jetbrains. kotlinx:kotlinx- serialization- core" )
11+ implementation(libs. kotlinx. serialization. core)
1212 }
1313 }
1414 }
Original file line number Diff line number Diff line change 11[versions ]
2- java = " 21"
32kotlin = " 1.9.22"
3+ kotlin-serialization = " 1.6.3"
44spring-boot = " 3.2.3"
55springdoc = " 2.3.0"
66
@@ -17,3 +17,5 @@ spring-boot-dependencies = { module = "org.springframework.boot:spring-boot-depe
1717springdoc-openapi-starter-common = { module = " org.springdoc:springdoc-openapi-starter-common" , version.ref = " springdoc" }
1818springdoc-openapi-starter-webflux-ui = { module = " org.springdoc:springdoc-openapi-starter-webflux-ui" , version.ref = " springdoc" }
1919springdoc-openapi-starter-webmvc-ui = { module = " org.springdoc:springdoc-openapi-starter-webmvc-ui" , version.ref = " springdoc" }
20+
21+ kotlinx-serialization-core = { module = " org.jetbrains.kotlinx:kotlinx-serialization-core" , version.ref = " kotlin-serialization" }
Original file line number Diff line number Diff line change 1+ package com.saveourtool.template.build
2+
3+ import org.gradle.api.Project
4+ import org.gradle.kotlin.dsl.withType
5+ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
6+
7+ /* *
8+ * Enables null-safe checking (jsr305) and allows OptIn
9+ */
10+ fun Project.configureKotlinCompile () {
11+ tasks.withType<KotlinCompile > {
12+ kotlinOptions {
13+ freeCompilerArgs + = " -Xjsr305=strict"
14+ }
15+ compilerOptions {
16+ freeCompilerArgs.add(" -opt-in=kotlin.RequiresOptIn" )
17+ }
18+ }
19+ }
Original file line number Diff line number Diff line change @@ -3,24 +3,16 @@ package com.saveourtool.template.build
33import org.gradle.accessors.dm.LibrariesForLibs
44import org.gradle.api.tasks.testing.Test
55import org.gradle.kotlin.dsl.*
6- import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
76
87plugins {
98 kotlin(" multiplatform" )
109}
1110
1211@Suppress(" GENERIC_VARIABLE_WRONG_DECLARATION" )
1312val libs = the<LibrariesForLibs >()
14- val javaVersion: JavaVersion = JavaVersion .toVersion(libs.versions.java.get())
15-
16- java {
17- sourceCompatibility = javaVersion
18- }
1913
2014kotlin {
21- jvmToolchain {
22- this .languageVersion.set(JavaLanguageVersion .of(javaVersion.majorVersion))
23- }
15+ jvm()
2416
2517 sourceSets {
2618 jvmMain {
@@ -31,15 +23,7 @@ kotlin {
3123 }
3224}
3325
34- tasks.withType<KotlinCompile > {
35- kotlinOptions {
36- freeCompilerArgs + = " -Xjsr305=strict"
37- jvmTarget = javaVersion.majorVersion
38- }
39- compilerOptions {
40- freeCompilerArgs.add(" -opt-in=kotlin.RequiresOptIn" )
41- }
42- }
26+ configureKotlinCompile()
4327
4428tasks.withType<Test > {
4529 useJUnitPlatform()
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package com.saveourtool.template.build
33import org.gradle.accessors.dm.LibrariesForLibs
44import org.gradle.api.tasks.testing.Test
55import org.gradle.kotlin.dsl.*
6+ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
67import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
78
89plugins {
@@ -13,30 +14,10 @@ plugins {
1314 id(" org.springframework.boot" )
1415}
1516
17+ configureKotlinCompile()
18+
1619@Suppress(" GENERIC_VARIABLE_WRONG_DECLARATION" )
1720val libs = the<LibrariesForLibs >()
18- val javaVersion: JavaVersion = JavaVersion .toVersion(libs.versions.java.get())
19-
20- java {
21- sourceCompatibility = javaVersion
22- }
23-
24- kotlin {
25- jvmToolchain {
26- this .languageVersion.set(JavaLanguageVersion .of(javaVersion.majorVersion))
27- }
28- }
29-
30- tasks.withType<KotlinCompile > {
31- kotlinOptions {
32- freeCompilerArgs + = " -Xjsr305=strict"
33- jvmTarget = javaVersion.majorVersion
34- }
35- compilerOptions {
36- freeCompilerArgs.add(" -opt-in=kotlin.RequiresOptIn" )
37- }
38- }
39-
4021dependencies {
4122 implementation(project.dependencies.enforcedPlatform(libs.spring.boot.dependencies))
4223}
You can’t perform that action at this time.
0 commit comments