aboutsummaryrefslogtreecommitdiff
path: root/okio-testing-support/build.gradle.kts
blob: bdf3506f112d0a4e5a083d5ac317c97d0619ea3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
plugins {
  kotlin("multiplatform")
  id("build-support")
}

kotlin {
  configureOrCreateOkioPlatforms()

  sourceSets {
    all {
      languageSettings.apply {
        optIn("kotlin.time.ExperimentalTime")
      }
    }

    val commonMain by getting {
      dependencies {
        api(projects.okio)
        api(libs.kotlin.test)
      }
    }

    val nonWasmMain by creating {
      dependsOn(commonMain)
      dependencies {
        api(libs.kotlin.time)
        implementation(projects.okioFakefilesystem)
      }
    }

    if (kmpJsEnabled) {
      val jsMain by getting {
        dependsOn(nonWasmMain)
      }
    }

    val jvmMain by getting {
      dependsOn(nonWasmMain)
      dependencies {
        // On the JVM the kotlin-test library resolves to one of three implementations based on
        // which testing framework is in use. JUnit is used downstream, but Gradle can't know that
        // here and thus fails to select a variant automatically. Declare it manually instead.
        api(libs.kotlin.test.junit)
      }
    }

    if (kmpNativeEnabled) {
      createSourceSet("nativeMain", children = nativeTargets)
        .also { nativeMain ->
          nativeMain.dependsOn(nonWasmMain)
        }
    }

    if (kmpWasmEnabled) {
      createSourceSet("wasmMain", children = wasmTargets)
        .also { wasmMain ->
          wasmMain.dependsOn(commonMain)
        }
    }
  }
}