This repository was archived by the owner on Jun 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
46 lines (36 loc) · 1.37 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
46 lines (36 loc) · 1.37 KB
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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
fun getVersionName(tagName: String) = if(tagName.startsWith("v")) tagName.substring(1) else tagName
val gitTagName: String? get() = Regex("(?<=refs/tags/).*").find(System.getenv("GITHUB_REF") ?: "")?.value
val gitCommitSha: String? get() = System.getenv("GITHUB_SHA") ?: null
val debugVersion: String get() = System.getenv("DBG_VERSION") ?: "0.0.0"
group = "com.github.balloonupdate"
version = gitTagName?.run { getVersionName(this) } ?: debugVersion
plugins {
kotlin("jvm") version "1.7.10"
id("com.github.johnrengelman.shadow") version "7.1.2"
}
repositories {
mavenCentral()
}
dependencies {
implementation("org.yaml:snakeyaml:1.33")
implementation("org.nanohttpd:nanohttpd:2.3.1")
implementation("org.nanohttpd:nanohttpd-webserver:2.3.1")
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
tasks.withType<ShadowJar> {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
manifest {
attributes("Version" to archiveVersion.get())
attributes("Git-Commit" to (gitCommitSha ?: ""))
attributes("Main-Class" to "MiniHttpServer")
}
// 打包源代码
sourceSets.main.get().allSource.sourceDirectories.map {
from(it) {into("sources/"+it.name) }
}
archiveClassifier.set("")
}