Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build script and CI #10

Merged
merged 1 commit into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions .github/workflows/gradle.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/release-latest.yml

This file was deleted.

40 changes: 18 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 7d8e9fd40492c7862532bc771cf8ff3460bf64d5
//version: ffe7b130f98fdfa1ac7c6ba4bd34722a55ab28d4
/*
DO NOT CHANGE THIS FILE!

Expand Down Expand Up @@ -62,6 +62,10 @@ idea {
}
}

if(JavaVersion.current() != JavaVersion.VERSION_1_8) {
throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current())
}

checkPropertyExists("modName")
checkPropertyExists("modId")
checkPropertyExists("modGroup")
Expand Down Expand Up @@ -153,7 +157,12 @@ configurations.all {
// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version
'git config core.fileMode false'.execute()
// Pulls version from git tag
version = minecraftVersion + "-" + gitVersion()
try {
version = minecraftVersion + "-" + gitVersion()
}
catch (Exception e) {
throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag!");
}
group = modGroup
archivesBaseName = modId

Expand Down Expand Up @@ -225,14 +234,13 @@ dependencies {

apply from: 'dependencies.gradle'

def mixinConfigJson = "mixins." + modId + ".json"
def mixingConfigRefMap = "mixins." + modId + ".refmap.json"
def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap
def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg"

task generateAssets {
if(usesMixins.toBoolean()) {
new File(projectDir.toString() + "/src/main/resources/", mixinConfigJson).text = """{
new File(projectDir.toString() + "/src/main/resources/", "mixins." + modId + ".json").text = """{
"required": true,
"minVersion": "0.7.11",
"package": "${modGroup}.${mixinsPackage}",
Expand Down Expand Up @@ -351,6 +359,10 @@ processResources
"modName": modName
}

if(usesMixins.toBoolean()) {
from refMap
}

// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
Expand All @@ -359,7 +371,7 @@ processResources

def getManifestAttributes() {
def manifestAttributes = [:]
if(containsMixinsAndOrCoreModOnly.toBoolean() == false) {
if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) {
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
}

Expand All @@ -374,7 +386,7 @@ def getManifestAttributes() {
if(usesMixins.toBoolean()) {
manifestAttributes += [
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
"MixinConfigs" : mixinConfigJson,
"MixinConfigs" : "mixins." + modId + ".json",
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
]
}
Expand Down Expand Up @@ -448,22 +460,6 @@ artifacts {
}
}

// Crude handler to append custom maven repositories to maven dependency
install{
repositories{
mavenInstaller{
pom.withXml {
def repositoriesNode = asNode().appendNode("repositories")
project.repositories.each { repository ->
def repositoryNode = repositoriesNode.appendNode("repository")
repositoryNode.appendNode("name", repository.name)
repositoryNode.appendNode("url", repository.properties.get("url"))
}
}
}
}
}

// Updating
task updateBuildScript {
doLast {
Expand Down