aboutsummaryrefslogtreecommitdiff
path: root/okio/build.gradle
blob: 24502c6cd98c0285efb82df2eb593a43cdae5674 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
apply plugin: 'org.jetbrains.kotlin.multiplatform'

/*
 * Here's the main hierarchy of variants. Any `expect` functions in one level of the tree are
 * `actual` functions in a (potentially indirect) child node.
 *
 * ```
 *   common
 *   |-- jvm
 *   '-- nonJvm
 *       |-- js
 *       '-- native
 *           |- unix
 *           |   |-- apple
 *           |   |   |-- iosArm64
 *           |   |   |-- iosX64
 *           |   |   |-- macosX64
 *           |   |   |-- watchosArm32
 *           |   |   |-- watchosArm64
 *           |   |   '-- watchosX86
 *           |   '-- linux
 *           |       '-- linuxX64
 *           '-- mingw
 *               '-- mingwX64
 * ```
 *
 * Every child of `native` also includes a source set that depends on the pointer size:
 *
 *  * sizet32 for watchOS, including watchOS 64-bit architectures
 *  * sizet64 for everything else
 *
 * The `hashFunctions` source set builds on all platforms. It ships as a main source set on non-JVM
 * platforms and as a test source set on the JVM platform.
 */
kotlin {
  jvm {
    withJava()
  }
  if (kmpJsEnabled) {
    js {
      configure([compilations.main, compilations.test]) {
        tasks.getByName(compileKotlinTaskName).kotlinOptions {
          moduleKind = "umd"
          sourceMap = true
          metaInfo = true
        }
      }
      nodejs {
        testTask {
          useMocha {
            timeout = "30s"
          }
        }
      }
    }
  }
  if (kmpNativeEnabled) {
    iosX64()
    iosArm64()
    watchosArm32()
    watchosArm64()
    watchosX86()
    // Required to generate tests tasks: https://youtrack.jetbrains.com/issue/KT-26547
    linuxX64()
    macosX64()
    mingwX64()
  }
  sourceSets {
    all {
      languageSettings {
        useExperimentalAnnotation('kotlin.RequiresOptIn')
      }
    }
    commonMain {
      dependencies {
        api deps.kotlin.stdLib.common
      }
    }
    commonTest {
      dependencies {
        implementation deps.kotlin.test.common
        implementation deps.kotlin.test.annotations
        implementation deps.kotlin.time

        implementation project(":okio-fakefilesystem")
      }
    }
    nonJvmMain {
      kotlin.srcDirs += 'src/hashFunctions/kotlin'
    }
    jvmMain {
      dependencies {
        api deps.kotlin.stdLib.jdk6
        compileOnly deps.animalSniffer.annotations
      }
    }
    jvmTest {
      kotlin.srcDirs += 'src/hashFunctions/kotlin'
      dependencies {
        implementation deps.test.junit
        implementation deps.test.assertj
        implementation deps.kotlin.test.jdk
      }
    }
    jsMain {
      dependsOn nonJvmMain
      dependencies {
        api deps.kotlin.stdLib.js
      }
    }
    jsTest {
      dependencies {
        implementation deps.kotlin.test.js
      }
    }

    nativeMain {
      dependsOn nonJvmMain
    }
    nativeTest {
      dependsOn commonTest
    }

    sizet32Main {
      dependsOn nativeMain
    }
    sizet64Main {
      dependsOn nativeMain
    }

    mingwMain {
      dependsOn nativeMain
    }
    mingwX64Main {
      dependsOn sizet64Main
      dependsOn mingwMain
    }
    mingwX64Test {
      dependsOn nativeTest
    }

    unixMain {
      dependsOn nativeMain
    }

    appleMain {
      dependsOn unixMain
    }
    appleTest {
      dependsOn nativeTest
    }
    configure([iosX64Main, iosArm64Main, macosX64Main]) {
      dependsOn sizet64Main
      dependsOn appleMain
    }
    configure([iosX64Test, iosArm64Test, macosX64Test]) {
      dependsOn appleTest
    }
    configure([watchosArm32Main, watchosArm64Main, watchosX86Main]) {
      // Note that size_t is 32-bit on all watchOS versions (ie. pointers are always 32-bit).
      dependsOn sizet32Main
      dependsOn appleMain
    }
    configure([watchosArm32Test, watchosArm64Test, watchosX86Test]) {
      dependsOn appleTest
    }

    linuxMain {
      dependsOn unixMain
      dependsOn nativeMain
    }
    linuxX64Main {
      dependsOn sizet64Main
      dependsOn linuxMain
    }
    linuxX64Test {
      dependsOn nativeTest
    }
  }
}

tasks.withType(JavaCompile) {
  options.encoding = 'UTF-8'
  targetCompatibility = JavaVersion.VERSION_1_8
}

// modify these lines for MANIFEST.MF properties or for specific bnd instructions
project.ext.bndManifest = '''
    Export-Package: okio
    Automatic-Module-Name: okio
    Bundle-SymbolicName: com.squareup.okio
    '''

apply from: 'jvm/jvm.gradle'
apply from: "$rootDir/gradle/gradle-mvn-mpp-push.gradle"