forked from Prunoideae/ProbeJS-Forge
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
102 lines (86 loc) · 3.45 KB
/
build.gradle
File metadata and controls
102 lines (86 loc) · 3.45 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
plugins {
id('com.gradleup.shadow').version('9.2.2')
id('idea')
}
apply from: 'gradle/scripts/helpers.gradle'
final props = project.properties
final sysProps = System.getProperties()
if (project.hasProperty("run_number")) {
println("On GitHub runs #${props['run_number']}")
}
println("Gradle running on Java: ${ -> sysProps['java.version']} | JVM: ${ -> sysProps['java.vm.version']} | Vendor: ${ -> sysProps['java.vendor']} | Architecture: ${ -> sysProps['os.arch']}")
version = propertyString('mod_version')
group = propertyString('maven_group')
configurations.configureEach {
resolutionStrategy.eachDependency {
if (requested.group == "org.ow2.asm") {
useVersion("9.6")
because("Force ASM to a modern version that supports Java 21")
}
if (requested.group == "org.lwjgl") {
useVersion("3.3.3")
because("Force LWJGL to a modern version that supports Java 21")
}
}
}
subprojects {
apply(plugin: "java")
apply(plugin: "com.gradleup.shadow")
configurations {
shade
implementation.extendsFrom(shade)
}
assemble.dependsOn(shadowJar)
shadowJar {
configurations = [project.configurations.shade]
}
dependencies {
def vers = propertyString("lombok_version")
compileOnly("org.projectlombok:lombok:${vers}")
annotationProcessor("org.projectlombok:lombok:${vers}")
testCompileOnly("org.projectlombok:lombok:${vers}")
testAnnotationProcessor("org.projectlombok:lombok:${vers}")
if (propertyBool('enable_junit')) {
testImplementation("org.junit.jupiter:junit-jupiter:$junit_version")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
}
if (propertyBool('enable_junit')) {
test {
useJUnitPlatform()
}
}
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.
options.encoding = "UTF-8"
// very few developers will provide source jar when publishing mods, we add param names in production jar
// to make life easier for those whose mod depend on this mod
options.compilerArgs << '-parameters'
}
jar {
// add some additional metadata to the jar manifest
manifest {
attributes([
"Specification-Title" : propertyString("mod_id"),
"Specification-Vendor" : propertyString("mod_author"),
"Specification-Version" : "1",
"Implementation-Title" : propertyString("mod_display_name"),
"Implementation-Version" : project.version,
"Implementation-Vendor" : propertyString("mod_author"),
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
tasks.register("printArchiveClassifiers") {
it.doFirst {
for (final def task in tasks) {
if (task instanceof AbstractArchiveTask) {
println("task=${task.name}, archiveClassifier=${task.archiveClassifier.get()}")
}
}
}
}
}