From c9ff02f5637cc04d40e8429e544a2ddebba5ee2a Mon Sep 17 00:00:00 2001
From: melontini <104443436+melontini@users.noreply.github.com>
Date: Mon, 15 Apr 2024 00:35:50 +0700
Subject: [PATCH 1/3] Fix configuration target
---
build.gradle | 1 +
1 file changed, 1 insertion(+)
diff --git a/build.gradle b/build.gradle
index d2e84c1..ef5909e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -38,6 +38,7 @@ sourceSets {
loom {
addRemapConfiguration("testmodRemapImplementation", (RemapConfigurationSettings configuration) -> {
configuration.getTargetConfigurationName().convention("testmodImplementation")
+ configuration.getSourceSet().convention(sourceSets.testmod)
configuration.getOnCompileClasspath().convention(true)
configuration.getOnRuntimeClasspath().convention(true)
configuration.getPublishingMode().convention(RemapConfigurationSettings.PublishingMode.COMPILE_AND_RUNTIME)
From ddbe29294be5b0a7025f1d44f8c33233aff07c1a Mon Sep 17 00:00:00 2001
From: melontini <104443436+melontini@users.noreply.github.com>
Date: Mon, 15 Apr 2024 00:36:29 +0700
Subject: [PATCH 2/3] [ci skip] Remove issue templates
---
.github/ISSUE_TEMPLATE/bug_report.yml | 49 -------------------------
.github/ISSUE_TEMPLATE/config.yml | 5 ---
.github/ISSUE_TEMPLATE/crash_report.yml | 41 ---------------------
3 files changed, 95 deletions(-)
delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml
delete mode 100644 .github/ISSUE_TEMPLATE/config.yml
delete mode 100644 .github/ISSUE_TEMPLATE/crash_report.yml
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
deleted file mode 100644
index 19d45b4..0000000
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ /dev/null
@@ -1,49 +0,0 @@
-name: Bug Report
-description: File a bug report
-title: "[Bug]: "
-labels: ["bug"]
-body:
- - type: markdown
- attributes:
- value: |
- Thanks for taking the time to fill out this bug report!
- Before proceeding, please make sure to do this first. 📋
- - Ensure you are running the **latest** version of the mod.
- - A similar issue hasn't been filled before.
- - type: textarea
- id: what-happened
- attributes:
- label: What happened?
- description: Also tell us, what did you expect to happen?
- placeholder: Tell us what you see!
- value: "A bug happened!"
- validations:
- required: true
- - type: textarea
- attributes:
- label: Screenshots
- description: If applicable, add screenshots to help explain your problem.
- validations:
- required: false
- - type: input
- attributes:
- label: Logs
- description: |
- If available, add logs to help identify your problem.
- Please upload your log to [Github Gist](https://gist.github.com/), [mslo.gs](https://mclo.gs/) or any other pasting platform.
- validations:
- required: false
- - type: input
- id: mod-version
- attributes:
- label: Mod Version
- description: What version of the mod are you running?
- validations:
- required: true
- - type: input
- id: mc-version
- attributes:
- label: Minecraft Version
- description: What version of Minecraft are you running?
- validations:
- required: true
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
deleted file mode 100644
index 2c8b8a2..0000000
--- a/.github/ISSUE_TEMPLATE/config.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-blank_issues_enabled: false
-contact_links:
- - name: Suggesting Ideas | 💡
- url: https://github.com/constellation-mc/recipe_book_is_pain/discussions/categories/ideas
- about: If you have a suggestion, please post it here. Be sure to check pinned to see how to make a good suggestion!
diff --git a/.github/ISSUE_TEMPLATE/crash_report.yml b/.github/ISSUE_TEMPLATE/crash_report.yml
deleted file mode 100644
index 19c107a..0000000
--- a/.github/ISSUE_TEMPLATE/crash_report.yml
+++ /dev/null
@@ -1,41 +0,0 @@
-name: Crash Report
-description: File a crash report
-title: "[Crash]: "
-labels: ["crash"]
-body:
- - type: markdown
- attributes:
- value: |
- Thanks for taking the time to fill out this crash report!
- Before proceeding, please make sure to do this first. 📋
- - Ensure you are running the **latest** version of the mod.
- - A similar report hasn't been filled before.
- - type: textarea
- id: what-happened
- attributes:
- label: What happened?
- description: Please explain in detail how this crash happened.
- validations:
- required: true
- - type: input
- attributes:
- label: Logs
- description: |
- `latest.log` or `crash-20xx-xx-xx_xx.xx.xx-(client/server).log`.
- Please upload your log to [Github Gist](https://gist.github.com/), [mslo.gs](https://mclo.gs/) or any other pasting platform.
- validations:
- required: true
- - type: input
- id: mod-version
- attributes:
- label: Mod Version
- description: What version of the mod are you running?
- validations:
- required: true
- - type: input
- id: mc-version
- attributes:
- label: Minecraft Version
- description: What version of Minecraft are you running?
- validations:
- required: true
From d4ec695f33019b3de74c6066efb02b750475f344 Mon Sep 17 00:00:00 2001
From: melontini <104443436+melontini@users.noreply.github.com>
Date: Wed, 1 May 2024 02:42:31 +0700
Subject: [PATCH 3/3] General updates.
---
.github/dependabot.yml | 25 +++
.github/workflows/build.yml | 147 ++----------------
.github/workflows/build_pr.yml | 23 ---
.github/workflows/publish.yml | 23 +++
build.gradle | 118 ++++++++++----
gradle.properties | 6 +-
gradle/libs.versions.toml | 23 +++
spotbugs.xml | 16 ++
.../recipebookispain/RecipeBookIsPain.java | 6 +-
9 files changed, 192 insertions(+), 195 deletions(-)
create mode 100644 .github/dependabot.yml
delete mode 100644 .github/workflows/build_pr.yml
create mode 100644 .github/workflows/publish.yml
create mode 100644 gradle/libs.versions.toml
create mode 100644 spotbugs.xml
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..267906d
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,25 @@
+version: 2
+registries:
+ fabric:
+ url: "https://maven.fabricmc.net/"
+ type: maven-repository
+ gradle-plugins:
+ url: "https://plugins.gradle.org/m2/"
+ type: maven-repository
+ maven-central:
+ url: "https://repo1.maven.org/maven2/"
+ type: maven-repository
+
+updates:
+ - package-ecosystem: gradle
+ registries:
+ - fabric
+ - gradle-plugins
+ - maven-central
+ ignore:
+ - dependency-name: me.melontini:dark-matter*
+ - dependency-name: io.wispforest:owo-lib
+ - dependency-name: me.melontini:handy-tests
+ directory: /
+ schedule:
+ interval: weekly
\ No newline at end of file
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 918deb6..e4879df 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,139 +1,18 @@
name: build
-on:
- push:
- workflow_dispatch:
- inputs:
- version_type:
- description: "The type of this version. e.g alpha"
- type: choice
- default: beta
- options:
- - release
- - beta
- - alpha
- required: false
+on: [ push, pull_request ]
jobs:
build:
- runs-on: ubuntu-latest
- if: |
- !contains(github.event.head_commit.message, '[ci skip]')
- outputs:
- version_info: ${{ steps.get_version.outputs.version_info }}
- version_plain: ${{ steps.get_version.outputs.version_plain }}
- steps:
- - name: checkout repository
- uses: actions/checkout@v4.1.1
- - name: validate gradle wrapper
- uses: gradle/wrapper-validation-action@v2.1.1
- - name: setup jdk
- uses: actions/setup-java@v4.1.0
- with:
- distribution: 'temurin'
- java-version: 17
- cache: gradle
- - name: make gradle wrapper executable
- run: chmod +x ./gradlew
- - name: build
- run: ./gradlew build
- - name: get version #https://stackoverflow.com/questions/71089787/how-to-get-version-name-from-android-gradle-file-in-github-actions
- id: get_version
- run: |
- echo "version_info=$(${{github.workspace}}/gradlew -q printVersionName)" >> $GITHUB_OUTPUT
- echo "version_plain=$(${{github.workspace}}/gradlew -q printVersion)" >> $GITHUB_OUTPUT
- - name: capture build artifacts
- uses: actions/upload-artifact@v4.3.1
- with:
- name: Artifacts
- path: build/libs/
-
- client_test:
- needs: build
- runs-on: ubuntu-latest
- steps:
- - name: checkout repository
- uses: actions/checkout@v4.1.1
- - name: validate gradle wrapper
- uses: gradle/wrapper-validation-action@v2.1.1
- - name: setup jdk 17
- uses: actions/setup-java@v4.1.0
- with:
- distribution: 'temurin'
- java-version: 17
- cache: gradle
- - name: make gradle wrapper executable
- run: chmod +x ./gradlew
- - name: run testmod
- uses: modmuss50/xvfb-action@v1
- with:
- run: ./gradlew runTestClient --stacktrace --warning-mode=fail
- - uses: actions/upload-artifact@v4.3.1
- with:
- name: Test Screenshots
- path: run/screenshots
-
- packages:
- needs:
- - build
- - client_test
- runs-on: ubuntu-latest
- steps:
- - name: checkout repository
- uses: actions/checkout@v4.1.1
- - name: setup jdk
- uses: actions/setup-java@v4.1.0
- with:
- distribution: 'temurin'
- java-version: 17
- cache: gradle
- - name: make gradle wrapper executable
- run: chmod +x ./gradlew
- - name: publish
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
- ./gradlew publish
-
- publish:
- needs:
- - build
- - client_test
- runs-on: ubuntu-latest
- if: ${{ github.event_name == 'workflow_dispatch' }}
- steps:
- - name: checkout repository
- uses: actions/checkout@v4.1.1
- - uses: actions/download-artifact@v4.1.4
- with:
- name: Artifacts
- path: build/libs
-
- - name: publish release
- uses: Kir-Antipov/mc-publish@v3.3.0
- with:
- version-type: ${{ inputs.version_type }}
- changelog-file: CHANGELOG.md
- name: ${{ needs.build.outputs.version_info }}
- version: ${{ needs.build.outputs.version_plain }}
-
- game-versions: |
- 1.20.1
-
- loaders: |
- fabric
-
- java: |
- 17
-
- github-tag: v${{ needs.build.outputs.version_plain }}
- github-token: ${{ secrets.GITHUB_TOKEN }}
- github-commitish: ${{ github.sha }}
- github-prerelease: false
-
- modrinth-id: etNS9OnA
- modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
- modrinth-featured: true
- modrinth-unfeature-mode: subset
- modrinth-dependencies: |
- dark-matter(embedded)
+ uses: constellation-mc/actions/.github/workflows/gradle-build.yml@main
+ with:
+ java: 17
+ gradle_tasks: spotbugs
+ reviewdog: |
+ cat ./build/reports/spotbugs/main/spotbugs.sarif | reviewdog -name="spotbugs" -f=sarif -reporter=github-check -level=warning
+
+ run_tests:
+ uses: constellation-mc/actions/.github/workflows/mc-tests.yml@main
+ with:
+ java: 17
+ client_task: runTestClient
\ No newline at end of file
diff --git a/.github/workflows/build_pr.yml b/.github/workflows/build_pr.yml
deleted file mode 100644
index 1a4bf50..0000000
--- a/.github/workflows/build_pr.yml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-name: build pull request
-on: [ pull_request ]
-
-jobs:
- build:
- runs-on: ubuntu-latest
- steps:
- - name: checkout repository
- uses: actions/checkout@v4.1.1
- - name: validate gradle wrapper
- uses: gradle/wrapper-validation-action@v2.1.1
- - name: setup jdk 17
- uses: actions/setup-java@v4.1.0
- with:
- distribution: 'temurin'
- java-version: 17
- cache: gradle
- - name: make gradle wrapper executable
- run: chmod +x ./gradlew
- - name: build
- run: |
- ./gradlew build
\ No newline at end of file
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
new file mode 100644
index 0000000..5cc4533
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,23 @@
+
+name: publish
+on:
+ workflow_dispatch:
+ inputs:
+ version_type:
+ description: "The type of this version. e.g alpha"
+ type: choice
+ default: BETA
+ options:
+ - STABLE
+ - BETA
+ - ALPHA
+ - NONE
+ required: false
+
+jobs:
+ publish:
+ uses: constellation-mc/actions/.github/workflows/mc-publish.yml@main
+ with:
+ java: 17
+ version_type: ${{ inputs.version_type }}
+ secrets: inherit
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index ef5909e..31457b8 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,8 +1,14 @@
+import com.github.spotbugs.snom.SpotBugsTask
+import me.modmuss50.mpp.ReleaseType
import net.fabricmc.loom.api.RemapConfigurationSettings
plugins {
- id 'fabric-loom' version '1.6-SNAPSHOT'
+ alias libs.plugins.fabric.loom
id 'maven-publish'
+ alias libs.plugins.lombok
+ alias libs.plugins.spotbugs.base
+ alias libs.plugins.spotless
+ alias libs.plugins.modmuss50.publish
}
def local = !System.getenv().containsKey("GITHUB_RUN_NUMBER")
@@ -41,7 +47,7 @@ loom {
configuration.getSourceSet().convention(sourceSets.testmod)
configuration.getOnCompileClasspath().convention(true)
configuration.getOnRuntimeClasspath().convention(true)
- configuration.getPublishingMode().convention(RemapConfigurationSettings.PublishingMode.COMPILE_AND_RUNTIME)
+ configuration.getPublishingMode().convention(RemapConfigurationSettings.PublishingMode.NONE)
})
}
@@ -49,18 +55,43 @@ dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
- modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
+ modImplementation libs.fabric.loader
- def dmModules = ["base", "mixin", "minecraft", "enums", "recipe-book"]
- for (final def module in dmModules) {
- modApi include("me.melontini:dark-matter-${module}:${project.dark_matter}")
+ def dm = libs.dark.matter
+ [dm.base, dm.mixin, dm.minecraft, dm.enums, dm.recipe.book].each {
+ modApi it
+ include it
}
- modApi("me.melontini:dark-matter-item-group:${project.dark_matter}")
- modCompileOnly("io.wispforest:owo-lib:${project.owo_version}")
+ modImplementation libs.dark.matter.item.group
+ modCompileOnly libs.owo
testmodImplementation sourceSets.main.output
- testmodRemapImplementation "me.melontini:handy-tests:0.1.0-1.20.1-build.2"
+ testmodRemapImplementation libs.handy.tests
+}
+
+tasks.register("spotbugs", SpotBugsTask) { task ->
+ sourceSets.each {
+ task.sourceDirs.from(task.sourceDirs.files, it.allSource.sourceDirectories)
+ task.classDirs.from(task.classDirs.files, it.output)
+ task.auxClassPaths.from(task.auxClassPaths.files, it.compileClasspath)
+ }
+ excludeFilter = file("spotbugs.xml")
+ ignoreFailures = true
+ reports {
+ if (local) {
+ html {
+ required = true
+ outputLocation = file("$buildDir/reports/spotbugs/main/spotbugs.html")
+ stylesheet = 'fancy-hist.xsl'
+ }
+ } else {
+ sarif {
+ required = true
+ outputLocation = file("$buildDir/reports/spotbugs/main/spotbugs.sarif")
+ }
+ }
+ }
}
loom {
@@ -82,9 +113,9 @@ loom.mods.register(project.name + "-testmod") {
processResources {
def map = [
- "version": project.version,
+ "version" : project.version,
"minecraft_version": project.minecraft_version,
- "loader_version": project.loader_version
+ "loader_version" : libs.fabric.loader.get().version
]
inputs.properties(map)
filteringCharset "UTF-8"
@@ -114,18 +145,6 @@ java {
withSourcesJar()
}
-tasks.register('printVersionName') {
- doLast {
- println "${project.mod_version} (${project.minecraft_version})"
- }
-}
-
-tasks.register('printVersion') {
- doLast {
- println version
- }
-}
-
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
@@ -141,14 +160,53 @@ publishing {
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
- repositories {
- maven {
- name = "GitHubPackages"
- url = "https://maven.pkg.github.com/constellation-mc/recipe_book_is_pain"
- credentials {
- username = System.getenv("GITHUB_ACTOR")
- password = System.getenv("GITHUB_TOKEN")
+ if (!local) {
+ repositories {
+ maven {
+ name = "GitHubPackages"
+ url = "https://maven.pkg.github.com/constellation-mc/recipe_book_is_pain"
+ credentials {
+ username = System.getenv("GITHUB_ACTOR")
+ password = System.getenv("GITHUB_TOKEN")
+ }
}
}
}
}
+
+publishMods {
+ file = remapJar.archiveFile
+ additionalFiles.from(remapSourcesJar.archiveFile)
+
+ changelog = file("CHANGELOG.md").text
+ type = ReleaseType.valueOf(providers.environmentVariable("VERSION_TYPE").getOrElse("BETA"))
+ modLoaders.add("fabric")
+
+ displayName = "${project.mod_version} (${project.minecraft_version})"
+
+ modrinth {
+ projectId = "etNS9OnA"
+ accessToken = providers.environmentVariable("MODRINTH_TOKEN")
+ minecraftVersions.add("${project.minecraft_version}")
+
+ requires("fabric-api")
+ embeds("dark-matter")
+ }
+ curseforge {
+ projectId = "643246"
+ accessToken = providers.environmentVariable("CURSEFORGE_TOKEN")
+ minecraftVersions.add("${project.minecraft_version}")
+
+ requires("fabric-api")
+ embeds("dark-matter")
+ }
+ github {
+ repository = "constellation-mc/recipe_book_is_pain"
+ accessToken = providers.environmentVariable("GITHUB_TOKEN")
+ commitish = providers.environmentVariable("GITHUB_SHA").getOrElse("${project.minecraft_version}-fabric")
+
+ type = STABLE
+ }
+
+ dryRun = local
+}
diff --git a/gradle.properties b/gradle.properties
index e4ae459..0af62a8 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -4,11 +4,7 @@ org.gradle.jvmargs=-Xmx1G
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
-loader_version=0.15.10
# Mod Properties
-mod_version=0.11.1
+mod_version=0.11.2
maven_group=me.melontini
archives_base_name=recipe-book-is-pain
-
-dark_matter=4.0.0-1.20.1-build.481
-owo_version=0.11.2+1.20
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
new file mode 100644
index 0000000..2fb76ea
--- /dev/null
+++ b/gradle/libs.versions.toml
@@ -0,0 +1,23 @@
+[versions]
+dark-matter = "4.0.1-1.20.1-build.76"
+
+[libraries]
+fabric-loader = { group = "net.fabricmc", name = "fabric-loader", version = "0.15.10" }
+
+dark-matter-base = { group = "me.melontini", name = "dark-matter-base", version.ref = "dark-matter" }
+dark-matter-mixin = { group = "me.melontini", name = "dark-matter-mixin", version.ref = "dark-matter" }
+dark-matter-minecraft = { group = "me.melontini", name = "dark-matter-minecraft", version.ref = "dark-matter" }
+dark-matter-enums = { group = "me.melontini", name = "dark-matter-enums", version.ref = "dark-matter" }
+dark-matter-recipe-book = { group = "me.melontini", name = "dark-matter-recipe-book", version.ref = "dark-matter" }
+dark-matter-item-group = { group = "me.melontini", name = "dark-matter-item-group", version.ref = "dark-matter" }
+
+owo = { group = "io.wispforest", name = "owo-lib", version = "0.11.2+1.20" }
+
+handy-tests = { group = "me.melontini", name = "handy-tests", version = "0.1.0-1.20.1-build.4" }
+
+[plugins]
+fabric-loom = { id = "fabric-loom", version = "1.6.11" }
+lombok = { id = "io.freefair.lombok", version = "8.6"}
+spotbugs-base = { id = "com.github.spotbugs-base", version = "6.0.12" }
+spotless = { id = "com.diffplug.spotless", version = "6.25.0" }
+modmuss50-publish = { id = "me.modmuss50.mod-publish-plugin", version = "0.5.1" }
\ No newline at end of file
diff --git a/spotbugs.xml b/spotbugs.xml
new file mode 100644
index 0000000..edc2a76
--- /dev/null
+++ b/spotbugs.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/me/melontini/recipebookispain/RecipeBookIsPain.java b/src/main/java/me/melontini/recipebookispain/RecipeBookIsPain.java
index c0c9345..742cf30 100644
--- a/src/main/java/me/melontini/recipebookispain/RecipeBookIsPain.java
+++ b/src/main/java/me/melontini/recipebookispain/RecipeBookIsPain.java
@@ -25,9 +25,9 @@ public class RecipeBookIsPain {
public static final boolean isOwOLoaded = FabricLoader.getInstance().isModLoaded("owo");
public static final boolean isDarkMatterContentLoaded = FabricLoader.getInstance().isModLoaded("dark-matter-content");
- public static List CRAFTING_SEARCH_LIST = new ArrayList<>();
- public static List CRAFTING_LIST = new ArrayList<>();
- public static BiMap RECIPE_BOOK_GROUP_TO_ITEM_GROUP = HashBiMap.create();
+ public static final List CRAFTING_SEARCH_LIST = new ArrayList<>();
+ public static final List CRAFTING_LIST = new ArrayList<>();
+ public static final BiMap RECIPE_BOOK_GROUP_TO_ITEM_GROUP = HashBiMap.create();
public static ItemGroup toItemGroup(RecipeBookGroup recipeBookGroup) {
return RECIPE_BOOK_GROUP_TO_ITEM_GROUP.get(recipeBookGroup);