Skip to content

Commit

Permalink
Sync with Framework
Browse files Browse the repository at this point in the history
  • Loading branch information
NotRyken committed Nov 25, 2024
1 parent 0c8f7d4 commit a3b48cb
Show file tree
Hide file tree
Showing 36 changed files with 119 additions and 142 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/check-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ on:
push:
paths: [
'**src/**',
'**/*gradle*',
LICENSE
'**/*gradle*'
]
pull_request:
paths: [
'**src/**',
'**/*gradle*',
LICENSE
'**/*gradle*'
]
workflow_dispatch:

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 1.0.0

- Initial full release
File renamed without changes.
13 changes: 0 additions & 13 deletions NOTICE_MouseWheelie

This file was deleted.

137 changes: 58 additions & 79 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,38 @@ plugins {
subprojects {
version = mod_version
group = mod_group

// License headers
apply(plugin: "org.cadixdev.licenser")
license {
// This can be done in multiloader-common.gradle but only if the
// "matching" method is not used (throws a pile of weird errors).
// Also, NeoForge's update of the plugin can't handle matching at all.
include("**/*.java") // Java files only
header = rootProject.file("NOTICE_Combined")
properties {
project_name = mod_name
owner_name = mod_owner
year = java.time.LocalDate.now().getYear().toString()
}
// Dual-licensing
matching(includes: [
"**/config/**",
"**/moremousetweaks/gui/**",
"**/mixin/mousetweaks/**",
"**/MixinOverlayRecipeComponent.java",
"**/Localization.java",
"**/ModLogger.java",
"**/MoreMouseTweaksFabric.java",
"**/MoreMouseTweaksNeoForge.java"
]) {
header = rootProject.file("NOTICE")

if (name == "common") {
// License headers
apply(plugin: "org.cadixdev.licenser")
String licenseDir = "src/main/resources/assets/${mod_id}/license/"
license {
// This can be done in multiloader-common.gradle but only if the
// "matching" method is not used (throws a pile of weird errors).
// Also, NeoForge's update of the plugin can't handle matching at all.
include("**/*.java") // Java files only
header = project.file(licenseDir + "mouse-wheelie/HEADER.txt")
properties {
project_name = mod_name
owner_name = mod_owner
year = java.time.LocalDate.now().getYear().toString()
}
// Alternate license
matching(includes: [
"**/config/**",
"**/moremousetweaks/gui/**",
"**/mixin/mousetweaks/**",
"**/MixinOverlayRecipeComponent.java",
"**/Localization.java",
"**/ModLogger.java",
"**/MoreMouseTweaksFabric.java",
"**/MoreMouseTweaksNeoForge.java",
]) {
header = project.file(licenseDir + "HEADER.txt")
}
}
}

// Publishing
if (name != "common") {
} else {
// Publishing
apply(plugin: "com.modrinth.minotaur")
apply(plugin: "net.darkhax.curseforgegradle")
apply(plugin: "com.github.breadmoirai.github-release")
Expand All @@ -54,7 +55,7 @@ subprojects {
versionNumber = mod_version
versionType = release_type
versionName = "v${mod_version}-${capsLoader(name)}"
changelog = rootProject.file("changelog.md").text
changelog = versionChangelog()
uploadFile = name == "fabric" ? remapJar : jar
loaders = project.property("release_mod_loaders_${name}").split(",") as List
gameVersions = project.property("release_game_versions_${name}").split(",") as List
Expand Down Expand Up @@ -91,7 +92,7 @@ subprojects {
def file = upload(curseforge_id, module == "fabric" ? remapJar : jar)
file.displayName = "v${mod_version}-${capsLoader(module)}"
file.releaseType = release_type
file.changelog = rootProject.file("changelog.md").text
file.changelog = versionChangelog()
file.changelogType = "markdown"
project.property("release_mod_loaders_${module}").split(",").each { String id ->
file.addModLoader(id)
Expand Down Expand Up @@ -126,7 +127,17 @@ subprojects {
tagName = "v${mod_version}"
prerelease = release_type == "alpha" || release_type == "beta"
releaseName = "v${mod_version}"
body = rootProject.file("changelog.md").text

String changelog = "\n\n## Changelog\n\n" + versionChangelog()
String versions = "## MC versions\n\n"
if (project.hasProperty("release_game_versions_fabric"))
versions = String.format("%s - Fabric: %s\n", versions,
project.property("release_game_versions_fabric"))
if (project.hasProperty("release_game_versions_neoforge"))
versions = String.format("%s - NeoForge: %s\n", versions,
project.property("release_game_versions_neoforge"))
body = versions + changelog

targetCommitish = grgitService.service.get().grgit.branch.current().name
overwrite = false
allowUploadToExisting = true
Expand All @@ -138,54 +149,22 @@ subprojects {
}
}

tasks.register("rebrandProject") {
def rebrandFile = file("rebrand.properties")
if (!rebrandFile.exists()) {
println("'rebrand.properties' file not found.")
return
}
doLast {
def properties = new Properties()
rebrandFile.withInputStream { stream ->
properties.load(stream)
}

file(".").eachFileRecurse { file ->
if (file.isFile() && !file.name.startsWith(".git") && !file.name.startsWith("gradlew")
&& (file.relativePath(project.rootDir) == ".." || file.path.contains("src\\main"))) {
try {
properties.each { key, value ->
if (file.name.contains(key.toString())) {
def newName = file.name.replace(key.toString(), value.toString())
def newFile = new File(file.parentFile, newName)
if (file.renameTo(newFile)) {
println("Renamed '${file.name}'")
} else {
println("Failed to rename '${file.name}'")
}
}
}
} catch (IOException ex) {
println("Error renaming file '${file.path}': ${ex}")
}
}
}

file(".").eachFileRecurse { file ->
if (file.isFile() && !file.name.startsWith(".git") && !file.name.startsWith("gradlew")
&& (file.relativePath(project.rootDir) == ".." || file.path.contains("src\\main"))) {
try {
def content = file.text
properties.each { key, value ->
content = content.replaceAll(key.toString(), value.toString())
}
file.withWriter("UTF-8") { writer -> writer.write(content) }
} catch (IOException ex) {
println("Error updating contents of file '${file.path}': ${ex}")
}
}
String versionChangelog() {
List<String> lines = rootProject.file("CHANGELOG.md").readLines()
StringBuilder builder = new StringBuilder()
for (int i = 4; i < lines.size(); i++) {
String line = lines.get(i)
if (line.isBlank()) {
// pass
} else if (line.startsWith("## ")) {
break
}
else {
if (!builder.isEmpty()) builder.append("\n")
builder.append(line)
}
}
return builder.toString()
}

static String capsLoader(String loader) {
Expand Down
7 changes: 3 additions & 4 deletions buildSrc/src/main/groovy/multiloader-common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ repositories {
}

sourcesJar {
from(rootProject.file("LICENSE")) {
from(rootProject.file("LICENSE.txt")) {
rename { "${it}_${mod_name}" }
}
}

jar {
from(rootProject.file("LICENSE")) {
from(rootProject.file("LICENSE.txt")) {
rename { "${it}_${mod_name}" }
}

Expand All @@ -94,7 +94,6 @@ processResources {
"mod_version": mod_version,
"mod_group": mod_group,
"mod_id": mod_id,
"mod_id_alt": mod_id_alt,
"mod_name": mod_name,
"mod_description": mod_description,
"mod_icon": "assets/" + mod_id + "/icon.png",
Expand Down Expand Up @@ -129,7 +128,7 @@ processResources {
"clothconfig_versions_neoforge": clothconfig_versions_neoforge,
"modmenu_versions_fabric_list": asJsonList(modmenu_versions_fabric),
]
filesMatching(["pack.mcmeta", "*.mod.json", "META-INF/*mods.toml", "*.mixins.json"]) {
filesMatching(["pack.mcmeta", "*.mod.json", "META-INF/*mods.toml", "*.mixins.json", "assets/"+mod_id+"/lang/*.json"]) {
expand expandProps
}
inputs.properties(expandProps)
Expand Down
Empty file removed changelog.md
Empty file.
7 changes: 4 additions & 3 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ plugins {

dependencies {
compileOnly("org.spongepowered:mixin:${mixin_version}")
compileOnly("io.github.llamalad7:mixinextras-common:${mixinextras_version}")
annotationProcessor("io.github.llamalad7:mixinextras-common:${mixinextras_version}")
compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:${mixinextras_version}"))

// Mod dependencies use NeoForge version to avoid remapping complications
// MouseTweaks
implementation("maven.modrinth:aC3cM3Vq:${mousetweaks_version_neoforge}")

// Cloth Config API
api("me.shedaniel.cloth:cloth-config-neoforge:${clothconfig_version}")
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 Siphalor
* Copyright 2022 Siphalor
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 Siphalor
* Copyright 2022 Siphalor
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 Siphalor
* Copyright 2022 Siphalor
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 Siphalor
* Copyright 2022 Siphalor
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 Siphalor
* Copyright 2022 Siphalor
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 Siphalor
* Copyright 2022 Siphalor
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 Siphalor
* Copyright 2022 Siphalor
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 Siphalor
* Copyright 2022 Siphalor
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 Siphalor
* Copyright 2022 Siphalor
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 Siphalor
* Copyright 2022 Siphalor
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 Siphalor
* Copyright 2022 Siphalor
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 Siphalor
* Copyright 2022 Siphalor
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 Siphalor
* Copyright 2022 Siphalor
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 Siphalor
* Copyright 2022 Siphalor
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 Siphalor
* Copyright 2022 Siphalor
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 Siphalor
* Copyright 2022 Siphalor
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 Siphalor
* Copyright 2022 Siphalor
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 Siphalor
* Copyright 2022 Siphalor
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 Siphalor
* Copyright 2022 Siphalor
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Loading

0 comments on commit a3b48cb

Please sign in to comment.