-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
76 lines (63 loc) · 2.67 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
import java.util.regex.Pattern
plugins {
id 'java-library'
}
repositories {
mavenLocal()
maven {
url = uri('https://papermc.io/repo/repository/maven-public/')
}
maven {
url = uri('https://jitpack.io')
}
maven {
url = uri('https://repo.maven.apache.org/maven2/')
}
}
group = 'org.ships'
version = '1.0-SNAPSHOT'
description = 'CoreToFolia'
var targetMinecraftVersion = project.hasProperty("folia-api-version") ? (String) project.property("folia-api-version") : "1.20.1"
var targetMajorVersion = Integer.parseInt(targetMinecraftVersion.split(Pattern.quote('.'))[1])
var targetMinorVersion = Integer.parseInt(targetMinecraftVersion.split(Pattern.quote('.'))[2])
var targetJavaVersion = isGreater(20, 5) ? 21 : 17
java {
sourceCompatibility = JavaLanguageVersion.of(targetJavaVersion);
targetCompatibility = JavaLanguageVersion.of(targetJavaVersion);
}
compileJava.options.encoding = 'UTF-8'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
jar {
archiveClassifier = 'uber'
archiveFileName = "CoreToFolia.jar"
}
dependencies {
if (project.hasProperty("folia-api-version") && project.hasProperty("use-paper") && project.property("use-paper").toString().equals("true")) {
compileOnly 'io.papermc.paper:paper-api:' + project.property("folia-api-version") + "-R0.1-SNAPSHOT"
} else {
compileOnly 'dev.folia:folia-api:' + targetMinecraftVersion + '-R0.1-SNAPSHOT'
System.out.println("To specify a Folia build, use ' -P folia-api-version=1.20.1")
}
compileOnly 'com.github.MilkBowl:VaultAPI:1.7', { exclude group: 'org.bukkit', module: 'bukkit' }
try {
api project(":TranslateCore")
} catch (UnknownProjectException ignored) {
System.out.println("Could not find subModule of ShipsCore, using jit instead")
api 'com.github.Minecraft-Ships:TranslateCore:master-SNAPSHOT'
}
compileOnly group: 'net.kyori', name: 'examination-api', version: '1.1.0'
compileOnly group: 'net.kyori', name: 'adventure-api', version: '4.7.0'
compileOnly 'net.kyori:adventure-text-serializer-legacy:4.7.0'
compileOnly 'net.kyori:adventure-text-serializer-plain:4.7.0'
}
boolean isGreater(int major, int minor) {
var targetMinecraftVersion = project.hasProperty("folia-api-version") ? (String) project.property("folia-api-version") : "1.20.1"
var targetMajorVersion = Integer.parseInt(targetMinecraftVersion.split(Pattern.quote('.'))[1])
var targetMinorVersion = Integer.parseInt(targetMinecraftVersion.split(Pattern.quote('.'))[2])
if (targetMajorVersion < major) {
return true;
}
return targetMajorVersion == major && targetMinorVersion <= minor;
}