-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
120 lines (104 loc) · 3.2 KB
/
Copy pathbuild.gradle
File metadata and controls
120 lines (104 loc) · 3.2 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
import java.text.SimpleDateFormat
plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'java'
}
group = "com.uxzylon.custommodeltools"
static def getTime() {
SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd-HHmm")
sdf.setTimeZone(TimeZone.getTimeZone("UTC"))
return sdf.format(new Date()).toString()
}
// Set version to version property if supplied
String shortVersion = null
if (hasProperty('ver')) {
if (ver.charAt(0) == "v") {
shortVersion = ver.substring(1).toUpperCase()
} else {
shortVersion = ver.toUpperCase()
}
}
// If the tag includes "-RC-" or no tag is supplied, append "-SNAPSHOT"
int rcIdx
if (shortVersion == null || shortVersion == "") {
version = getTime() + "-SNAPSHOT"
} else if ((rcIdx = shortVersion.indexOf("-RC-")) != -1) {
version = shortVersion.substring(0, rcIdx) + "-SNAPSHOT"
} else {
version = shortVersion
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
repositories {
/*maven {
name 'papermc'
url 'https://repo.papermc.io/repository/maven-public/'
content {
includeModule("io.papermc.paper", "paper-api")
includeModule("io.papermc", "paperlib")
includeModule("net.md-5", "bungeecord-chat")
}
}*/
maven {
name = 'spigot'
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
content {
includeGroup 'org.bukkit'
includeGroup 'org.spigotmc'
}
}
maven {
name = 'minecraft-repo'
url = 'https://libraries.minecraft.net/'
}
maven {
name = 'jetbrains'
url "https://packages.jetbrains.team/maven/p/jcs/maven"
}
mavenCentral()
}
dependencies {
// compileOnly 'io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT'
compileOnly 'org.spigotmc:spigot-api:1.20.2-R0.1-SNAPSHOT'
compileOnly 'org.jetbrains:annotations:24.0.0'
compileOnly 'com.mojang:authlib:1.6.25'
implementation "org.glassfish.jaxb:jaxb-runtime:2.3.2"
// implementation 'io.papermc:paperlib:1.0.8'
// testImplementation 'io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT'
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.9.3'
}
test {
useJUnitPlatform()
}
processResources {
filesMatching("**/plugin.yml") {
expand ( NAME: rootProject.name, VERSION: version, PACKAGE: project.group.toString() )
}
}
shadowJar {
archiveClassifier.set('')
// relocate 'io.papermc.lib', 'shadow.io.papermc.paperlib'
minimize()
}
// Disable jar and replace with shadowJar
jar.enabled = false
assemble.dependsOn(shadowJar)
tasks.register('printProjectName') {
doLast {
println rootProject.name
}
}
tasks.register('release') {
dependsOn build
doLast {
if (!version.endsWith("-SNAPSHOT")) {
// Rename final JAR to trim off version information
shadowJar.archiveFile.get().getAsFile()
.renameTo(layout.buildDirectory.get().toString() + File.separator + 'libs' + File.separator
+ rootProject.name + '.jar')
}
}
}