-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathbuild.gradle
executable file
·129 lines (113 loc) · 4.33 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
plugins {
id 'net.neoforged.gradle.userdev' version '7.0.145'
id "net.neoforged.gradle.mixin" version "7.0.145"
id 'com.matthewprenger.cursegradle' version '1.4.0'
id "com.modrinth.minotaur" version "2.4.5"
id 'de.undercouch.download' version '3.3.0'
id 'idea'
id 'eclipse'
id "me.modmuss50.mod-publish-plugin" version "0.4.2"
}
group = mod_group_id
version = mod_version
base {
archivesName = mod_name
}
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
sourceSets {
api {
compileClasspath += configurations["compileClasspath"]
}
lib {
compileClasspath += configurations["compileClasspath"]
}
//noinspection GroovyAssignabilityCheck
main {
java {
//if you want to exclude a package do it here, but use the package as path (e.g. de/teamlapen/vampirism for de.teamlapen.vampirism)
// if you want intellij to ignore the package, you need to add it in the settings (File -> Settings -> Build, Execution, Deployment -> Compiler -> Excludes)
// exclude(<package>)
if (!include_jei.toBoolean()) {
exclude('de/teamlapen/vampirism/modcompat/jei')
}
if (!include_guideapi.toBoolean()) {
exclude('de/teamlapen/vampirism/modcompat/guide')
}
if (!include_terrablender.toBoolean()) {
exclude('de/teamlapen/vampirism/modcompat/terrablender')
}
}
//noinspection GroovyAssignabilityCheck
compileClasspath += sourceSets.lib.output
compileClasspath += sourceSets.api.output
runtimeClasspath += sourceSets.api.output
resources.srcDirs += 'src/generated/resources'
}
test {
compileClasspath += sourceSets.api.output
runtimeClasspath += sourceSets.api.output
}
}
apply from: 'gradle/forge.gradle'
apply from: 'gradle/versioning.gradle'
apply from: 'gradle/artifacts.gradle'
apply from: 'gradle/deploy.gradle'
apply from: 'gradle/crowdin.gradle'
idea {
module {
for (String excludeDirName in ["run", "out", "logs", "runs"]) {
File excludeDir = new File(projectDir, excludeDirName)
excludeDirs.add(excludeDir)
}
downloadSources = true
}
}
tasks.named('processResources', ProcessResources).configure {
var replaceProperties = [
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
forge_version: forge_version, forge_version_range: forge_version_range,
loader_version_range: loader_version_range,
mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
mod_authors: mod_authors, mod_description: mod_description,
jei_version: jei_version,
guideapi_version: guideapi_version,
mod_url: mod_url,
mod_issue_tracker: mod_issue_tracker,
pack_format_number: pack_format_number,
]
inputs.properties replaceProperties
filesMatching(['META-INF/neoforge.mods.toml', 'pack.mcmeta']) {
expand replaceProperties + [project: project]
}
}
tasks.named('jar', Jar).configure {
from sourceSets.main.output.classesDirs
from sourceSets.api.output.classesDirs
from sourceSets.lib.output.classesDirs
from sourceSets.main.output.resourcesDir
from sourceSets.api.output.resourcesDir
from sourceSets.lib.output.resourcesDir
from{
fileTree('build/translations').matching{
exclude "**/en_us.json" //Don't override local source file
}
}
manifest {
attributes([
'Specification-Title' : mod_id,
'Specification-Vendor' : mod_authors,
'Specification-Version' : '1', // We are version 1 of ourselves
'Implementation-Title' : project.name,
'Implementation-Version' : project.jar.archiveVersion,
'Implementation-Vendor' : mod_authors,
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"FMLAT" : "accesstransformer.cfg",
])
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
configurations.configureEach {
print(it.name + "\n")
}