-
Notifications
You must be signed in to change notification settings - Fork 81
/
Copy pathbuild.gradle.kts
109 lines (90 loc) · 3.47 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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import net.mamoe.mirai.console.gradle.BuildMiraiPluginV2
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
kotlin("jvm") version "1.9.24"
kotlin("plugin.serialization") version "1.9.24" apply false
kotlin("plugin.lombok") version "2.0.21" apply false
id("com.gradleup.shadow") version ("8.3.5") apply false
id("net.mamoe.mirai-console") version ("2aa96098bb") apply false
}
val releasePath: File = rootProject.layout.buildDirectory.get().asFile.resolve("releases").absoluteFile
tasks.register<Jar>("sourceJar") {
group = JavaBasePlugin.BUILD_TASK_NAME
description = "build source jar"
from(subprojects.map { it.sourceSets["main"].allSource })
archiveClassifier.set("sources")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
destinationDirectory = releasePath
}
tasks.register("setReleaseOutputPath") {
group = JavaBasePlugin.BUILD_TASK_NAME
description = "set release jars name and output path"
if (!releasePath.exists()) releasePath.mkdirs()
project(":bot:onebot-petpet").tasks.named<ShadowJar>("shadowJar") {
archiveBaseName.set("petpet-onebot")
archiveClassifier.set("")
destinationDirectory.set(releasePath)
}
project(":httpserver").tasks.named<ShadowJar>("shadowJar") {
archiveBaseName.set("petpet-http-server")
archiveClassifier.set("")
destinationDirectory.set(releasePath)
}
project(":bot:mirai-petpet").tasks.named<BuildMiraiPluginV2>("buildPlugin") {
archiveBaseName.set("petpet")
destinationDirectory.set(releasePath)
}
}
tasks.register("releaseJars") {
group = JavaBasePlugin.BUILD_TASK_NAME
description = "test and build release jars"
dependsOn("test")
dependsOn("setReleaseOutputPath")
dependsOn(":bot:mirai-petpet:buildPlugin")
dependsOn(":bot:onebot-petpet:shadowJar")
dependsOn(":httpserver:shadowJar")
dependsOn("sourceJar")
}
// TODO: buildSrc
allprojects {
apply(plugin = "java")
apply(plugin = "kotlin")
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "org.jetbrains.kotlin.plugin.serialization")
apply(plugin = "org.jetbrains.kotlin.plugin.lombok")
group = "moe.dituon.petpet"
version = "1.0.0-beta1"
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlin {
compilerOptions {
compilerOptions.jvmTarget.set(JvmTarget.JVM_11)
}
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")
compileOnly("org.projectlombok:lombok:1.18.34")
annotationProcessor("org.projectlombok:lombok:1.18.34")
testCompileOnly("org.projectlombok:lombok:1.18.34")
testAnnotationProcessor("org.projectlombok:lombok:1.18.34")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.1")
implementation("org.jetbrains:annotations:26.0.1")
implementation("org.slf4j:slf4j-api:2.0.16")
testImplementation("ch.qos.logback:logback-classic:1.5.15")
}
tasks.named<Test>("test") {
useJUnitPlatform()
}
repositories {
maven { setUrl("https://maven.aliyun.com/repository/public") }
maven { setUrl("https://jitpack.io") }
mavenCentral()
}
}