-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
92 lines (78 loc) · 2.69 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
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
plugins {
kotlin("multiplatform")
id("com.vanniktech.maven.publish")
}
group = project.property("GROUP") as String
version = project.property("VERSION_NAME") as String
repositories {
mavenCentral()
}
kotlin {
val darwinTargets = arrayOf(
"macosX64", "macosArm64",
"iosArm64", "iosX64", "iosSimulatorArm64",
)
// jvm()
for (target in darwinTargets) {
val darwinTarget = presets.getByName(target).createTarget(target) as KotlinNativeTarget
val platform = when (target) {
"iosArm64" -> "iphoneos"
"iosX64", "iosSimulatorArm64" -> "iphonesimulator"
"macosX64", "macosArm64" -> "macosx"
else -> error("Unsupported target $name")
}
darwinTarget.apply {
compilations.getByName("main") {
cinterops.create("web3swift") {
val interopTask = tasks[interopProcessingTaskName]
interopTask.dependsOn(":web3swift:build${platform.capitalize()}")
if (platform == "macosx") {
includeDirs.headerFilterOnly("$rootDir/web3swift/build/Release/include")
} else {
includeDirs.headerFilterOnly("$rootDir/web3swift/build/Release-$platform/include")
}
}
}
}
targets.add(darwinTarget)
}
sourceSets {
val commonMain by getting {
dependencies{
implementation("com.ionspin.kotlin:bignum:_")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:_")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:_")
}
}
// val jvmTest by getting {
// dependencies {
// implementation(kotlin("test-junit"))
// implementation(kotlin("test-annotations-common"))
// }
// }
val darwinMain by creating {
dependsOn(commonMain)
}
darwinTargets.forEach { target ->
getByName("${target}Main") {
dependsOn(darwinMain)
}
}
all {
languageSettings.optIn("kotlin.RequiresOptIn")
}
}
}
plugins.withId("com.vanniktech.maven.publish.base") {
configure<com.vanniktech.maven.publish.MavenPublishBaseExtension> {
publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.S01)
signAllPublications()
pomFromGradleProperties()
}
}