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

OMMC - 0.6 #41

Open
wants to merge 29 commits into
base: nyan-work/dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
27a432b
Support MC 1.20.6 & 1.21
SkyDynamic Jul 21, 2024
2cd4adc
dump to 0.6
SkyDynamic Jul 21, 2024
91c0633
fix some problem
SkyDynamic Jul 22, 2024
12f9d09
fix preprocess code
SkyDynamic Jul 22, 2024
4ec8ce5
fix highlightWaypoint throw "Already building"
SkyDynamic Jul 22, 2024
9951397
Make boolean config can bind hotkey
SkyDynamic Jul 23, 2024
111d065
Rewrite highlightWaypoint render logic
Hendrix-Shen Jul 24, 2024
3cce42d
Use gradle-all
Hendrix-Shen Jul 24, 2024
8be5c41
Update buildscripts
Hendrix-Shen Jul 24, 2024
b5f15e2
Move ModMenuImpl
Hendrix-Shen Jul 31, 2024
ae069f0
Fix buildscripts
Hendrix-Shen Jul 31, 2024
cc0c33f
Code style
Hendrix-Shen Aug 6, 2024
9e6d80a
Disable AccessWideners & interfaceInjection transitive
Hendrix-Shen Aug 9, 2024
280e59b
MagicLib 0.8.593+
Hendrix-Shen Aug 9, 2024
aa67a05
Add missing InitializationHandler
Hendrix-Shen Aug 9, 2024
03bb794
fix mismatched Operation for @WrapOperation in magiclib
wendavid552 Sep 19, 2024
9bc5e62
fix incompatibility with lithium at client side.
wendavid552 Sep 19, 2024
340c84b
fix sortInventory crashes the client due to null tag from data compon…
wendavid552 Sep 22, 2024
b278522
update java version for CI build
wendavid552 Sep 22, 2024
3a81cda
fix wrong release files patterns
wendavid552 Sep 22, 2024
7850c3f
Merge pull request #2 from wendavid552/exp/0.6
SkyDynamic Sep 24, 2024
26017dc
fix sort data is null
SkyDynamic Sep 24, 2024
35f9424
Gradle 8.10.2
Hendrix-Shen Oct 22, 2024
eef02b3
MC 1.21 -> 1.12.1
Hendrix-Shen Oct 26, 2024
17b552c
Fix render issue with sodium
Hendrix-Shen Oct 29, 2024
c4dc36d
Compat sodium 0.6
Hendrix-Shen Oct 29, 2024
f96151b
Use public ver of MagicLib
Hendrix-Shen Oct 29, 2024
8deb42e
Clean up
Hendrix-Shen Oct 30, 2024
c35a67a
Rewrite CI
Hendrix-Shen Oct 30, 2024
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
160 changes: 121 additions & 39 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,81 +1,163 @@
import com.replaymod.gradle.preprocess.Node

plugins {
id("maven-publish")
id("fabric-loom").version("1.4-SNAPSHOT").apply(false)
id("org.ajoberstar.grgit").version("5.2.0")
id("com.replaymod.preprocess").version("SNAPSHOT")
id("dev.architectury.loom").version("${architectury_loom_version}").apply(false)
id("org.ajoberstar.grgit").version("${grgit_version}")
id("com.replaymod.preprocess").version("${preprocessor_version}")
id("me.fallenbreath.yamlang").version("${yamlang_version}").apply(false)
}

preprocess {
def mc1144 = createNode("1.14.4", 1_14_04, "mojang")
def mc1152 = createNode("1.15.2", 1_15_02, "mojang")
def mc1165 = createNode("1.16.5", 1_16_05, "mojang")
def mc1171 = createNode("1.17.1", 1_17_01, "mojang")
def mc1182 = createNode("1.18.2", 1_18_02, "mojang")
def mc1192 = createNode("1.19.2", 1_19_02, "mojang")
def mc1193 = createNode("1.19.3", 1_19_03, "mojang")
def mc1194 = createNode("1.19.4", 1_19_04, "mojang")
def mc1201 = createNode("1.20.1", 1_20_01, "mojang")
def mc1202 = createNode("1.20.2", 1_20_02, "mojang")
def mc1204 = createNode("1.20.4", 1_20_04, "mojang")

mc1144.link(mc1152, null)
mc1152.link(mc1165, file("versions/mapping-1.15.2-1.16.5.txt"))
mc1165.link(mc1171, null)
mc1171.link(mc1182, null)
mc1182.link(mc1192, file("versions/mapping-1.18.2-1.19.2.txt"))
mc1192.link(mc1193, file("versions/mapping-1.19.2-1.19.3.txt"))
mc1193.link(mc1194, null)
mc1194.link(mc1201, null)
mc1201.link(mc1202, null)
mc1202.link(mc1204, null)
// Fabric
Node mc11404_fabric = createNode("1.14.4-fabric", 1_14_04, "mojang")
Node mc11502_fabric = createNode("1.15.2-fabric", 1_15_02, "mojang")
Node mc11605_fabric = createNode("1.16.5-fabric", 1_16_05, "mojang")
Node mc11701_fabric = createNode("1.17.1-fabric", 1_17_01, "mojang")
Node mc11802_fabric = createNode("1.18.2-fabric", 1_18_02, "mojang")
Node mc11902_fabric = createNode("1.19.2-fabric", 1_19_02, "mojang")
Node mc11903_fabric = createNode("1.19.3-fabric", 1_19_03, "mojang")
Node mc11904_fabric = createNode("1.19.4-fabric", 1_19_04, "mojang")
Node mc12001_fabric = createNode("1.20.1-fabric", 1_20_01, "mojang")
Node mc12002_fabric = createNode("1.20.2-fabric", 1_20_02, "mojang")
Node mc12004_fabric = createNode("1.20.4-fabric", 1_20_04, "mojang")
Node mc12006_fabric = createNode("1.20.6-fabric", 1_20_06, "mojang")
Node mc12100_fabric = createNode("1.21.0-fabric", 1_21_00, "mojang")

mc11404_fabric.link(mc11502_fabric, null)
mc11502_fabric.link(mc11605_fabric, file("versions/mapping-1.15.2-1.16.5.txt"))
mc11605_fabric.link(mc11701_fabric, null)
mc11701_fabric.link(mc11802_fabric, null)
mc11802_fabric.link(mc11902_fabric, file("versions/mapping-1.18.2-1.19.2.txt"))
mc11902_fabric.link(mc11903_fabric, file("versions/mapping-1.19.2-1.19.3.txt"))
mc11903_fabric.link(mc11904_fabric, null)
mc11904_fabric.link(mc12001_fabric, null)
mc12001_fabric.link(mc12002_fabric, null)
mc12002_fabric.link(mc12004_fabric, null)
mc12004_fabric.link(mc12006_fabric, null)
mc12006_fabric.link(mc12100_fabric, null)
}

ext {
env = System.getenv()
Map env = System.getenv()
File localPropsFile = file("${rootDir}/local.properties")

if (localPropsFile.exists()) {
Properties p = new Properties()
p.load(new FileInputStream(localPropsFile))
p.each { key, value ->
ext[key as String] = value
}
}

getEnv = {
return env
}

getOrDefault = { String key, String defaultValue ->
String value
(value = project.findProperty(key)) && !value.isEmpty() ? value : defaultValue
}

isGithubCI = {
return env.get("GITHUB_ACTION") != null
}

isJitpack = {
return env.get("JITPACK") != null
}

getBuildNumber = {
return env.GITHUB_RUN_NUMBER ? env.GITHUB_RUN_NUMBER : 0
}

getVersionGit = { List paths ->
if (grgit == null) {
if (grgit == null || grgit.head() == null) {
return "nogit"
}

List latestCommits = paths.isEmpty() ? grgit.log(maxCommits: 1) : grgit.log(paths: paths, maxCommits: 1)
return latestCommits.isEmpty() ? "uncommited" : "${latestCommits.get(0).id.substring(0, 7)}"
}

getBuildNumber = {
return ext.env.GITHUB_RUN_NUMBER ? ext.env.GITHUB_RUN_NUMBER : Integer.MAX_VALUE
}

getVersionType = {
switch (ext.env.BUILD_TYPE) {
String type = getOrDefault("ow.build.environment.buildType", null)

if (type != null) {
return type
}

if (isJitpack()) {
return "jitpack"
}

type = env.BUILD_TYPE

switch (type) {
case "RELEASE":
return "stable"
case "BETA":
return "beta"
case "PULL_REQUEST":
return "pull_request"
default:
return "dev"
}
}

getVersionPatch = { List paths ->
if (grgit == null) {
if (grgit == null || grgit.head() == null) {
return 0
}

List latestCommits = paths.isEmpty() ? grgit.log() : grgit.log(paths: paths)
return latestCommits.size()
}

getMavenArtifactVersion = {
return ext.getVersionType() == "stable" ? "${project.mod_version}.${ext.getVersionPatch([])}" : project.version
getVersion = { Project proj ->
return "${proj.property("mod.version")}.${getVersionPatch(proj == rootProject ? [] : [proj.projectDir.name])}"
}

getVersionWithCommitHash = { Project proj ->
return "${getVersion(proj)}+${getVersionGit(proj == rootProject ? [] : [proj.projectDir.name])}-${getVersionType()}"
}

getModVersion = {
return "${project.mod_version}.${getVersionPatch([])}+${getVersionGit([])}-${getVersionType()}"
getModVersion = { Project proj ->
return "${getVersion(proj)}-${getVersionType()}"
}

getMavenArtifactVersion = { Project proj ->
return project.getVersionType() == "stable" ? "${getVersion(proj)}" : "${getModVersion(proj)}"
}
}

setVersion(project.getModVersion())
tasks.register("genLocalProperties") {
it.group("${project.property("mod.id")}")

doFirst {
File localPropsFile = file("${rootDir}/local.properties")

if (localPropsFile.exists()) {
throw new IllegalStateException("local.properties file already generated. If you want to regenerate it, please delete it manually first")
} else {
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(localPropsFile))
bufferedWriter.writeLine("# Secrets")
bufferedWriter.writeLine("secrets.gpg.signingKey=")
bufferedWriter.writeLine("secrets.gpg.signingPassword=")
bufferedWriter.writeLine("secrets.mavenCentral.username=")
bufferedWriter.writeLine("secrets.mavenCentral.password=")
bufferedWriter.writeLine("")
bufferedWriter.writeLine("# Overwritten configurations")
bufferedWriter.writeLine("ow.build.environment.local=")
bufferedWriter.writeLine("ow.build.environment.buildType=")
bufferedWriter.writeLine("ow.game.window.width=")
bufferedWriter.writeLine("ow.game.window.height=")
bufferedWriter.writeLine("ow.game.window.username=")
bufferedWriter.close()

project.getLogger().info("local.properties generated successfully!")
}
}
}

tasks.register("cleanPreprocessSources") {
it.group("${project.mod_id}")
Expand Down
Loading