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 16, 2024
1 parent 3dbc207 commit 9c7aa2c
Show file tree
Hide file tree
Showing 18 changed files with 189 additions and 89 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Builds the project and publishes the artifacts to GitHub, Modrinth and CurseForge
# Requires GITHUB_TOKEN to have write permissions; if not, replace it with a custom token
# Requires a Modrinth PAT MODRINTH_TOKEN
# Requires a CurseForge API token CURSEFORGE_TOKEN
# Modrinth publishing requires a Modrinth PAT MODRINTH_TOKEN
# Will skip without error if not present
# CurseForge publishing requires a CurseForge API token CURSEFORGE_TOKEN
# Will skip without error if not present
name: Release

on: [workflow_dispatch]
on:
workflow_dispatch:

permissions:
contents: write
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ run/
runs/
out/
classes/
.eclipse/

# IDEA
.idea/
Expand Down
13 changes: 13 additions & 0 deletions LICENSE_HEADER
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright ${year} ${owner_name}

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## Archival Notice

The functionality of this mod is now covered by [CommandKeys](https://modrinth.com/mod/65UyswbY).
The functionality of this mod is now covered by [CommandKeys](https://modrinth.com/mod/65UyswbY) (`%lastsent%` placeholder).

This project will no longer receive normal updates, but requests will still be considered.
This project will no longer receive normal updates, but requests may still be considered.

<img alt="Icon" width=100 src="https://raw.githubusercontent.com/TerminalMC/Resend/HEAD/common/src/main/resources/assets/resend/icon.png">

Expand Down
38 changes: 32 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,28 @@ plugins {
id("net.darkhax.curseforgegradle") version("${curseforgegradle_version}")
id("com.github.breadmoirai.github-release") version("${githubrelease_version}")
id("org.ajoberstar.grgit.service") version("${grgitservice_version}")
id("org.cadixdev.licenser") version("${licenser_version}")
}

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("LICENSE_HEADER")
properties {
project_name = mod_name
owner_name = mod_owner
year = java.time.LocalDate.now().getYear().toString()
}
}

// Publishing
if (name != "common") {
apply(plugin: "com.modrinth.minotaur")
Expand All @@ -24,7 +40,7 @@ subprojects {
projectId = modrinth_id
versionNumber = mod_version
versionType = release_type
versionName = "v${mod_version}-${capsLoader(name)}-${minecraft_version}"
versionName = "v${mod_version}-${capsLoader(name)}"
changelog = rootProject.file("changelog.md").text
uploadFile = name == "fabric" ? remapJar : jar
loaders = project.property("release_mod_loaders_${name}").split(",") as List
Expand Down Expand Up @@ -54,17 +70,16 @@ subprojects {
tasks.modrinthSyncBody.onlyIf { System.getenv().MODRINTH_TOKEN }

task curseforge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) {
apiToken = System.getenv().CURSEFORGE_TOKEN ? System.getenv().CURSEFORGE_TOKEN : ""
if (apiToken.isBlank()) return
apiToken = System.getenv().CURSEFORGE_TOKEN ? System.getenv().CURSEFORGE_TOKEN : "empty"

disableVersionDetection()
String module = project.name

def file = upload(curseforge_id, module == "fabric" ? remapJar : jar)
file.displayName = "v${mod_version}-${capsLoader(module)}-${minecraft_version}"
file.displayName = "v${mod_version}-${capsLoader(module)}"
file.releaseType = release_type
file.changelog = rootProject.file("changelog.md").text
file.changelogType = 'markdown'
file.changelogType = "markdown"
project.property("release_mod_loaders_${module}").split(",").each { String id ->
file.addModLoader(id)
}
Expand Down Expand Up @@ -97,7 +112,18 @@ subprojects {
repo = github_repo
tagName = "v${mod_version}"
prerelease = release_type == "alpha" || release_type == "beta"
releaseName = "v${mod_version} for ${minecraft_version}"
releaseName = "v${mod_version}"

String changelog = "\nChangelog\n" + rootProject.file("changelog.md").text
String versions = "MC versions\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

body = rootProject.file("changelog.md").text
targetCommitish = grgitService.service.get().grgit.branch.current().name
overwrite = false
Expand Down
43 changes: 16 additions & 27 deletions buildSrc/src/main/groovy/multiloader-common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ plugins {
}

base {
archivesName = "${mod_id}-${project.name}-${minecraft_version}"
archivesName = "${mod_id}-${project.name}"
}

java {
toolchain.languageVersion = JavaLanguageVersion.of(java_version)
withSourcesJar()
withJavadocJar()
// withJavadocJar() // Also uncomment javadocElements in capabilities below
}

repositories {
Expand All @@ -19,38 +19,34 @@ repositories {
exclusiveContent {
forRepository {
maven {
name = 'Sponge'
url = 'https://repo.spongepowered.org/repository/maven-public'
name = "Sponge"
url = "https://repo.spongepowered.org/repository/maven-public"
}
}
filter { includeGroupAndSubgroups('org.spongepowered') }
filter { includeGroupAndSubgroups("org.spongepowered") }
}
exclusiveContent {
forRepositories(
maven {
name = 'ParchmentMC'
url = 'https://maven.parchmentmc.org/'
},
maven {
name = "NeoForge"
url = 'https://maven.neoforged.net/releases'
}
maven {
name = "ParchmentMC"
url = "https://maven.parchmentmc.org"
},
maven {
name = "NeoForge"
url = "https://maven.neoforged.net/releases"
}
)
filter { includeGroup('org.parchmentmc.data') }
filter { includeGroup("org.parchmentmc.data") }
}
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
maven {
name = "Shedaniel"
url = "https://maven.shedaniel.me/"
}
}

// Declare capabilities on the outgoing configurations.
// Read more about capabilities here: https://docs.gradle.org/current/userguide/component_capabilities.html#sec:declaring-additional-capabilities-for-a-local-component
["apiElements", "runtimeElements", "sourcesElements", "javadocElements"].each { variant ->
["apiElements", "runtimeElements", "sourcesElements", /*"javadocElements"*/].each { variant ->
configurations."$variant".outgoing {
capability("$group:${base.archivesName.get()}:$version")
capability("$group:$mod_id-${project.name}-${minecraft_version}:$version")
Expand Down Expand Up @@ -103,7 +99,6 @@ processResources {
"mod_authors_string": mod_authors.replace(",", ", "),
"mod_contributors_string": mod_contributors.replace(",", ", "),
"mod_license": mod_license,
"mod_environment": mod_environment,
// Links
"homepage_url": homepage_url,
"sources_url": sources_url,
Expand All @@ -122,14 +117,8 @@ processResources {
// NeoForge
"neoforge_loader_versions": neoforge_loader_versions,
"neoforge_versions": neoforge_versions,
// Dependencies
"clothconfig_versions_fabric_list": asJsonList(clothconfig_versions_fabric),
"clothconfig_versions_neoforge": clothconfig_versions_neoforge,
"yacl_versions_fabric_list": asJsonList(yacl_versions_fabric),
"yacl_versions_neoforge": yacl_versions_neoforge,
"modmenu_versions_fabric_list": asJsonList(modmenu_versions),
]
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
16 changes: 16 additions & 0 deletions common/src/main/java/dev/terminalmc/resend/Resend.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package dev.terminalmc.resend;

import com.mojang.blaze3d.platform.InputConstants;
Expand Down
16 changes: 16 additions & 0 deletions common/src/main/java/dev/terminalmc/resend/util/Localization.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package dev.terminalmc.resend.util;

import dev.terminalmc.resend.Resend;
Expand Down
16 changes: 16 additions & 0 deletions common/src/main/java/dev/terminalmc/resend/util/ModLogger.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package dev.terminalmc.resend.util;

import org.apache.logging.log4j.Level;
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# https://docs.neoforged.net/docs/advanced/accesstransformers/
# https://docs.neoforged.net/docs/advanced/accesstransformers
3 changes: 3 additions & 0 deletions common/src/main/resources/assets/resend/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"resend.name": "Resend",

"modmenu.descriptionTranslation.framework": "${mod_description}",
"fml.menu.mods.info.description.framework": "${mod_description}",

"key.resend.group": "Resend",
"key.resend.group.resend": "Resend Last Message or Command"
}
1 change: 1 addition & 0 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies {
parchment("org.parchmentmc.data:parchment-${parchment_minecraft_version}:${parchment_version}@zip")
}

// Fabric loader and API
modImplementation("net.fabricmc:fabric-loader:${fabric_loader_version}")
modImplementation("net.fabricmc.fabric-api:fabric-api:${fabric_api_version}")
}
Expand Down
16 changes: 16 additions & 0 deletions fabric/src/main/java/dev/terminalmc/resend/ResendFabric.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2024 TerminalMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package dev.terminalmc.resend;

import net.fabricmc.api.ClientModInitializer;
Expand Down
2 changes: 1 addition & 1 deletion fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"contributors": [$mod_contributors_list],
"license": "${mod_license}",

"environment": "${mod_environment}",
"environment": "client",

"provides": [],

Expand Down
Loading

0 comments on commit 9c7aa2c

Please sign in to comment.