xref: /aosp_15_r20/external/okio/okio-testing-support/build.gradle.kts (revision f9742813c14b702d71392179818a9e591da8620c)

<lambda>null1 plugins {
2   kotlin("multiplatform")
3   id("build-support")
4 }
5 
<lambda>null6 kotlin {
7   configureOrCreateOkioPlatforms()
8 
9   sourceSets {
10     all {
11       languageSettings.apply {
12         optIn("kotlin.time.ExperimentalTime")
13       }
14     }
15 
16     val commonMain by getting {
17       dependencies {
18         api(projects.okio)
19         api(libs.kotlin.test)
20       }
21     }
22 
23     val nonWasmMain by creating {
24       dependsOn(commonMain)
25       dependencies {
26         api(libs.kotlin.time)
27         implementation(projects.okioFakefilesystem)
28       }
29     }
30 
31     if (kmpJsEnabled) {
32       val jsMain by getting {
33         dependsOn(nonWasmMain)
34       }
35     }
36 
37     val jvmMain by getting {
38       dependsOn(nonWasmMain)
39       dependencies {
40         // On the JVM the kotlin-test library resolves to one of three implementations based on
41         // which testing framework is in use. JUnit is used downstream, but Gradle can't know that
42         // here and thus fails to select a variant automatically. Declare it manually instead.
43         api(libs.kotlin.test.junit)
44       }
45     }
46 
47     if (kmpNativeEnabled) {
48       createSourceSet("nativeMain", children = nativeTargets)
49         .also { nativeMain ->
50           nativeMain.dependsOn(nonWasmMain)
51         }
52     }
53 
54     if (kmpWasmEnabled) {
55       createSourceSet("wasmMain", children = wasmTargets)
56         .also { wasmMain ->
57           wasmMain.dependsOn(commonMain)
58         }
59     }
60   }
61 }
62