-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
148 lines (118 loc) · 4.82 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
140
141
142
143
144
145
146
147
148
plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'org.spongepowered.mixin' version '0.7.+'
}
version = (String)"${mc_version}-${mod_version}-${mod_build}"
group = (String)"$groupname"
archivesBaseName = modid
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
processResources {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
filteringCharset = 'UTF-8'
from (sourceSets.main.resources.srcDirs) {
filesNotMatching('**/*.png') {
filter {
String line -> line.replaceAll("BUILDTOKEN_MODID", "${modid}")
.replaceAll("BUILDTOKEN_VERSION", "${version}")
.replaceAll("BUILDTOKEN_VERSION", "${version}")
.replaceAll("BUILDTOKEN_MODNAME", "${modname}")
.replaceAll("BUILDTOKEN_AUTHORS", "${authors}")
.replaceAll("BUILDTOKEN_LOGOFILE", "${logofile}")
.replaceAll("BUILDTOKEN_URL", "${url}")
.replaceAll("BUILDTOKEN_ISSUES", "${issues}")
.replaceAll("BUILDTOKEN_MODDESCRIPTION", "${mod_description}")
.replaceAll("BUILDTOKEN_LICENSE", "${license}")
.replaceAll("BUILDTOKEN_FORGEVERSIONSHORT", "${forge_version_short}")
.replaceAll("BUILDTOKEN_MCVERSION", "${mc_version}")
}
}
}
}
// Copied from build.gradle in https://github.com/BluSunrize/ImmersiveEngineering
// When using "Run using IntelliJ" (the only option with well-working hotswapping) the used "resources" directory is
// different from the one used by gradle/the processResources task
tasks.register('copyModsTomlForIntelliJ', Copy) {
from processResources.destinationDir
into "$projectDir/out/production/resources"
include "META-INF/mods.toml"
}
copyModsTomlForIntelliJ.dependsOn processResources
afterEvaluate {
// prepareRuns doesn't exist before afterEvaluate
prepareRuns.dependsOn copyModsTomlForIntelliJ
}
minecraft {
mappings channel: 'official', version: "${mc_version}"
copyIdeResources = true
runs {
configureEach {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
// The markers can be added/remove as needed separated by commas.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
property 'forge.logging.markers', 'REGISTRIES'
// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
property 'forge.logging.console.level', 'debug'
mods {
"${modid}" {
source sourceSets.main
}
}
}
client {
arg "-mixin.config=handsoff.mixins.json"
property 'forge.enabledGameTestNamespaces', modid
}
server {
arg "-mixin.config=handsoff.mixins.json"
property 'forge.enabledGameTestNamespaces', modid
args '--nogui'
}
gameTestServer {
arg "-mixin.config=handsoff.mixins.json"
property 'forge.enabledGameTestNamespaces', modid
}
data {
workingDirectory project.file('run-data')
args '--mod', modid, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
}
}
}
sourceSets.main.resources { srcDir 'src/generated/resources' }
mixin {
add sourceSets.main, "handsoff.refmap.json"
}
repositories {
}
dependencies {
minecraft "net.minecraftforge:forge:${forge_version}"
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
}
jar {
manifest {
attributes([
"Specification-Title": modid,
"Specification-Vendor": project.group,
"Specification-Version": "1",
"Implementation-Title": project.name,
"Implementation-Version": project.jar.archiveVersion,
"Implementation-Vendor" : project.group,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"TweakClass": "org.spongepowered.asm.launch.MixinTweaker",
"TweakOrder": 0,
"MixinConfigs": "handsoff.mixins.json"
])
}
}
jar.finalizedBy('reobfJar')
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}