Skip to content

Commit a92da99

Browse files
authored
Merge pull request #10 from GTNewHorizons/update-build-script
update build script and CI
2 parents abb77f5 + dcf3278 commit a92da99

File tree

2 files changed

+18
-66
lines changed

2 files changed

+18
-66
lines changed

.github/workflows/release-latest.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

build.gradle

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//version: 7d8e9fd40492c7862532bc771cf8ff3460bf64d5
1+
//version: ffe7b130f98fdfa1ac7c6ba4bd34722a55ab28d4
22
/*
33
DO NOT CHANGE THIS FILE!
44
@@ -62,6 +62,10 @@ idea {
6262
}
6363
}
6464

65+
if(JavaVersion.current() != JavaVersion.VERSION_1_8) {
66+
throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current())
67+
}
68+
6569
checkPropertyExists("modName")
6670
checkPropertyExists("modId")
6771
checkPropertyExists("modGroup")
@@ -153,7 +157,12 @@ configurations.all {
153157
// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version
154158
'git config core.fileMode false'.execute()
155159
// Pulls version from git tag
156-
version = minecraftVersion + "-" + gitVersion()
160+
try {
161+
version = minecraftVersion + "-" + gitVersion()
162+
}
163+
catch (Exception e) {
164+
throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag!");
165+
}
157166
group = modGroup
158167
archivesBaseName = modId
159168

@@ -225,14 +234,13 @@ dependencies {
225234

226235
apply from: 'dependencies.gradle'
227236

228-
def mixinConfigJson = "mixins." + modId + ".json"
229237
def mixingConfigRefMap = "mixins." + modId + ".refmap.json"
230238
def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap
231239
def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg"
232240

233241
task generateAssets {
234242
if(usesMixins.toBoolean()) {
235-
new File(projectDir.toString() + "/src/main/resources/", mixinConfigJson).text = """{
243+
new File(projectDir.toString() + "/src/main/resources/", "mixins." + modId + ".json").text = """{
236244
"required": true,
237245
"minVersion": "0.7.11",
238246
"package": "${modGroup}.${mixinsPackage}",
@@ -351,6 +359,10 @@ processResources
351359
"modName": modName
352360
}
353361

362+
if(usesMixins.toBoolean()) {
363+
from refMap
364+
}
365+
354366
// copy everything else, thats not the mcmod.info
355367
from(sourceSets.main.resources.srcDirs) {
356368
exclude 'mcmod.info'
@@ -359,7 +371,7 @@ processResources
359371

360372
def getManifestAttributes() {
361373
def manifestAttributes = [:]
362-
if(containsMixinsAndOrCoreModOnly.toBoolean() == false) {
374+
if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) {
363375
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
364376
}
365377

@@ -374,7 +386,7 @@ def getManifestAttributes() {
374386
if(usesMixins.toBoolean()) {
375387
manifestAttributes += [
376388
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
377-
"MixinConfigs" : mixinConfigJson,
389+
"MixinConfigs" : "mixins." + modId + ".json",
378390
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
379391
]
380392
}
@@ -448,22 +460,6 @@ artifacts {
448460
}
449461
}
450462

451-
// Crude handler to append custom maven repositories to maven dependency
452-
install{
453-
repositories{
454-
mavenInstaller{
455-
pom.withXml {
456-
def repositoriesNode = asNode().appendNode("repositories")
457-
project.repositories.each { repository ->
458-
def repositoryNode = repositoriesNode.appendNode("repository")
459-
repositoryNode.appendNode("name", repository.name)
460-
repositoryNode.appendNode("url", repository.properties.get("url"))
461-
}
462-
}
463-
}
464-
}
465-
}
466-
467463
// Updating
468464
task updateBuildScript {
469465
doLast {

0 commit comments

Comments
 (0)