forked from ServerOpenMC/PluginV2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
133 lines (112 loc) · 4.14 KB
/
build.gradle
File metadata and controls
133 lines (112 loc) · 4.14 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
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
plugins {
id 'java'
id "com.gradleup.shadow" version "9.0.1"
id "io.papermc.paperweight.userdev" version "${paperWeightUserDevVersion}"
id("xyz.jpenilla.run-paper") version "2.3.1" // Will use ${minecraftVersion} for the paper version
}
def getLatestGitTag() {
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags', '--abbrev=0'
standardOutput = stdout
}
return stdout.toString().trim()
} catch (Exception ignored) {
return "unknown" // Default value if no tags exist
}
}
// Versioning
def tag = System.getenv("TAG") ?: getLatestGitTag()
def isSnapshot = System.getenv('SNAPSHOT')?.toBoolean() ?: false
def gitHash = System.getenv('GITHUB_SHA') ?: 'local'
version = isSnapshot ? "$tag-SNAPSHOT-${gitHash.take(7)}" : (System.getenv("TAG") ? tag : "dev-$tag")
group = 'fr.openmc'
repositories {
mavenCentral()
maven {
url "https://maven.devs.beer/"
}
maven {
url "https://repo.fancyinnovations.com/releases"
}
maven {
url "https://maven.enginehub.org/repo/"
}
maven {
url "https://repo.extendedclip.com/content/repositories/placeholderapi/"
}
maven {
url "https://repo.dmulloy2.net/repository/public/"
}
maven {
url "https://jitpack.io" // Toujours à la fin
}
}
dependencies {
paperweight.paperDevBundle "${minecraftVersion}-R0.1-SNAPSHOT"
compileOnly "com.sk89q.worldguard:worldguard-bukkit:${worldguardVersion}"
compileOnly "dev.lone:api-itemsadder:${itemsAdderVersion}"
compileOnly "net.luckperms:api:${luckpermsVersion}"
compileOnly "me.clip:placeholderapi:${placeholderApiVersion}"
compileOnly "com.sk89q.worldedit:worldedit-bukkit:${worldeditVersion}"
compileOnly "de.oliver:FancyNpcs:${fancyNpcsVersion}"
compileOnly "net.dmulloy2:ProtocolLib:${protocolLibVersion}"
implementation "org.jetbrains:annotations:${jetbrainsAnnotationsVersion}"
implementation "io.github.revxrsal:lamp.common:${revxrsalLampVersion}"
implementation "io.github.revxrsal:lamp.bukkit:${revxrsalLampVersion}"
implementation "com.j256.ormlite:ormlite-jdbc:${ormVersion}"
compileOnly "org.projectlombok:lombok:${lombokVersion}"
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
testCompileOnly "org.projectlombok:lombok:${lombokVersion}"
testAnnotationProcessor "org.projectlombok:lombok:${lombokVersion}"
testImplementation "org.slf4j:slf4j-simple:${slf4jVersion}"
testImplementation "org.junit.jupiter:junit-jupiter:${junitVersion}"
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
testImplementation paperweight.paperDevBundle("${minecraftVersion}-R0.1-SNAPSHOT")
testImplementation "org.mockbukkit.mockbukkit:mockbukkit-v1.21:${mockbukkitVersion}"
testImplementation "com.h2database:h2:${h2DatabaseVersion}"
}
def targetJavaVersion = 21
java {
sourceCompatibility = targetJavaVersion
targetCompatibility = targetJavaVersion
}
paperweight {
addServerDependencyTo = configurations.named(JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME).map { [it] as Set }
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.release = targetJavaVersion
}
processResources {
filteringCharset = 'UTF-8'
def pluginProps = ["version": version, "minecraftVersion": minecraftVersion]
inputs.properties(pluginProps)
filesMatching('paper-plugin.yml') {
expand(pluginProps)
}
filesMatching('data/motd.yml') {
expand(pluginProps)
}
}
tasks.jar {
manifest {
attributes 'GIT-COMMIT': gitHash
}
destinationDirectory.set(file('./builds/'))
}
tasks.clean {
delete 'builds'
}
tasks.shadowJar {
destinationDirectory.set(file('./builds/'))
archiveFileName.set('OpenMC.jar')
relocate("org.jetbrains.annotations", "fr.openmc.shaded.org.jetbrains.annotations")
relocate("org.intellij", "fr.openmc.shaded.org.intellij")
relocate("revxrsal.commands", "fr.openmc.shaded.revxrsal.commands")
relocate("com.j256.ormlite", "fr.openmc.shaded.com.j256.ormlite")
}
tasks.test {
useJUnitPlatform()
}