-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
161 lines (143 loc) · 4.72 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
val ktor_version: String by project
val kotlin_version: String by project
val kotlinx_json_serialization_version: String by project
plugins {
kotlin("multiplatform") version "1.5.31"
kotlin("plugin.serialization") version "1.5.31"
id("com.github.hierynomus.license") version "0.16.1"
id("maven-publish")
}
group = "com.koresframework"
version = "0.1.11"
repositories {
mavenCentral()
}
val hostOs = System.getProperty("os.name")
val isLinux = hostOs.equals("linux", ignoreCase = true)
kotlin {
jvm {
compilations.all {
kotlinOptions.jvmTarget = "16"
}
testRuns["test"].executionTask.configure {
useJUnit()
}
withJava()
}
js(IR) {
browser {
commonWebpackConfig {
cssSupport.enabled = true
}
}
nodejs {
}
}
val macos = macosX64("macos64")
val linux = linuxX64("linux64")
val windows = mingwX64("mingw64")
configure(listOf(macos, linux, windows)) {
}
sourceSets {
val commonMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinx_json_serialization_version")
implementation("io.ktor:ktor-client-serialization:$ktor_version")
implementation("io.ktor:ktor-client-core:$ktor_version")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
val jvmMain by getting {
}
val jvmTest by getting {
dependencies {
implementation("io.ktor:ktor-client-cio:$ktor_version")
implementation("io.ktor:ktor-client-mock:$ktor_version")
implementation(kotlin("test-junit"))
}
}
val jsMain by getting {
}
val jsTest by getting {
dependencies {
implementation("io.ktor:ktor-client-js:$ktor_version")
implementation(kotlin("test-js"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2")
}
}
val macos64Main by getting {
}
val linux64Main by getting {
}
val mingw64Main by getting {
}
val macos64Test by getting
val linux64Test by getting {
if (isLinux) {
dependencies {
implementation("io.ktor:ktor-client-curl:$ktor_version")
}
}
}
val mingw64Test by getting
val nativeMain by sourceSets.creating {
dependsOn(commonMain)
macos64Main.dependsOn(this)
linux64Main.dependsOn(this)
mingw64Main.dependsOn(this)
}
val nativeTest by sourceSets.creating {
dependsOn(commonTest)
macos64Test.dependsOn(this)
linux64Test.dependsOn(this)
mingw64Test.dependsOn(this)
}
}
val publicationsFromMainHost =
listOf(jvm(), js(), linux).map { it.name } + "kotlinMultiplatform"
publishing {
repositories {
maven {
// change to point to your repo, e.g. http://my.org/repo
url = uri("$buildDir/repo")
}
maven {
name = "GitLab"
url = uri("https://gitlab.com/api/v4/projects/30890788/packages/maven")
credentials(HttpHeaderCredentials::class) {
val ciToken = System.getenv("CI_JOB_TOKEN")
if (ciToken != null && ciToken.isNotEmpty()) {
name = "Job-Token"
value = System.getenv("CI_JOB_TOKEN")
} else {
name = "Private-Token"
value = project.findProperty("GITLAB_TOKEN")?.toString() ?: System.getenv("GITLAB_TOKEN")
}
}
authentication {
val header by registering(HttpHeaderAuthentication::class)
}
}
}
publications {
matching { it.name in publicationsFromMainHost }.all {
val targetPublication = this@all
tasks.withType<AbstractPublishToMaven>()
.matching { it.publication == targetPublication }
.configureEach { onlyIf { isLinux } }
}
}
}
}
tasks {
withType<nl.javadude.gradle.plugins.license.License> {
header = rootProject.file("LICENSE")
strictCheck = true
this.setSource(fileTree("src").include("**/*.kt"))
}
}