forked from Team-EnderIO/EnderIO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
245 lines (212 loc) · 8.67 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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
plugins {
id "com.modrinth.minotaur" version "2.+" // Modrinth publishing plugin
id 'maven-publish'
alias libs.plugins.quilt.loom
}
archivesBaseName = project.archives_base_name
version = "${project.version}+${libs.versions.minecraft.get()}"
group = project.maven_group
def subsets = [
'conduits',
'machines',
'decor'
]
repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
maven {
name = 'ParchmentMC'
url = 'https://maven.parchmentmc.org'
}
maven { url 'https://maven.blamejared.com' }
maven {
name = "TerraformersMC"
url = "https://maven.terraformersmc.com/"
}
maven { url "https://maven.shedaniel.me" }
maven {
// location of the maven that hosts JEI files before January 2023
name = "Progwml6's maven"
url = "https://dvs1.progwml6.com/files/maven/"
}
maven {
// location of the maven that hosts JEI files since January 2023
name = "Jared's maven"
url = "https://maven.blamejared.com/"
}
maven {
// location of a maven mirror for JEI files, as a fallback
name = "ModMaven"
url = "https://modmaven.dev"
}
maven { url = "https://mvn.devos.one/snapshots/" }
maven { url 'https://jitpack.io' } // mixin extras, porting lib requires it but doesn't add the maven repo?
maven { url = 'https://ladysnake.jfrog.io/artifactory/mods' }
}
// All the dependencies are declared at gradle/libs.version.toml and referenced with "libs.<id>"
// See https://docs.gradle.org/current/userguide/platforms.html for information on how version catalogs work.
dependencies {
minecraft libs.minecraft
//mappings variantOf(libs.quilt.mappings) { classifier 'intermediary-v2' }
// Replace the above line with the block below if you want to use Mojang mappings as your primary mappings, falling back on QM for parameters and Javadocs
/*mappings loom.layered {
mappings libs.quilt.mappings //{ classifier 'intermediary-v2' }
officialMojangMappings()
}*/
mappings loom.layered {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-1.19.2:2022.11.27@zip")
}
modRuntimeOnly libs.rei
modCompileOnly libs.rei.api
modCompileOnly "dev.emi:emi:${libs.versions.emi.get()}:api"
modLocalRuntime "dev.emi:emi:${libs.versions.emi.get()}"
modCompileOnlyApi libs.jei.api.common
modCompileOnlyApi libs.jei.api.fabric
modRuntimeOnly libs.jei
modImplementation libs.portinglib
include libs.portinglib
modImplementation libs.quilt.loader
modImplementation libs.patchouli
modImplementation libs.components
modImplementation libs.cblock
modImplementation libs.registrate
include libs.registrate
// QSL is not a complete API; You will need Quilted Fabric API to fill in the gaps.
// Quilted Fabric API will automatically pull in the correct QSL version.
modImplementation libs.quilted.fabric.api
// modImplementation libs.bundles.quilted.fabric.api // If you wish to use Fabric API's deprecated modules, you can replace the above line with this one
}
/*loom {
accessWidenerPath = file("src/main/resources/foxglove.accesswidener")
}*/
processResources {
inputs.property 'version', version
filesMatching('quilt.mod.json') {
expand "version": version
}
}
sourceSets {
api {
compileClasspath += main.compileClasspath
}
core {
compileClasspath += sourceSets.api.output
compileClasspath += main.compileClasspath
}
main {
compileClasspath += sourceSets.api.output
compileClasspath += sourceSets.core.output
resources { srcDir 'src/generated/resources' }
}
}
task apiJar(type: Jar) {
classifier 'api'
from sourceSets.api.output
}
build.dependsOn apiJar
configurations {
apiImplementation.extendsFrom(implementation)
apiCompileOnly.extendsFrom(compileOnly)
apiRuntimeOnly.extendsFrom(runtimeOnly)
coreImplementation.extendsFrom(implementation)
coreCompileOnly.extendsFrom(compileOnly)
coreRuntimeOnly.extendsFrom(runtimeOnly)
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = 'UTF-8'
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
}
for (String set : subsets) {
setupSourceSet(set)
}
loom {
mods {
enderio {
sourceSets.api
sourceSets.core
sourceSets.main
for (String set : subsets) {
sourceSets.getByName(set)
}
}
}
}
java {
// Still required by IDEs such as Eclipse and Visual Studio Code
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
// If this mod is going to be a library, then it should also generate Javadocs in order to aid with development.
// Uncomment this line to generate them.
// withJavadocJar()
}
// If you plan to use a different file for the license, don't forget to change the file name here!
jar {
from('LICENSE.txt') {
rename { "${it}_${archivesBaseName}" }
}
}
// Configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
// Thanks to Mekanism for the base implementations here.
// Create and configure a new module source set.
def setupSourceSet(String name) {
def sourceSet = sourceSets.create(name)
// Add api and main modules.
sourceSet.compileClasspath += sourceSets.api.output
sourceSet.compileClasspath += sourceSets.main.output
sourceSet.compileClasspath += sourceSets.core.output
sourceSet.compileClasspath += sourceSets.api.compileClasspath
sourceSet.compileClasspath += sourceSets.main.compileClasspath
sourceSet.compileClasspath += sourceSets.core.compileClasspath
// Extend configurations
setupExtraSourceSets(sourceSet)
}
// Thanks again to Mekanism for this stuff.
def setupExtraSourceSets(SourceSet base) {
// Setup and extend configurations for alternate modules. First by making the implementation, compileOnly, runtimeOnly equivalents
// for those modules extend the main ones
def baseImplementation = project.configurations.maybeCreate(base.getTaskName(null, "implementation"))
def baseCompileOnly = project.configurations.maybeCreate(base.getTaskName(null, "compileOnly"))
def baseRuntimeOnly = project.configurations.maybeCreate(base.getTaskName(null, "runtimeOnly"))
baseImplementation.extendsFrom(project.configurations.getByName("implementation"))
baseCompileOnly.extendsFrom(project.configurations.getByName("compileOnly"))
baseRuntimeOnly.extendsFrom(project.configurations.getByName("runtimeOnly"))
}
// build.gradle
modrinth {
token = System.getenv("MODRINTH_TOKEN") // This is the default. Remember to have the MODRINTH_TOKEN environment variable set or else this will fail, or set it to whatever you want - just make sure it stays private!
projectId = "IXhLA0C5" // This can be the project ID or the slug. Either will work!
versionNumber = "${version}" // You don't need to set this manually. Will fail if Modrinth has this version already
versionType = "${release}" // This is the default -- can also be `beta` or `alpha`
uploadFile = remapJar // With Loom, this MUST be set to `remapJar` instead of `jar`!
gameVersions = ["1.19.2"] // Must be an array, even with only one version
loaders = ["quilt"] // Must also be an array - no need to specify this if you're using Loom or ForgeGradle
dependencies { // A special DSL for creating dependencies
required.project "qsl" // Creates a new required dependency on Fabric API
required.project "cardinal-components-api"
optional.project "roughly-enough-items"
optional.project "jei"
optional.project "emi"
}
}