forked from davidepianca98/KMQTT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
134 lines (125 loc) · 3.96 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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
kotlin("multiplatform") version "1.4.0"
kotlin("plugin.serialization") version "1.4.0"
id("maven-publish")
id("com.github.johnrengelman.shadow") version "5.2.0"
}
group = "com.github.davidepianca98"
version = "0.2.3"
val serializationVersion: String by project
repositories {
mavenCentral()
jcenter()
maven(url = "https://kotlin.bintray.com/kotlinx")
}
kotlin {
jvm {
compilations["main"].kotlinOptions {
// Setup the Kotlin compiler options for the 'main' compilation:
jvmTarget = "1.8"
}
compilations["test"].kotlinOptions {
// Setup the Kotlin compiler options for the 'test' compilation:
jvmTarget = "1.8"
}
}
mingwX64 {
compilations.getByName("main") {
val openssl by cinterops.creating {
packageName("openssl")
}
}
binaries {
executable {
linkerOpts = mutableListOf("-Lsrc/nativeInterop/cinterop/opensslLibs/mingwX64", "-lssl", "-lcrypto")
}
}
}
linuxX64 {
binaries {
executable()
}
}
linuxArm32Hfp {
binaries {
executable()
}
}
sourceSets {
all {
languageSettings.apply {
useExperimentalAnnotation("kotlinx.serialization.ExperimentalSerializationApi")
useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes")
}
}
commonMain {
dependencies {
implementation(kotlin("stdlib-common"))
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$serializationVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-protobuf:$serializationVersion")
}
}
commonTest {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
val jvmMain by getting {
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("dnsjava:dnsjava:3.2.2")
}
}
val jvmTest by getting {
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
implementation("com.hivemq:hivemq-mqtt-client:1.2.1")
}
}
val posixMain by creating {
dependsOn(commonMain.get())
}
val mingwX64Main by getting {
dependsOn(posixMain)
}
val linuxX64Main by getting {
dependsOn(posixMain)
dependencies {
implementation(files("src/nativeInterop/openssl-linux-x64.klib"))
}
}
val linuxArm32HfpMain by getting {
dependsOn(posixMain)
dependencies {
implementation(files("src/nativeInterop/openssl-linux-arm32-hfp.klib"))
}
}
}
}
task("shadowJar", ShadowJar::class) {
manifest.attributes["Main-Class"] = "MainKt"
from(kotlin.targets["jvm"].compilations["main"].output)
val runtimeClasspath =
(kotlin.targets["jvm"].compilations["main"] as org.jetbrains.kotlin.gradle.plugin.KotlinCompilationToRunnableFiles).runtimeDependencyFiles
configurations = mutableListOf(runtimeClasspath as Configuration)
}
tasks {
build {
dependsOn("shadowJar")
}
}
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/davidepianca98/KMQTT")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_USERNAME")
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_PACKAGES")
}
}
}
}