-
-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathbuild.gradle
246 lines (202 loc) · 8.14 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 'fabric-loom' version '1.8.+'
id "com.modrinth.minotaur" version "2.+"
id 'com.matthewprenger.cursegradle' version '1.4.0'
}
apply plugin: 'fabric-loom'
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
var isStable = project.is_stable == "true"
archivesBaseName = "polymer-bundled"
version = project.mod_version + "+" + project.minecraft_version
group = project.maven_group
var field = com.google.gson.Gson.class.getDeclaredField("prettyPrinting");
field.setAccessible(true);
field.setBoolean(net.fabricmc.loom.LoomGradlePlugin.GSON, false);
System.out.println(isStable ? "release" : "beta")
allprojects {
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
}
allprojects {
apply plugin: 'fabric-loom'
tasks.withType(JavaCompile).configureEach {
it.options.release = 21
}
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 { url "https://jitpack.io" }
maven { url "https://maven.nucleoid.xyz/" }
maven { url "https://api.modrinth.com/maven" }
maven { url "https://maven.gegy.dev/" }
maven { url "https://maven.shedaniel.me/" }
maven { url "https://maven.bai.lol" }
maven { url "https://maven.ryanliptak.com/" }
maven { url "https://api.modrinth.com/maven" }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url "https://maven.enginehub.org/repo/" }
maven { url "https://maven.theepicblock.nl"; content { includeGroup("nl.theepicblock") } }
maven { url 'https://maven.wispforest.io/' }
maven { url "https://cursemaven.com" }
//maven { url "https://dvs1.progwml6.com/files/maven/" }
maven { url "https://maven.terraformersmc.com/releases" }
maven { url "https://maven.theepicblock.nl" }
maven { url "https://repo.opencollab.dev/maven-snapshots/" }
maven { url 'https://maven.ladysnake.org/releases' }
mavenLocal()
}
dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modCompileOnly "net.fabricmc:fabric-loader:${project.loader_version}"
modLocalRuntime "net.fabricmc:fabric-loader:${project.loader_version}"
}
loom {
enableTransitiveAccessWideners = false
interfaceInjection {
enableDependencyInterfaceInjection = false
}
}
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
// The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too
// JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.
// We'll use that if it's available, but otherwise we'll use the older option.
it.options.release = 21
}
java {
// 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()
}
}
subprojects {
afterEvaluate {
// Disable the gen sources task on sub projects
genSourcesWithFernFlower.enabled = false
genSourcesWithCfr.enabled = false
}
}
dependencies {
api project(path: ":polymer-autohost", configuration: "namedElements")
api project(path: ":polymer-core", configuration: "namedElements")
api project(path: ":polymer-common", configuration: "namedElements")
api project(path: ":polymer-resource-pack", configuration: "namedElements")
api project(path: ":polymer-resource-pack-extras", configuration: "namedElements")
api project(path: ":polymer-blocks", configuration: "namedElements")
api project(path: ":polymer-virtual-entity", configuration: "namedElements")
include(project(path: ":polymer-autohost"))
include(project(path: ":polymer-core"))
include(project(path: ":polymer-common"))
include(project(path: ":polymer-resource-pack"))
include(project(path: ":polymer-resource-pack-extras"))
include(project(path: ":polymer-blocks"))
include(project(path: ":polymer-virtual-entity"))
}
void setupRepositories(RepositoryHandler repositories) {
def env = System.getenv()
if (env.MAVEN_URL) {
repositories.maven {
credentials {
username env.MAVEN_USERNAME
password env.MAVEN_PASSWORD
}
url env.MAVEN_URL
}
} else {
repositories.mavenLocal()
}
}
curseforge {
if (isStable && System.getenv("CURSEFORGE")) {
apiKey = System.getenv("CURSEFORGE")
project {
id = "551890"
releaseType = "release"
changelog = System.getenv("CHANGELOG")
changelogType = "markdown"
addGameVersion((project.minecraft_version.contains("-") ? ((String) project.minecraft_version.split("-")[0] + "-Snapshot") : project.minecraft_version))
addGameVersion "Fabric"
addGameVersion "Quilt"
mainArtifact(remapJar)
afterEvaluate {
uploadTask.dependsOn("remapJar")
}
}
}
options {
forgeGradleIntegration = false
}
remapJar {
finalizedBy project.tasks.curseforge
}
}
if (System.getenv("MODRINTH")) {
modrinth {
token = System.getenv("MODRINTH")
projectId = 'xGdtZczs'// The ID of your modrinth project, slugs will not work.
versionNumber = "" + version // The version of the mod to upload.
versionType = isStable ? "release" : "beta"
uploadFile = remapJar // This links to a task that builds your mod jar and sets "uploadFile" to the mod jar.
gameVersions = [((String) project.minecraft_version)]
changelog = System.getenv("CHANGELOG")
loaders = ["fabric", "quilt"]
}
remapJar {
finalizedBy project.tasks.modrinth
}
}
// configure the maven publication
allprojects {
apply plugin: 'maven-publish'
processResources {
doLast {
fileTree(dir: outputs.files.asPath, include: "**/*.json").each {
File file -> file.text = com.google.gson.JsonParser.parseString(file.text).toString()
}
}
}
classes {
doLast {
fileTree(dir: project.sourceSets.main.output.classesDirs.asPath, include: "**/*.json").each {
File file -> file.text = com.google.gson.JsonParser.parseString(file.text).toString()
}
}
}
remapJar {
doLast {
fileTree(dir: outputs.files.asPath, include: "**/*.json").each {
File file -> file.text = com.google.gson.JsonParser.parseString(file.text).toString()
}
}
}
afterEvaluate {
if (project.version != "0.0.0-alpha.0") {
publishing {
publications {
mavenJava(MavenPublication) {
groupId = rootProject.maven_group
artifactId = project.archivesBaseName
version = project.version
from components.java
}
}
setupRepositories(repositories)
}
}
}
}