File tree 6 files changed +36
-41
lines changed
6 files changed +36
-41
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ import org.jetbrains.kotlin.konan.target.HostManager
7
7
import org.jetbrains.dokka.gradle.DokkaTaskPartial
8
8
9
9
apply plugin : ' jdk-convention'
10
- apply from : rootProject. file(" gradle/opt-in.gradle" )
11
10
12
11
def coreModule = " kotlinx-coroutines-core"
13
12
def testModule = " kotlinx-coroutines-test"
@@ -168,7 +167,7 @@ configure(subprojects.findAll { !sourceless.contains(it.name) }) {
168
167
169
168
// Configure options for all Kotlin compilation tasks
170
169
tasks. withType(org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile ). all {
171
- kotlinOptions. freeCompilerArgs + = optInAnnotations. collect { " -Xopt-in=" + it }
170
+ kotlinOptions. freeCompilerArgs + = OptInPresetKt . optInAnnotations. collect { " -Xopt-in=" + it }
172
171
kotlinOptions. freeCompilerArgs + = " -progressive"
173
172
// Disable KT-36770 for RxJava2 integration
174
173
kotlinOptions. freeCompilerArgs + = " -XXLanguage:-ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated"
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3
+ */
4
+
5
+ val optInAnnotations = listOf (
6
+ " kotlin.RequiresOptIn" ,
7
+ " kotlin.experimental.ExperimentalTypeInference" ,
8
+ " kotlin.ExperimentalMultiplatform" ,
9
+ " kotlinx.coroutines.DelicateCoroutinesApi" ,
10
+ " kotlinx.coroutines.ExperimentalCoroutinesApi" ,
11
+ " kotlinx.coroutines.ObsoleteCoroutinesApi" ,
12
+ " kotlinx.coroutines.InternalCoroutinesApi" ,
13
+ " kotlinx.coroutines.FlowPreview" )
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3
+ */
4
+ import org.jetbrains.kotlin.gradle.plugin.*
5
+
6
+ fun KotlinSourceSet.configureMultiplatform () {
7
+ val srcDir = if (name.endsWith(" Main" )) " src" else " test"
8
+ val platform = name.dropLast(4 )
9
+ kotlin.srcDir(" $platform /$srcDir " )
10
+ if (name == " jvmMain" ) {
11
+ resources.srcDir(" $platform /resources" )
12
+ } else if (name == " jvmTest" ) {
13
+ resources.srcDir(" $platform /test-resources" )
14
+ }
15
+ languageSettings {
16
+ optInAnnotations.forEach { optIn(it) }
17
+ progressiveMode = true
18
+ }
19
+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -70,19 +70,8 @@ if (rootProject.ext.native_targets_enabled) {
70
70
* because JMV-only projects depend on core, thus core should always be initialized before configuration.
71
71
*/
72
72
kotlin {
73
- configure(sourceSets) {
74
- def srcDir = name. endsWith(' Main' ) ? ' src' : ' test'
75
- def platform = name[0 .. -5 ]
76
- kotlin. srcDirs = [" $platform /$srcDir " ]
77
- if (name == " jvmMain" ) {
78
- resources. srcDirs = [" $platform /resources" ]
79
- } else if (name == " jvmTest" ) {
80
- resources. srcDirs = [" $platform /test-resources" ]
81
- }
82
- languageSettings {
83
- progressiveMode = true
84
- optInAnnotations. each { optIn(it) }
85
- }
73
+ sourceSets. forEach {
74
+ SourceSetsKt . configureMultiplatform(it)
86
75
}
87
76
88
77
configure(targets) {
Original file line number Diff line number Diff line change @@ -9,17 +9,5 @@ val experimentalAnnotations = listOf(
9
9
)
10
10
11
11
kotlin {
12
- sourceSets.all {
13
- val srcDir = if (name.endsWith(" Main" )) " src" else " test"
14
- val platform = name.dropLast(4 )
15
- kotlin.srcDir(" $platform /$srcDir " )
16
- if (name == " jvmMain" ) {
17
- resources.srcDir(" $platform /resources" )
18
- } else if (name == " jvmTest" ) {
19
- resources.srcDir(" $platform /test-resources" )
20
- }
21
- languageSettings {
22
- experimentalAnnotations.forEach { optIn(it) }
23
- }
24
- }
12
+ sourceSets.all { configureMultiplatform() }
25
13
}
You can’t perform that action at this time.
0 commit comments