-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
114 lines (93 loc) · 3.39 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
plugins {
id 'java'
id 'maven-publish'
id "com.github.johnrengelman.shadow" version "7.1.2"
id 'net.kyori.blossom' version "1.2.0"
}
repositories {
maven { url = uri('https://repo.fantasyrealms.net/other-snapshots') }
maven { url = uri('https://repo.fantasyrealms.net/other-libraries') }
maven { url = uri('https://repo.fantasyrealms.net/releases') }
maven { url = uri('https://repo.extendedclip.com/content/repositories/placeholderapi/') }
maven { url = uri('https://repo.glaremasters.me/repository/concuncan/') }
maven { url = uri('https://repo.maven.apache.org/maven2/') }
maven { url = uri('https://jitpack.io') }
mavenCentral()
mavenLocal()
}
def versionOnly = project.getProperty("version")
def versionWithGit = versionOnly + "-${getGitHash()}"
group = 'cc.happyareabean'
version = versionWithGit
description = 'SWMHook'
java.sourceCompatibility = JavaVersion.VERSION_1_8
String getGitHash() {
def output = new ByteArrayOutputStream()
exec {
standardOutput = output
commandLine 'git', 'rev-parse', '--short', 'HEAD'
}
return output.toString().trim()
}
String getDate() {
def date = new Date()
def formattedDate = date.format('yyyy.MM.dd')
return formattedDate
}
dependencies {
implementation 'de.exlll:configlib-core:2.2.1'
implementation 'com.github.Revxrsal.Lamp:common:3.1.2'
implementation 'com.github.Revxrsal.Lamp:bukkit:3.1.2'
implementation 'net.kyori:adventure-api:4.12.0'
implementation 'net.kyori:adventure-platform-bukkit:4.2.0'
implementation 'org.bstats:bstats-bukkit:3.0.0'
implementation 'org.semver4j:semver4j:4.3.0'
compileOnly 'org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT'
compileOnly 'org.spigotmc:spigot:1.8.8-R0.1-SNAPSHOT'
compileOnly 'me.clip:placeholderapi:2.10.10'
compileOnly 'com.grinderwolf:slimeworldmanager-api:2.2.1'
compileOnly 'com.grinderwolf:slimeworldmanager-plugin:2.2.1'
compileOnly "rip.diamond:Eden:1.1.4-1f8eb9a"
compileOnly 'org.projectlombok:lombok:1.18.24'
annotationProcessor 'org.projectlombok:lombok:1.18.24'
testCompileOnly 'org.projectlombok:lombok:1.18.24'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.24'
}
blossom {
def constants = "src/main/java/cc/happyareabean/swmhook/constants/Constants.java"
replaceToken("\${pluginVersion}", version.toString(), constants)
replaceToken("\${commit}", getGitHash().toString(), constants)
replaceToken("\${buildDate}", getDate().toString(), constants)
}
tasks.processResources {
expand("pluginVersion": project.version, "commit": getGitHash(), "buildDate": getDate())
}
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
shadowJar {
archiveClassifier.set('')
archiveVersion.set('')
}
tasks.register('relocateShadowJar', ConfigureShadowRelocation) {
target = tasks.shadowJar
prefix = "cc.happyareabean.swmhook.libs"
}
tasks.shadowJar.dependsOn tasks.relocateShadowJar
build {
finalizedBy {
tasks.shadowJar
}
}
compileJava { // Preserve parameter names in the bytecode
options.compilerArgs += ["-parameters"]
options.fork = true
options.forkOptions.executable = "javac"
options.encoding = 'UTF-8'
}
publishing {
publications {
maven(MavenPublication) { publication ->
project.shadow.component(publication)
version = versionOnly
}
}
}