Skip to content

Commit

Permalink
setup for autmated builds
Browse files Browse the repository at this point in the history
  • Loading branch information
tristankechlo committed Jul 30, 2024
1 parent 71778db commit 999581b
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 47 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ build
# other
eclipse
run
runs
CREDITS.txt
LICENSE.txt
README.txt
Expand Down
File renamed without changes.
31 changes: 30 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import groovy.json.JsonOutput
import groovy.json.JsonSlurper

subprojects {
apply plugin: 'java'
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
java.toolchain.languageVersion = JavaLanguageVersion.of(java_version)

jar {
from rootProject.file('CREDITS.md')
from rootProject.file('LICENSE')
manifest {
attributes([
'Specification-Title' : mod_name,
Expand Down Expand Up @@ -40,4 +44,29 @@ subprojects {
tasks.withType(GenerateModuleMetadata) {
enabled = false
}

processResources {
def expandProps = [
"version" : "${minecraft_version}-${mod_version}",
"version_range" : version_range,
"minecraft_version" : minecraft_version,
"java_version" : java_version,
"fabric_loader_min" : fabric_loader_min,
"fabric_range_min_inclusive": fabric_range_min_inclusive,
"fabric_range_max_exclusive": fabric_range_max_exclusive,
"forge_loader_range" : forge_loader_range
]

filesMatching(['pack.mcmeta', 'fabric.mod.json', 'META-INF/mods.toml']) {
expand expandProps
}
inputs.properties(expandProps)

// minify json files
doLast {
fileTree(dir: outputs.files.asPath, include: "**/*.json").each {
File file -> file.text = JsonOutput.toJson(new JsonSlurper().parse(file))
}
}
}
}
19 changes: 0 additions & 19 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import groovy.json.JsonOutput
import groovy.json.JsonSlurper

plugins {
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'idea'
Expand Down Expand Up @@ -50,22 +47,6 @@ loom {

processResources {
from project(":common").sourceSets.main.resources
inputs.property "version", project.version

filesMatching("fabric.mod.json") {
expand "version": project.version
}

//filesMatching('*.mixins.json') {
// expand "refmap_target": "${archivesBaseName}-"
//}

// minify json files
doLast {
fileTree(dir: outputs.files.asPath, include: "**/*.json").each {
File file -> file.text = JsonOutput.toJson(new JsonSlurper().parse(file))
}
}
}

tasks.withType(JavaCompile) {
Expand Down
6 changes: 3 additions & 3 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
"livingthings.mixins.json"
],
"depends": {
"fabricloader": ">=0.14",
"fabricloader": ">=${fabric_loader_min}",
"fabric": "*",
"minecraft": ">=1.18.2",
"java": ">=17"
"minecraft": ">=${fabric_range_min_inclusive} <${fabric_range_max_exclusive}",
"java": ">=${java_version}"
},
"breaks": {
"patchouli": "1.18.2-71-FABRIC"
Expand Down
21 changes: 1 addition & 20 deletions forge/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import groovy.json.JsonSlurper
import groovy.json.JsonOutput

buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net' }
maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '[6.0,6.2)', changing: true
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
}
}
Expand Down Expand Up @@ -80,22 +77,6 @@ tasks.withType(JavaCompile) {

processResources {
from project(":common").sourceSets.main.resources
inputs.property "version", project.version

filesMatching("META-INF/mods.toml") {
expand "version": project.version
}

//filesMatching('*.mixins.json') {
// expand "refmap_target": "${mod_id}."
//}

// minify json files
doLast {
fileTree(dir: outputs.files.asPath, include: "**/*.json").each {
File file -> file.text = JsonOutput.toJson(new JsonSlurper().parse(file))
}
}
}

jar.finalizedBy('reobfJar')
6 changes: 3 additions & 3 deletions forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modLoader="javafml"
loaderVersion="[40,)"
loaderVersion="${forge_loader_range}"
license="CC BY-NC-ND 4.0"
showAsResourcePack=false
issueTrackerURL="https://github.com/tristankechlo/LivingThings/issues"
Expand All @@ -16,13 +16,13 @@ description='''adds various new mobs to Minecraft'''
[[dependencies.livingthings]]
modId="forge"
mandatory=true
versionRange="[40.2.0,)"
versionRange="${forge_loader_range}"
ordering="NONE"
side="BOTH"

[[dependencies.livingthings]]
modId="minecraft"
mandatory=true
versionRange="[1.18.2,1.20)"
versionRange="${version_range}"
ordering="NONE"
side="BOTH"
6 changes: 6 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@
group=com.tristankechlo.livingthings

# Common
java_version=17
minecraft_version=1.18.2
version_range=[1.18.2,1.19)

# Forge
forge_version=40.2.0
forge_loader_range=[40,)

# Fabric
fabric_version=0.76.0+1.18.2
fabric_loader_version=0.14.19
fabric_loader_min=0.14
fabric_range_min_inclusive=1.18.2
fabric_range_max_exclusive=1.19

# Mod options
mod_name=LivingThings
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 999581b

Please sign in to comment.