-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
139 lines (119 loc) · 2.76 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
plugins {
id 'java-library'
id 'maven-publish'
id 'checkstyle'
}
def ENV = System.getenv()
group = 'org.mcphackers'
version = 1.1
if(!ENV.RELEASE.equals('1')) {
project.version += '-SNAPSHOT'
}
def asm_version = 9.7
def depends = [
"org.ow2.asm:asm:${asm_version}",
"org.ow2.asm:asm-util:${asm_version}",
"org.ow2.asm:asm-tree:${asm_version}",
"org.json:json:20240303"
]
dependencies {
testRuntimeOnly('org.junit.platform:junit-platform-launcher:1.5.2')
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.0.0'
if(JavaVersion.current().isJava9Compatible()) {
compileOnly "me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0" // sun.misc.Unsafe
}
}
test {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
events = ["passed", "failed", "skipped"]
// showStandardStreams = true
}
}
checkstyle {
configFile = file('checkstyle.xml')
}
subprojects {
apply plugin: 'java'
project.group = rootProject.group
project.version = rootProject.version
dependencies {
implementation rootProject
runtimeOnly rootProject.sourceSets.test.output
}
}
allprojects {
apply plugin: 'java'
apply plugin: 'maven-publish'
repositories {
maven {
url "https://libraries.minecraft.net/"
}
maven {
url "https://maven.glass-launcher.net/releases"
}
mavenCentral()
}
dependencies {
depends.each { depend -> implementation depend }
}
task sourcesJar(type: Jar) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives jar
archives sourcesJar
}
java {
if (JavaVersion.current().isJava9Compatible()) {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
} else {
// Minecraft is mostly compatible with java 5 up until the version we support, so why not?
sourceCompatibility = JavaVersion.VERSION_1_5
targetCompatibility = JavaVersion.VERSION_1_5
}
}
compileJava {
options.encoding = "UTF-8"
options.compilerArgs += ["-Werror"]
options.fork = true
// Target Java 8 on newer JDKs
if (JavaVersion.current().isJava9Compatible()) {
options.release.set(8)
} else {
// Suppress sun.misc.Unsafe and -target 1.5 warnings on Java 8
options.compilerArgs += ["-XDenableSunApiLintControl", "-Xlint:-options"]
}
}
compileTestJava {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
afterEvaluate {
publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
artifact sourcesJar
}
}
repositories {
mavenLocal()
if (ENV.MAVEN_URL) {
maven {
url ENV.MAVEN_URL
if (ENV.MAVEN_USERNAME) {
credentials {
username ENV.MAVEN_USERNAME
password ENV.MAVEN_PASSWORD
}
}
}
}
}
}
}
}