-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.gradle
101 lines (85 loc) · 2.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
100
101
plugins {
id 'java'
id 'eclipse'
id 'net.minecraftforge.gradle' version '[6.0.16,6.2)'
id 'me.hypherionmc.cursegradle' version '2.+'
}
archivesBaseName = "${mod_name}-${minecraft_version}"
version = mod_version
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + ' (' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
minecraft {
mappings channel: 'official', version: minecraft_version
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
configureEach {
workingDirectory project.file('run')
}
client {
taskName "${project.name}Client"
}
server {
taskName "${project.name}Server"
}
gameTestServer {
taskName "${project.name}GameTest"
property 'forge.enabledGameTestNamespaces', mod_id
}
data {
workingDirectory project.file('run-data')
taskName "${project.name}Data"
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
}
}
}
sourceSets.main.resources { srcDir 'src/generated/resources' }
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
}
tasks.named('jar', Jar).configure {
manifest {
attributes([
"Specification-Title": "${mod_id}",
"Specification-Vendor": "${author}",
"Specification-Version": "1",
"Implementation-Title": "${mod_name}",
"Implementation-Version": "${minecraft_version}-${version}",
"Implementation-Vendor": "${author}",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"Main-Class": "${main_class}"
])
}
}
tasks.named('processResources', ProcessResources).configure {
outputs.upToDateWhen {
false
}
from sourceSets.main.resources
filesMatching(['META-INF/mods.toml']) {
expand project.properties
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
curseforge {
apiKey = project.hasProperty("curse_api_key") ? curse_api_key : ''
project {
id = curse_project_id
changelog = file('changelog.txt').canRead() ? file('changelog.txt').text : ''
changelogType = 'text'
releaseType = 'release'
addGameVersion 'Forge'
forge_compatible_minecraft_versions.split(",").each {
addGameVersion(it)
}
mainArtifact(jar) {
displayName = "${minecraft_version}-${mod_version} Universal"
}
}
options {
javaVersionAutoDetect = false
forgeGradleIntegration = false
}
}