-
Notifications
You must be signed in to change notification settings - Fork 15
/
build.gradle
201 lines (170 loc) · 6.78 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net/' }
maven { url = 'https://maven.parchmentmc.org' } //Parchment
jcenter()
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
classpath 'org.parchmentmc:librarian:1.+' //Parchment
}
}
apply plugin: 'net.minecraftforge.gradle'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'org.parchmentmc.librarian.forgegradle' //Parchment
apply plugin: 'eclipse'
//apply plugin: 'maven-publish'
//apply from: 'https://raw.githubusercontent.com/SizableShrimp/ForgeUpdatesRemapper/main/remapper.gradle' //Magic mappings updater
version = "$mc_version-$mod_version"
group = "com.technomancer.crossroads"
archivesBaseName = "crossroads"
compileJava.options.encoding = 'UTF-8'
//Exclude python scripts from the build
sourceSets.main.java.exclude('**/python/**')
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
//sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
minecraft {
mappings channel: "$mcp_channel", version: "$mcp_version"
// replaceIn 'mods.toml'
// replace 'essentials_version', '$essentials_version'
runs {
client {
workingDirectory project.file('run\\client')
jvmArgs '-ea' //Enable assert keyword
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
// Make patchouli work
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
mods {
crossroads {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run\\server')
jvmArgs '-ea' //Enable assert keyword
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
// Make patchouli work
properties 'mixin.env.disableRefMap': 'true'
mods {
crossroads {
source sourceSets.main
}
}
}
}
}
repositories {
maven { url "https://maven.blamejared.com" } //Patchouli, JEI
// maven {url "https://tehnut.info/maven"} //hwyla
maven {url "https://maven.theillusivec4.top/"} //Curios
maven {
//Create, Flywheel, Registrate
name = 'tterrag maven'
url = 'https://maven.tterrag.com/'
}
maven {
url "https://cursemaven.com"
content {
includeGroup "curse.maven"
}
} // Essentials (release versions)
flatDir { dirs 'libs' }//Essentials (dev versions); lets us grab dependencies from the libs folder
}
dependencies {
minecraft("net.minecraftforge:forge:$mc_version-$fg_version")
assert essentials_dev_variant == 'false' || essentials_dev_variant == 'true'
//Essentials
//Can either depend on a file published to Curse or an essentials jar in a folder called "libs", in the same parent folder as "src"
if(essentials_dev_variant == 'false'){
//See https://www.cursemaven.com/ for explanation
implementation(fg.deobf("curse.maven:essentials-293752:$essentials_file_id"))
}else{
//When setting up a dev environment for Crossroads, make sure to have an essentials jar in a folder called "libs", in the same parent folder as "src"
implementation(fg.deobf("com.technomancer.essentials:essentials-$essentials_version:dev"))
}
//Compile against APIs
//JEI
compileOnly fg.deobf("mezz.jei:jei-$jei_mc_version-common-api:$jei_version")
compileOnly fg.deobf("mezz.jei:jei-$jei_mc_version-forge-api:$jei_version")
//Curios
compileOnly(fg.deobf("top.theillusivec4.curios:curios-forge:$curios_version:api"))//Curios
//Run with the full versions
runtimeOnly fg.deobf("mezz.jei:jei-$jei_mc_version-forge:$jei_version")//JEI
runtimeOnly(fg.deobf("top.theillusivec4.curios:curios-forge:$curios_version"))//Curios
compileOnly(fg.deobf("vazkii.patchouli:Patchouli:$patchouli_version-FORGE:api"))
runtimeOnly(fg.deobf("vazkii.patchouli:Patchouli:$patchouli_version-FORGE"))
//No special CR integration for hwayla- only used for testing, so no compile inclusion needed
// runtimeOnly(fg.deobf("mcp.mobius.waila:Hwyla:$hwyla_version"))
compileOnly fg.deobf("com.simibubi.create:create-${create_minecraft_version}:${create_version}:slim") { transitive = false }
compileOnly fg.deobf("com.jozufozu.flywheel:flywheel-forge-${flywheel_minecraft_version}:${flywheel_version}")
compileOnly fg.deobf("com.tterrag.registrate:Registrate:${registrate_version}")
// TODO Create skipped MC1.19.4
// runtimeOnly fg.deobf("com.simibubi.create:create-${create_minecraft_version}:${create_version}:slim") { transitive = false }
// runtimeOnly fg.deobf("com.jozufozu.flywheel:flywheel-forge-${flywheel_minecraft_version}:${flywheel_version}")
// runtimeOnly fg.deobf("com.tterrag.registrate:Registrate:${registrate_version}")
}
// Example for how to get properties into the manifest for reading by the runtime..
jar {
manifest {
attributes([
"Specification-Title": "crossroads",
"Specification-Vendor": "Da_Technomancer",
"Specification-Version": "1",
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor" :"Technomancer",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
// Example configuration to allow publishing using the maven-publish task
// we define a custom artifact that is sourced from the reobfJar output task
// and then declare that to be published
// Note you'll need to add a repository here
def reobfFile = file("$buildDir/reobfJar/output.jar")
def reobfArtifact = artifacts.add('default', reobfFile) {
type 'jar'
builtBy 'reobfJar'
}
processResources {
// This will ensure that this task is redone when the versions change.
inputs.property 'version', project.version
// Replace stuff in mods.toml and the patchouli book version, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'META-INF/mods.toml'
//Copy the Crossroads and essentials version into the toml file
expand 'version':project.version
expand 'essentials_version':"$essentials_version"
exclude 'patchouli_books/manual/book.json'
exclude 'META-INF/mods.toml'
}
// Copy everything else except the mods.toml
// from(sourceSets.main.resources.srcDirs) {
// exclude 'META-INF/mods.toml'
// }
}
//We don't use Maven
//publishing {
// publications {
// mavenJava(MavenPublication) {
// artifact reobfArtifact
// }
// }
// repositories {
// maven {
// url "file:///${project.projectDir}/mcmodsrepo"
// }
// }
//}