-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
118 lines (100 loc) · 2.67 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
plugins {
id("org.jetbrains.kotlin.multiplatform") version "1.7.20"
id("maven-publish")
}
repositories {
mavenCentral()
}
group = "com.danielgergely.cgmath"
version = "2.1.0"
kotlin {
explicitApi()
jvm()
js {
browser {
testTask {} // To run tests with browser.
}
nodejs {
}
}
linuxX64()
mingwX64()
if (isMacOs()) {
macosArm64()
macosX64()
iosArm64()
iosX64()
}
sourceSets {
val commonMain by getting {
dependencies {
implementation(kotlin("stdlib-common"))
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
val jvmMain by getting {
dependencies {
implementation(kotlin("stdlib-jdk8"))
}
}
val jvmTest by getting {
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
}
}
val jsMain by getting {
dependencies {
implementation(kotlin("stdlib-js"))
}
}
val jsTest by getting {
dependencies {
implementation(kotlin("test-js"))
}
}
val linuxX64Main by getting { }
val mingwX64Main by getting { }
val appleOnlySourceSets = if (isMacOs()) {
val macosX64Main by getting { }
val macosArm64Main by getting { }
val iosArm64Main by getting { }
val iosX64Main by getting { }
listOf(macosX64Main, macosArm64Main, iosArm64Main, iosX64Main)
} else {
listOf()
}
val nativeMain by sourceSets.creating {
dependsOn(commonMain)
linuxX64Main.dependsOn(this)
mingwX64Main.dependsOn(this)
appleOnlySourceSets.forEach { it.dependsOn(this) }
}
}
}
fun isMacOs() = org.gradle.internal.os.OperatingSystem.current().isMacOsX
fun publishUrl(): String {
val base = "https://maven.danielgergely.com/"
val repository = if (version.toString().contains("SNAPSHOT", ignoreCase = true)) {
"snapshots"
} else {
"releases"
}
return base + repository
}
publishing {
repositories {
maven {
url = uri(publishUrl())
credentials {
username = getLocalProperty("MAVEN_PUBLISH_USER")
password = getLocalProperty("MAVEN_PUBLISH_PASS")
}
}
}
}