-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
80 lines (65 loc) · 2.02 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
plugins {
id 'io.freefair.lombok' version '6.5.0.3' apply false
}
allprojects {
group = 'com.tisawesomeness'
version = '0.3.0'
}
subprojects {
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'io.freefair.lombok'
dependencies {
implementation 'com.google.code.findbugs:jsr305:3.0.2'
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.0'
testImplementation 'org.assertj:assertj-core:3.23.1'
}
test {
useJUnitPlatform()
}
def targetJavaVersion = 17
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
it.options.release = targetJavaVersion
}
}
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
processResources {
inputs.property "version", project.version
filteringCharset "UTF-8"
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
}
def outputTasks() {
[":bp-spigot:shadowJar", ":bp-fabric:remapJar"].stream().map({ tasks.findByPath(it) })
}
task copyToOutput(type: Copy) {
outputTasks().forEach {
from(it)
}
rename '(.*)-all.jar', '$1.jar'
into 'build/libs'
}
task cleanOutput() {
delete 'build/libs'
}
task clean() {
dependsOn cleanOutput
}
task build() {
dependsOn copyToOutput
}