Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
uses: actions/checkout@v4
- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v4
- name: Set up JDK 21
- name: Set up JDK 25
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
java-version: 25
check-latest: true
- name: Build with Gradle
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:
uses: christian-draeger/read-properties@1.1.1
with:
path: gradle.properties
properties: mod_version minecraft_version
properties: mod_version
- name: Create a release
uses: softprops/action-gh-release@v2.3.2
with:
tag_name: "${{ steps.mod_properties.outputs.mod_version }}-mc${{ steps.mod_properties.outputs.minecraft_version }}"
name: "${{ steps.mod_properties.outputs.mod_version }}-mc${{ steps.mod_properties.outputs.minecraft_version }}"
tag_name: "${{ steps.mod_properties.outputs.mod_version }}-mc0.0"
name: "${{ steps.mod_properties.outputs.mod_version }}-mc0.0"
body: No changelog available.
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/publish-fabric.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
uses: actions/checkout@v4
- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v4
- name: Set up JDK 21
- name: Set up JDK 25
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
java-version: 25
check-latest: true
- name: Build with Gradle
run: |
Expand All @@ -39,11 +39,11 @@ jobs:
uses: shogo82148/actions-upload-release-asset@v1.8.1
with:
upload_url: ${{ steps.latest_release.outputs.upload_url }}
asset_path: fabric/build/libs/craftgr-*-mc*-fabric.jar
asset_path: fabric/build/libs/craftgr-fabric-*-mc*.jar
- name: Publish Fabric artifact
uses: Kir-Antipov/mc-publish@v3.3.0
with:
files: fabric/build/libs/craftgr-*-mc*-fabric.jar
files: fabric/build/libs/craftgr-fabric-*-mc*.jar
modrinth-id: lKYr4L6w
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
curseforge-id: 1009348
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish-neoforge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
uses: actions/checkout@v4
- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v4
- name: Set up JDK 21
- name: Set up JDK 25
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
java-version: 25
check-latest: true
- name: Build with Gradle
run: |
Expand All @@ -39,11 +39,11 @@ jobs:
uses: shogo82148/actions-upload-release-asset@v1.8.1
with:
upload_url: ${{ steps.latest_release.outputs.upload_url }}
asset_path: neoforge/build/libs/craftgr-*-mc*-neoforge.jar
asset_path: neoforge/build/libs/craftgr-neoforge-*-mc*.jar
- name: Publish NeoForge artifact
uses: Kir-Antipov/mc-publish@v3.3.0
with:
files: neoforge/build/libs/craftgr-*-mc*-neoforge.jar
files: neoforge/build/libs/craftgr-neoforge-*-mc*.jar
modrinth-id: lKYr4L6w
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
curseforge-id: 1009348
Expand Down
49 changes: 35 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,44 @@
.gradle
build/
*.ipr
run/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
.kotlin

### IntelliJ IDEA ###
.idea/
*.iws
out/
*.iml
.gradle/
output/
bin/
libs/
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.idea/
classes/
.metadata
.vscode
.settings
*.launch
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

.architectury-transformer/
### Mac OS ###
.DS_Store

/clean.bat
### Test output ###
fabric/run/
neoforge/run/
61 changes: 0 additions & 61 deletions build.gradle

This file was deleted.

23 changes: 23 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
plugins {
alias(libs.plugins.fabric.loom) apply false
alias(libs.plugins.neoforge.moddev) apply false
}

/* Project Properties */
val modGroup = project.property("mod_group") as String
val modId = project.property("mod_id") as String
val modVersion = project.property("mod_version") as String

allprojects {
group = modGroup
version = modVersion
}

subprojects {
repositories {
mavenCentral()
maven("https://maven.isxander.dev/releases")
maven("https://maven.terraformersmc.com/")
maven("https://jitpack.io/")
}
}
13 changes: 13 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
}

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(25))
}
}
81 changes: 81 additions & 0 deletions buildSrc/src/main/kotlin/common.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package io.github.kabanfriends.craftgr.build

plugins {
`java-library`
}

/* Project Properties */
val modName = project.property("mod_name") as String
val modId = project.property("mod_id") as String

val minecraftVersion = versionCatalogs.named("libs").findVersion("minecraft").get().toString()

base {
archivesName.set("${modId}-${project.name}")
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(25))
}
withSourcesJar()
}

repositories {
mavenCentral()
}

listOf("apiElements", "runtimeElements", "sourcesElements", "javadocElements").forEach { it ->
configurations.findByName(it)?.let { cfg ->
cfg.outgoing {
capability("${group}:${project.name}:${version}")
capability("${group}:${base.archivesName.get()}:${version}")
capability("${group}:${modId}-${project.name}-${minecraftVersion}:${version}")
capability("${group}:${modId}:${version}")
}
}
}

tasks {
jar {
from(rootProject.file("LICENSE")) {
into("/")
}

manifest {
attributes(
"Specification-Title" to project.name,
"Specification-Version" to project.version,
"Implementation-Title" to tasks.jar.get().archiveVersion,
"Implementation-Title" to project.name,
)
}

archiveClassifier.set("mc${minecraftVersion}")
}

processResources {
val props = mapOf(
"version" to project.version,
"name" to modName,
"id" to modId,
"minecraft_version" to minecraftVersion.replace("rc-", "rc."),
"fabric_loader_version" to versionCatalogs.named("libs").findVersion("fabric-loader").get().toString(),
"fabric_api_version" to versionCatalogs.named("libs").findVersion("fabric-api").get().toString(),
"neoforge_version" to versionCatalogs.named("libs").findVersion("neoforge-loader").get().toString(),
"mod_menu_version" to versionCatalogs.named("libs").findVersion("mod-menu").get().toString(),
"yacl_version_fabric" to versionCatalogs.named("libs").findVersion("yacl-fabric").get().toString(),
"yacl_version_neoforge" to versionCatalogs.named("libs").findVersion("yacl-neoforge").get().toString(),
)

filesMatching(listOf("META-INF/mods.toml", "META-INF/neoforge.mods.toml")) {
expand(props)
}

filesMatching(listOf("pack.mcmeta", "fabric.mod.json", "*.mixins.json")) {
expand(props)
}

inputs.properties(props)
}
}
58 changes: 58 additions & 0 deletions buildSrc/src/main/kotlin/loader.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package io.github.kabanfriends.craftgr.build

plugins {
id("io.github.kabanfriends.craftgr.build.common")
}

/* Project Properties */
val modId = project.property("mod_id") as String

configurations {
val commonJava by creating {
isCanBeResolved = true
}
val commonResources by creating {
isCanBeResolved = true
}
}

dependencies {
compileOnly(project(":common")) {
capabilities {
requireCapability("${group}:${modId}")
}
attributes {
attribute(
Attribute.of("io.github.mcgradleconventions.loader", String::class.java),
"common"
)
}
}

"commonJava"(project(path = ":common", configuration = "commonJava"))
"commonResources"(project(path = ":common", configuration = "commonResources"))
}

tasks {
processResources {
dependsOn(configurations["commonResources"])
from(configurations["commonResources"])
}

named("compileJava", JavaCompile::class) {
dependsOn(configurations["commonJava"])
source(configurations["commonJava"])
}

named("javadoc", Javadoc::class) {
dependsOn(configurations["commonJava"])
source(configurations["commonJava"])
}

named("sourcesJar", Jar::class) {
dependsOn(configurations["commonJava"])
from(configurations["commonJava"])
dependsOn(configurations["commonResources"])
from(configurations["commonResources"])
}
}
Loading
Loading