Skip to content

Commit

Permalink
feat(build): substitute in version requirement metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamalam360 committed Mar 26, 2024
1 parent 478577f commit 5726896
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 20 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.4-SNAPSHOT" apply false
id "io.github.juuxel.loom-quiltflower" version "1.7.2" apply false
id "dev.architectury.loom" version "1.5-SNAPSHOT" apply false
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
id "com.github.breadmoirai.github-release" version "2.4.1"
id "maven-publish"
Expand All @@ -25,7 +24,6 @@ if (System.getenv("GITHUB_TOKEN") != null) {

subprojects {
apply plugin: "dev.architectury.loom"
apply plugin: "io.github.juuxel.loom-quiltflower"

loom {
silentMojangMappingsLicense()
Expand All @@ -39,7 +37,8 @@ subprojects {
'Implementation-Title' : project.name,
'Implementation-Version': project.jar.archiveVersion,
'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})",
'Built-On-Minecraft' : minecraft_version
'Built-On-Minecraft' : minecraft_version,
'JamLib-File-Name' : "rightclickharvest-${project.base.archivesName.get()}-${rootProject.version}.jar"
])
}
}
Expand Down Expand Up @@ -84,6 +83,7 @@ allprojects {
}

tasks.publish {
dependsOn("clean")
dependsOn(":githubRelease")
dependsOn("common:publishAllPublicationsToMavenRepository")
dependsOn("fabric:publishUnified")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import dev.architectury.event.EventResult;
import dev.architectury.event.events.common.InteractionEvent;
import io.github.jamalam360.jamlib.JamLib;
import io.github.jamalam360.jamlib.JamLibPlatform;
import io.github.jamalam360.jamlib.config.ConfigManager;
import net.minecraft.core.BlockPos;
Expand Down Expand Up @@ -42,6 +43,7 @@ public class RightClickHarvest {

public static void init() {
LOGGER.info("Initializing Right Click Harvest on " + JamLibPlatform.getPlatform().name());
JamLib.checkForJarRenaming(RightClickHarvest.class);

InteractionEvent.RIGHT_CLICK_BLOCK.register(((player, hand, pos, face) -> {
InteractionResult res = RightClickHarvest.onBlockUse(player, player.level(), hand, new BlockHitResult(player.position(), face, pos, false), true);
Expand Down
10 changes: 9 additions & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,18 @@ publishing {

processResources {
filesMatching("fabric.mod.json") {
expand "version": project.version
expand "version": project.version,
"minecraft_version": project.minecraft_version,
"fabric_api_version": libs.versions.fabric.api.get(),
"architectury_version": libs.versions.architectury.get(),
"jamlib_version": libs.versions.jamlib.get()
}

inputs.property "version", project.version
inputs.property "minecraft_version", project.minecraft_version
inputs.property "fabric_api_version", libs.versions.fabric.api.get()
inputs.property "architectury_version", libs.versions.architectury.get()
inputs.property "jamlib_version", libs.versions.jamlib.get()
}

shadowJar {
Expand Down
8 changes: 4 additions & 4 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"mixins": [
],
"depends": {
"fabric": "*",
"minecraft": ">=1.20.4",
"architectury": ">=11.0.9",
"jamlib": ">=1.0.3+1.20.4"
"fabric": ">=${fabric_api_version}",
"minecraft": ">=${minecraft_version}",
"architectury": ">=${architectury_version}",
"jamlib": ">=${jamlib_version}"
}
}
12 changes: 12 additions & 0 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ publishing {
}
}

processResources {
filesMatching("mods.toml") {
expand "minecraft_version": project.minecraft_version,
"architectury_version": libs.versions.architectury.get(),
"jamlib_version": libs.versions.jamlib.get()
}

inputs.property "minecraft_version", project.minecraft_version
inputs.property "architectury_version", libs.versions.architectury.get()
inputs.property "jamlib_version", libs.versions.jamlib.get()
}

shadowJar {
exclude "fabric.mod.json"
exclude "architectury.common.json"
Expand Down
6 changes: 3 additions & 3 deletions forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ side = "BOTH"
[[dependencies.rightclickharvest]]
modId = "minecraft"
mandatory = true
versionRange = "[1.20.4,)"
versionRange = "[${minecraft_version},)"
ordering = "NONE"
side = "BOTH"

[[dependencies.rightclickharvest]]
modId = "architectury"
mandatory = true
versionRange = "[11.0.9,)"
versionRange = "[${architectury_version},)"
ordering = "AFTER"
side = "BOTH"

[[dependencies.rightclickharvest]]
modId = "jamlib"
mandatory = true
versionRange = "[1.0.3+1.20.4,)"
versionRange = "[${jamlib_version},)"
ordering = "AFTER"
side = "BOTH"
2 changes: 1 addition & 1 deletion libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ quilt-loader = "0.21.1"
quilted-fabric-api = "7.4.0+0.90.0-1.20.1"

# https://maven.jamalam.tech/#/releases
jamlib = "1.0.3+1.20.4"
jamlib = "1.0.7+1.20.4"

# https://modrinth.com/mod/modmenu/versions
modmenu = "9.0.0"
Expand Down
12 changes: 12 additions & 0 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,18 @@ publishing {
}
}

processResources {
filesMatching("mods.toml") {
expand "minecraft_version": project.minecraft_version,
"architectury_version": libs.versions.architectury.get(),
"jamlib_version": libs.versions.jamlib.get()
}

inputs.property "minecraft_version", project.minecraft_version
inputs.property "architectury_version", libs.versions.architectury.get()
inputs.property "jamlib_version", libs.versions.jamlib.get()
}

shadowJar {
exclude "fabric.mod.json"
exclude "architectury.common.json"
Expand Down
6 changes: 3 additions & 3 deletions neoforge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ side = "BOTH"
[[dependencies.rightclickharvest]]
modId = "minecraft"
type = "required"
versionRange = "[1.20.4,)"
versionRange = "[${minecraft_version},)"
ordering = "NONE"
side = "BOTH"

[[dependencies.rightclickharvest]]
modId = "architectury"
type = "required"
versionRange = "[11.0.9,)"
versionRange = "[${architectury_version},)"
ordering = "AFTER"
side = "BOTH"

[[dependencies.rightclickharvest]]
modId = "jamlib"
type = "required"
versionRange = "[1.0.3+1.20.4,)"
versionRange = "[${jamlib_version},)"
ordering = "AFTER"
side = "BOTH"
8 changes: 7 additions & 1 deletion quilt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,16 @@ publishing {

processResources {
filesMatching("quilt.mod.json") {
expand "version": project.version
expand "version": project.version,
"minecraft_version": project.minecraft_version,
"architectury_version": libs.versions.architectury.get(),
"jamlib_version": libs.versions.jamlib.get()
}

inputs.property "version", project.version
inputs.property "minecraft_version", project.minecraft_version
inputs.property "architectury_version", libs.versions.architectury.get()
inputs.property "jamlib_version", libs.versions.jamlib.get()
}

shadowJar {
Expand Down
6 changes: 3 additions & 3 deletions quilt/src/main/resources/quilt.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@
},
{
"id": "minecraft",
"version": ">=1.20.4"
"version": ">=${minecraft_version}"
},
{
"id": "architectury",
"version": ">=11.0.9"
"version": ">=${architectury_version}"
},
{
"id": "jamlib",
"version": ">=1.0.3+1.20.4"
"version": ">=${jamlib_version}"
}
]
},
Expand Down

0 comments on commit 5726896

Please sign in to comment.