-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
64 lines (55 loc) · 1.83 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
@file:Suppress("UNUSED_VARIABLE")
plugins {
kotlin("multiplatform") version "1.5.31"
`maven-publish`
}
group = "city.windmill"
version = "0.1.0"
repositories {
mavenCentral()
}
kotlin {
val hostOs = System.getProperty("os.name")
val isMingwX64 = hostOs.startsWith("Windows")
val nativeTarget = when {
hostOs == "Mac OS X" -> macosX64("native")
hostOs == "Linux" -> linuxX64("native")
isMingwX64 -> mingwX64("native")
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}
nativeTarget.compilations.getByName("main").cinterops.create("jni") {
defFile(project.file("src/nativeMain/resources/jni/jni.def"))
headers(
project.files(
"src/nativeMain/resources/jni/jni.h",
"src/nativeMain/resources/jni/jni_md.h"
)
)
packageName("native.jni")
}
sourceSets {
val commonMain by getting
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val nativeMain by getting
val nativeTest by getting {
//Set the working path to where the jvm library locates, or cause failure in JavaVM.create
tasks["nativeTest"].setProperty("workingDir", "${System.getenv("JAVA_HOME")}/bin/server")
}
}
publishing {
repositories {
maven {
name = "GithubPackages"
url = uri("https://maven.pkg.github.com/Windmill-City/KNI")
credentials {
username = properties["gpr.user"]?.toString() ?: System.getenv("GITHUB_USERNAME")
password = properties["gpr.key"]?.toString() ?: System.getenv("GITHUB_TOKEN_PUBLISH_PKG")
}
}
}
}
}