-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
88 lines (76 loc) · 2.29 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
88 lines (76 loc) · 2.29 KB
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
import org.gradle.kotlin.dsl.the
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnLockMismatchReport
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootEnvSpec
import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework
import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFrameworkTask
plugins {
id("targets")
id("publish")
id("unicode-data")
}
repositories {
mavenCentral()
}
val xcframeworkName = "DoistxConfusables"
val xcf = XCFramework(xcframeworkName)
kotlin {
explicitApi()
jvmToolchain(11)
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64(),
watchosX64(),
watchosSimulatorArm64(),
watchosArm32(),
watchosArm64(),
watchosDeviceArm64(),
).forEach {
it.binaries.framework {
baseName = xcframeworkName
isStatic = false
binaryOption("bundleId", "com.doist.doistx-confusables")
xcf.add(this)
}
}
sourceSets {
val commonMain by getting {
dependencies {
implementation("com.doist.x:normalize:1.3.3")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
}
}
tasks.withType(XCFrameworkTask::class).configureEach {
doLast {
val destination = File("${outputDir.resolve(buildType.getName())}/Package.swift")
destination.delete()
File("$projectDir/Package.swift.template").copyTo(destination)
}
}
plugins.withType<YarnPlugin> {
the<YarnRootEnvSpec>().apply {
yarnLockMismatchReport = YarnLockMismatchReport.WARNING
yarnLockAutoReplace = true
}
}
// Sanity check before attempting to publish root target without having all targets enabled.
tasks.matching { it.name.startsWith("publishKotlinMultiplatform") }.configureEach {
doFirst {
val enabledTargets = findProperty("targets")
?.toString()
?.split(",")
?.map(String::trim)
?.filter(String::isNotEmpty)
.orEmpty()
require(enabledTargets.contains("all")) {
"Configuration is set to publish root target without 'all' targets enabled."
}
}
}