forked from mamoe/mirai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
136 lines (116 loc) · 5.21 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
@file:Suppress("UNUSED_VARIABLE")
plugins {
kotlin("multiplatform")
id("kotlinx-atomicfu")
kotlin("plugin.serialization")
id("signing")
`maven-publish`
id("com.jfrog.bintray") version Versions.Publishing.bintray
}
description = "Mirai API module"
val isAndroidSDKAvailable: Boolean by project
kotlin {
if (isAndroidSDKAvailable) {
apply(from = rootProject.file("gradle/android.gradle"))
android("android") {
publishAllLibraryVariants()
}
} else {
println(
"""Android SDK 可能未安装.
$name 的 Android 目标编译将不会进行.
这不会影响 Android 以外的平台的编译.
""".trimIndent()
)
println(
"""Android SDK might not be installed.
Android target of $name will not be compiled.
It does no influence on the compilation of other platforms.
""".trimIndent()
)
}
jvm() {
// withJava() // https://youtrack.jetbrains.com/issue/KT-39991
}
sourceSets {
all {
languageSettings.enableLanguageFeature("InlineClasses")
languageSettings.useExperimentalAnnotation("kotlin.Experimental")
languageSettings.useExperimentalAnnotation("net.mamoe.mirai.utils.MiraiInternalAPI")
languageSettings.useExperimentalAnnotation("net.mamoe.mirai.utils.MiraiExperimentalAPI")
languageSettings.useExperimentalAnnotation("net.mamoe.mirai.LowLevelAPI")
languageSettings.useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes")
languageSettings.useExperimentalAnnotation("kotlin.experimental.ExperimentalTypeInference")
languageSettings.useExperimentalAnnotation("kotlin.time.ExperimentalTime")
languageSettings.useExperimentalAnnotation("kotlin.contracts.ExperimentalContracts")
languageSettings.progressiveMode = true
}
commonMain {
dependencies {
api(kotlin("stdlib"))
api(kotlin("serialization"))
api(kotlin("reflect"))
api(kotlinx("serialization-runtime-common", Versions.Kotlin.serialization))
api(kotlinx("serialization-protobuf-common", Versions.Kotlin.serialization))
api(kotlinx("io", Versions.Kotlin.io))
api(kotlinx("coroutines-io", Versions.Kotlin.coroutinesIo))
api(kotlinx("coroutines-core-common", Versions.Kotlin.coroutines))
api("org.jetbrains.kotlinx:atomicfu-common:${Versions.Kotlin.atomicFU}")
api(ktor("client-cio", Versions.Kotlin.ktor))
api(ktor("client-core", Versions.Kotlin.ktor))
api(ktor("network", Versions.Kotlin.ktor))
}
}
commonTest {
dependencies {
implementation(kotlin("test-annotations-common"))
implementation(kotlin("test-common"))
}
}
if (isAndroidSDKAvailable) {
val androidMain by getting {
dependencies {
api(kotlin("reflect"))
api(kotlinx("io-jvm", Versions.Kotlin.io))
api(kotlinx("serialization-runtime", Versions.Kotlin.serialization))
api(kotlinx("serialization-protobuf", Versions.Kotlin.serialization))
api(kotlinx("coroutines-io-jvm", Versions.Kotlin.coroutinesIo))
api(kotlinx("coroutines-core", Versions.Kotlin.coroutines))
api(ktor("client-android", Versions.Kotlin.ktor))
}
}
val androidTest by getting {
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
implementation(kotlin("test-annotations-common"))
implementation(kotlin("test-common"))
}
}
}
val jvmMain by getting {
dependencies {
//api(kotlin("stdlib-jdk8"))
//api(kotlin("stdlib-jdk7"))
api(kotlin("reflect"))
api(ktor("client-core-jvm", Versions.Kotlin.ktor))
api(kotlinx("io-jvm", Versions.Kotlin.io))
api(kotlinx("serialization-runtime", Versions.Kotlin.serialization))
api(kotlinx("serialization-protobuf", Versions.Kotlin.serialization))
api(kotlinx("coroutines-io-jvm", Versions.Kotlin.coroutinesIo))
api(kotlinx("coroutines-core", Versions.Kotlin.coroutines))
api("org.bouncycastle:bcprov-jdk15on:1.64")
runtimeOnly(files("build/classes/kotlin/jvm/main")) // classpath is not properly set by IDE
}
}
val jvmTest by getting {
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
implementation("org.pcap4j:pcap4j-distribution:1.8.2")
runtimeOnly(files("build/classes/kotlin/jvm/test")) // classpath is not properly set by IDE
}
}
}
}
apply(from = rootProject.file("gradle/publish.gradle"))