-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
99 lines (84 loc) · 3.56 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
plugins {
id 'java'
id 'io.freefair.lombok' version '5.2.1'
}
group 'com.timelost.TimeVault'
version '1.0.0'
def apiVersion = '1.18'
def main = 'com.timelost.timevault.TimeVault'
def name = 'TimeVault'
// ======================== WINDOWS =============================
registerCustomOutputTask('Psycho', 'D://Dan/MinecraftDevelopment/server/plugins')
registerCustomOutputTask('Vatuu', 'D://Minecraft/Servers/1.18.2/plugins')
// ========================== UNIX ==============================
registerCustomOutputTaskUnix('PsychoLT', '/Users/brianfopiano/Desktop/REMOTES/RemoteMinecraft/plugins')
// ==============================================================
file(jar.archiveFile.get().getAsFile().getParentFile().getParentFile().getParentFile().getAbsolutePath() + '/build/resources/main/plugin.yml').delete()
repositories {
maven { url "https://dl.cloudsmith.io/public/arcane/archive/maven/" }
mavenCentral()
mavenLocal()
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.18.22'
annotationProcessor 'org.projectlombok:lombok:1.18.22'
implementation 'org.spigotmc:spigot:1.18.2-R0.1-SNAPSHOT'
implementation 'com.google.code.gson:gson:2.9.0'
}
processResources {
filesMatching('**/plugin.yml') {
expand(
'name': name.toString(),
'version': version.toString(),
'main': main.toString(),
'apiversion': apiVersion.toString()
)
}
}
def registerCustomOutputTask(name, path) {
if (!System.properties['os.name'].toLowerCase().contains('windows')) {
return;
}
tasks.register('build' + name, Copy) {
group('development')
outputs.upToDateWhen { false }
dependsOn(jar)
from(new File(buildDir, "libs/TimeVault-" + version + ".jar"))
into(file(path))
rename { String fileName ->
fileName.replace("TimeVault-" + version + ".jar", "TimeVault.jar")
}
}
}
def registerCustomOutputTaskUnix(name, path) {
if (System.properties['os.name'].toLowerCase().contains('windows')) {
return;
}
tasks.register('build' + name, Copy) {
group('development')
outputs.upToDateWhen { false }
dependsOn(jar)
from(new File(buildDir, "libs/TimeVault-" + version + ".jar"))
into(file(path))
rename { String fileName ->
fileName.replace("TimeVault-" + version + ".jar", "TimeVault.jar")
}
}
}
if (JavaVersion.current().toString() != "17") {
System.err.println()
System.err.println("=========================================================================================================")
System.err.println("You must run gradle on Java 17. You are using " + JavaVersion.current())
System.err.println()
System.err.println("=== For IDEs ===")
System.err.println("1. Configure the project for Java 17")
System.err.println("2. Configure the bundled gradle to use Java 17 in settings")
System.err.println()
System.err.println("=== For Command Line (gradlew) ===")
System.err.println("1. Install JDK 17 from https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html")
System.err.println("2. Set JAVA_HOME environment variable to the new jdk installation folder such as C:\\Program Files\\Java\\jdk-17.0.1")
System.err.println("3. Open a new command prompt window to get the new environment variables if need be.")
System.err.println("=========================================================================================================")
System.err.println()
System.exit(69);
}