1
1
import org.jetbrains.dokka.gradle.DokkaTask
2
2
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformJvmPlugin
3
- import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
4
-
5
- buildscript {
6
- repositories {
7
- mavenCentral()
8
- }
9
- dependencies {
10
- classpath(" org.jetbrains.kotlinx:atomicfu-gradle-plugin:${Versions .atomicfu} " )
11
- }
12
- }
13
3
14
4
plugins {
15
-
16
5
base
17
- kotlin(" jvm" ) version Versions .kotlin apply false
6
+ `maven- publish`
7
+ jacoco
8
+ kotlin(" jvm" ) version Versions .kotlin
18
9
19
10
// see: https://kotlinlang.org/docs/reference/compiler-plugins.html
20
11
kotlin(" plugin.spring" ) version Versions .kotlin apply false
21
12
kotlin(" plugin.allopen" ) version Versions .kotlin apply false
22
13
kotlin(" plugin.noarg" ) version Versions .kotlin apply false
23
14
kotlin(" plugin.jpa" ) version Versions .kotlin apply false
15
+ kotlin(" plugin.serialization" ) version Versions .kotlin apply false
16
+ // kotlin("plugin.atomicfu") version Versions.kotlin apply false
17
+ kotlin(" kapt" ) version Versions .kotlin apply false
24
18
25
19
// id(BuildPlugins.detekt) version BuildPlugins.Versions.detekt apply false
26
20
id(BuildPlugins .dokka) version BuildPlugins .Versions .dokka apply false
27
21
id(BuildPlugins .dependency_management) version BuildPlugins .Versions .dependency_management
28
22
id(BuildPlugins .spring_boot) version BuildPlugins .Versions .spring_boot apply false
29
- `maven - publish`
23
+
30
24
}
31
25
32
26
allprojects {
33
27
repositories {
34
28
mavenCentral()
35
29
google()
36
- jcenter()
37
30
}
38
31
}
39
32
@@ -43,33 +36,87 @@ subprojects {
43
36
plugin<JavaLibraryPlugin >()
44
37
plugin<KotlinPlatformJvmPlugin >()
45
38
46
- plugin(" kotlinx-atomicfu" )
47
-
48
39
plugin(" jacoco" )
49
40
plugin(" maven-publish" )
50
41
51
42
// plugin("io.gitlab.arturbosch.detekt")
52
43
plugin(" org.jetbrains.dokka" )
53
44
plugin(" io.spring.dependency-management" )
54
- plugin(" maven-publish" )
55
45
}
56
46
57
- tasks.withType<KotlinCompile > {
58
- sourceCompatibility = " 11"
59
- kotlinOptions {
60
- val experimentalAnnotations = listOf (" kotlin.Experimental" ,
61
- " kotlin.experimental.ExperimentalTypeInference" ,
62
- " kotlin.ExperimentalMultiplatform" ,
63
- " kotlinx.coroutines.ExperimentalCoroutinesApi" ,
64
- " kotlinx.coroutines.ObsoleteCoroutinesApi" ,
65
- " kotlinx.coroutines.InternalCoroutinesApi" ,
66
- " kotlinx.coroutines.FlowPreview" )
67
- jvmTarget = " 11"
68
- freeCompilerArgs.plus(" -Xjsr305=strict" )
69
- freeCompilerArgs.plus(" -Xjvm-default=enable" )
70
- freeCompilerArgs.plus(experimentalAnnotations.map { " -Xuse-experimental=$it " })
71
- freeCompilerArgs.plus(" -progressive" )
72
- freeCompilerArgs.plus(" -XXLanguage:+InlineClasses" )
47
+ java {
48
+ toolchain {
49
+ languageVersion.set(JavaLanguageVersion .of(17 ))
50
+ }
51
+ }
52
+
53
+ val javaVersion = JavaVersion .VERSION_17 .toString()
54
+
55
+ tasks {
56
+ compileJava {
57
+ sourceCompatibility = javaVersion
58
+ targetCompatibility = javaVersion
59
+ }
60
+
61
+ compileKotlin {
62
+ kotlinOptions {
63
+ jvmTarget = javaVersion
64
+ languageVersion = " 1.8"
65
+ apiVersion = " 1.8"
66
+ freeCompilerArgs = listOf (
67
+ " -Xjsr305=strict" ,
68
+ " -Xjvm-default=all" ,
69
+ " -Xinline-classes" ,
70
+ " -Xallow-result-return-type" ,
71
+ " -Xstring-concat=indy" , // since Kotlin 1.4.20 for JVM 9+
72
+ " -progressive" , // since Kotlin 1.6
73
+ " -Xenable-builder-inference" , // since Kotlin 1.6
74
+ " -Xbackend-threads=0" , // since 1.6.20 (0 means one thread per CPU core)
75
+ // "-Xuse-k2" // since Kotlin 1.7 // kapt not support
76
+ )
77
+
78
+ val experimentalAnnotations = listOf (
79
+ " kotlin.RequiresOptIn" ,
80
+ " kotlin.contracts.ExperimentalContracts" ,
81
+ " kotlin.experimental.ExperimentalTypeInference" ,
82
+ " kotlinx.coroutines.ExperimentalCoroutinesApi" ,
83
+ " kotlinx.coroutines.InternalCoroutinesApi" ,
84
+ " kotlinx.coroutines.FlowPreview" ,
85
+ )
86
+ freeCompilerArgs = freeCompilerArgs.plus(experimentalAnnotations.map { " -opt-in=$it " })
87
+ }
88
+ }
89
+
90
+ compileTestKotlin {
91
+ kotlinOptions {
92
+ jvmTarget = javaVersion
93
+ languageVersion = " 1.8"
94
+ apiVersion = " 1.8"
95
+ freeCompilerArgs = listOf (
96
+ " -Xjsr305=strict" ,
97
+ " -Xjvm-default=all" ,
98
+ " -Xinline-classes" ,
99
+ " -Xallow-result-return-type" ,
100
+ " -Xstring-concat=indy" , // since Kotlin 1.4.20 for JVM 9+
101
+ " -progressive" , // since Kotlin 1.6
102
+ " -Xenable-builder-inference" , // since Kotlin 1.6
103
+ " -Xbackend-threads=0" , // since 1.6.20 (0 means one thread per CPU core)
104
+ // "-Xuse-k2" // since Kotlin 1.7 // kapt not support
105
+ )
106
+
107
+ val experimentalAnnotations = listOf (
108
+ " kotlin.RequiresOptIn" ,
109
+ " kotlin.Experimental" ,
110
+ " kotlin.ExperimentalStdlibApi" ,
111
+ " kotlin.time.ExperimentalTime" ,
112
+ " kotlin.contracts.ExperimentalContracts" ,
113
+ // "kotlin.experimental.ExperimentalTypeInference",
114
+ " kotlinx.coroutines.ExperimentalCoroutinesApi" ,
115
+ " kotlinx.coroutines.InternalCoroutinesApi" ,
116
+ " kotlinx.coroutines.FlowPreview" ,
117
+ )
118
+ freeCompilerArgs = freeCompilerArgs.plus(experimentalAnnotations.map { " -opt-in=$it " })
119
+ }
73
120
}
74
121
}
75
122
@@ -138,6 +185,7 @@ subprojects {
138
185
imports {
139
186
mavenBom(" org.springframework.boot:spring-boot-dependencies:${Versions .spring_boot} " )
140
187
mavenBom(" org.springframework.cloud:spring-cloud-dependencies:${Versions .spring_cloud} " )
188
+ mavenBom(Libraries .kotlin_bom)
141
189
}
142
190
dependencies {
143
191
dependency(Libraries .kotlin_stdlib)
@@ -247,7 +295,7 @@ subprojects {
247
295
testImplementation(Libraries .kotlin_test_junit5)
248
296
249
297
implementation(Libraries .kotlinx_coroutines_jdk8)
250
- implementation(Libraries .atomicfu)
298
+ // implementation(Libraries.atomicfu)
251
299
252
300
api(Libraries .commons_lang3)
253
301
0 commit comments