-
Notifications
You must be signed in to change notification settings - Fork 26
/
build.gradle
139 lines (109 loc) · 4.5 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
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
id "systems.manifold.manifold-gradle-plugin" version "0.0.2-alpha"
}
private void setupPreProcess(def index){
println "Setting up preprocessor for version index $index"
new File(projectDir,"build.properties").text = """
MC_18 = 0
MC_19_2 = 1
MC_19_4 = 2
MC_20_1 = 3
MC_20_2 = 4
MC_20_4 = 5
MC_20_6 = 6
MC_21 = 7
MC_21_2 = 8
MC_21_4 = 9
MC = ${index}
"""
File indexProps = new File(projectDir,"property_variants/${index}.properties")
println "Applying gradle.properties overrides: $indexProps.path"
Properties properties = new Properties()
properties.load(indexProps.newDataInputStream())
def maxKeyLength = properties.keySet().collect { it.toString().length() }.max()
properties.forEach { key, value ->
//set in each project scope
gradle.rootProject.setProperty(key as String, value)
project.setProperty(key as String, value)
subprojects.forEach { it.setProperty(key as String, value)}
println " - ${key.padRight(maxKeyLength)} = $value"
}
}
setupPreProcess(rootProject.mc_build)
architectury {
minecraft = rootProject.minecraft_version
}
subprojects {
apply plugin: "dev.architectury.loom"
apply plugin: "systems.manifold.manifold-gradle-plugin"
loom { silentMojangMappingsLicense() }
dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
if(rootProject.parchment_version != "no") {
println "Using Parchment mappings ${rootProject.parchment_version}"
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${rootProject.parchment_version}@zip")
}
}else{
println "Not using Parchment mappings"
mappings loom.officialMojangMappings()
}
implementation group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.5.10'
implementation 'com.demonwav.mcdev:annotations:2.1.0'
//https://github.com/manifold-systems/manifold/tree/master/manifold-deps-parent/manifold-preprocessor#setup
//more compatible version
// annotationProcessor 'systems.manifold:manifold-preprocessor:2023.1.17'
//latest version
annotationProcessor 'systems.manifold:manifold-preprocessor:2024.1.37'
}
processResources {
inputs.property "version", rootProject.mod_version
inputs.property "compatible_mc_fabric", rootProject.compatible_mc_fabric
inputs.property "compatible_mc_forge", rootProject.compatible_mc_forge
filesMatching("fabric.mod.json") {
expand(["version": rootProject.mod_version,
"compatible_mc_fabric": rootProject.compatible_mc_fabric])
}
filesMatching("META-INF/mods.toml") {
expand(["version": rootProject.mod_version,
"compatible_mc_forge": rootProject.compatible_mc_forge])
}
filesMatching("META-INF/neoforge.mods.toml") {
expand(["version": rootProject.mod_version,
"compatible_mc_forge": rootProject.compatible_mc_forge])
}
}
}
allprojects {
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"
apply plugin: "systems.manifold.manifold-gradle-plugin"
archivesBaseName = rootProject.archives_base_name
version = rootProject.mod_version
group = rootProject.maven_group
repositories {
maven { url = "https://api.modrinth.com/maven" }
maven { url = "https://www.cursemaven.com/" }
maven { url "https://maven.shedaniel.me/" }
maven { url "https://maven.terraformersmc.com/releases/" }
maven { url "https://mvnrepository.com/artifact/com.demonwav.mcdev/annotations" }
maven { url "https://maven.parchmentmc.org" }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
options.release = rootProject.java_version as int
//pre processor args
options.compilerArgs += ["-Xplugin:Manifold"]
// options.compilerArgs += ["-Xlint:deprecation"]
}
// compileJava.options.fork = true
// compileJava.options.forkOptions.executable = 'C:/Program Files/Java/jdk-17.0.3.1/'
java {
withSourcesJar()
}
}