-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle.kts
161 lines (141 loc) · 3.5 KB
/
build.gradle.kts
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
import co.touchlab.cklib.gradle.CompileToBitcode.Language.OBJC
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.KotlinMultiplatform
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
plugins {
kotlin("multiplatform")
id("com.android.library")
id("org.jetbrains.dokka")
id("com.vanniktech.maven.publish.base")
id("co.touchlab.cklib")
}
kotlin {
androidTarget {
publishLibraryVariants("release")
}
jvm()
js(IR) {
browser()
nodejs()
}
macosX64()
macosArm64()
iosX64()
iosArm64()
iosSimulatorArm64()
watchosArm32()
watchosArm64()
watchosSimulatorArm64()
watchosX64()
tvosArm64()
tvosSimulatorArm64()
tvosX64()
sourceSets {
all {
languageSettings.optIn("kotlin.RequiresOptIn")
}
matching { it.name.endsWith("Test") }.all {
languageSettings {
optIn("kotlin.RequiresOptIn")
}
}
val commonMain by sourceSets.getting {
dependencies {
api(projects.common)
api(projects.mac)
api(projects.random)
api(projects.cipher)
}
}
val commonTest by sourceSets.getting {
dependencies {
implementation(libs.kotlinx.coroutines.test)
implementation(libs.diglol.encoding)
implementation(kotlin("test"))
}
}
val commonJvmMain by sourceSets.creating {
dependsOn(commonMain)
}
val commonJvmTest by sourceSets.creating {
dependsOn(commonJvmMain)
dependsOn(commonTest)
}
val jvmMain by sourceSets.getting {
dependsOn(commonJvmMain)
}
val jvmTest by sourceSets.getting {
dependsOn(jvmMain)
dependsOn(commonJvmTest)
}
val androidMain by sourceSets.getting {
dependsOn(commonJvmMain)
}
val androidUnitTest by sourceSets.getting {
dependsOn(androidMain)
dependsOn(commonJvmTest)
}
val jsMain by sourceSets.getting
val jsTest by sourceSets.getting
val darwinMain by sourceSets.creating {
dependsOn(commonMain)
}
val darwinTest by sourceSets.creating {
dependsOn(commonTest)
}
targets.withType<KotlinNativeTarget>().all {
val main by compilations.getting
val test by compilations.getting
main.cinterops {
create("aead") {
includeDirs("$projectDir/aesgcm")
compilerOpts("-DNS_FORMAT_ARGUMENT(A)=", "-D_Nullable_result=_Nullable")
}
}
main.defaultSourceSet.dependsOn(
when {
konanTarget.family.isAppleFamily -> darwinMain
else -> TODO("Not yet implemented")
}
)
test.defaultSourceSet.dependsOn(
if (konanTarget.family.isAppleFamily) {
darwinTest
} else {
commonTest
}
)
}
}
}
cklib {
config.kotlinVersion = libs.versions.kotlin.get()
create("aead") {
language = OBJC
srcDirs = project.files(file("aesgcm"))
compilerArgs.addAll(
listOf("-DKONAN_MI_MALLOC=1", "-DNS_FORMAT_ARGUMENT(A)=", "-D_Nullable_result=_Nullable")
)
}
}
android {
namespace = "diglol.crypto.aead"
defaultConfig {
consumerProguardFiles("proguard-rules.pro")
}
testOptions {
unitTests.isReturnDefaultValues = true
}
}
dependencies {
androidTestImplementation(libs.junit)
androidTestImplementation(libs.androidx.test.runner)
}
configure<MavenPublishBaseExtension> {
configure(
KotlinMultiplatform(
javadocJar = JavadocJar.Dokka("dokkaGfm")
)
)
}