-
Notifications
You must be signed in to change notification settings - Fork 62
/
build.gradle
97 lines (78 loc) · 2.32 KB
/
build.gradle
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
plugins {
id 'me.him188.maven-central-publish' version "1.0.0-dev-3"
id 'java'
}
group 'org.itxtech'
version '2.1.2'
description '模块化、轻量级且支持完全自定义的 mirai 加载器。'
repositories {
mavenCentral()
}
dependencies {
implementation('commons-cli:commons-cli:1.5.0')
implementation('com.google.code.gson:gson:2.10')
implementation('org.fusesource.jansi:jansi:2.4.0')
}
def getGitHash = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
}
task fatJar(type: Jar) {
from sourceSets.main.output
archiveClassifier.set("all")
archiveFileName = "mcl.jar"
manifest {
attributes "Main-Class": "org.itxtech.mcl.Loader"
attributes "Version": project.version + "-" + getGitHash()
attributes "Launcher-Agent-Class": "org.itxtech.mcl.Agent"
attributes "Agent-Class": "org.itxtech.mcl.Agent"
attributes "Premain-Class": "org.itxtech.mcl.Agent"
}
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
exclude("META-INF/LICENSE.txt", "META-INF/NOTICE.txt", "META-INF/NOTICE-tools.txt")
}
task launchTest(type: JavaExec) {
dependsOn(fatJar)
jvmArgs(
'-Dmcl.no-ansi-console-init=true',
)
mainClass.set('-jar')
args(fatJar.outputs.files.singleFile)
def wk = project.file('testing')
workingDir(wk)
doFirst { wk.mkdirs() }
}
task zipAll(type: Zip) {
dependsOn(fatJar)
from fileTree(dir: ".", includes: ["README.md", "LICENSE", "mcl", "mcl.cmd"])
from("$buildDir/libs") {
include "mcl.jar"
rename { "mcl.jar" }
}
destinationDirectory = file("$buildDir/libs")
archiveFileName = "mcl-${project.version}.zip"
}
assemble.dependsOn(fatJar)
assemble.dependsOn(zipAll)
mavenCentralPublish {
singleDevGithubProject("iTXTech", "mirai-console-loader")
licenseAGplV3()
useCentralS01()
publication {
artifacts.artifact(tasks.getByName("zipAll"))
artifacts.artifact(tasks.getByName("fatJar"))
}
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}