generated from devOS-Sanity-Edition/fabric-nautical-template-kt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3e57e9c
Showing
18 changed files
with
762 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: build | ||
on: [ pull_request, push ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
PUBLISH_SUFFIX: snapshots | ||
MAVEN_USER: ${{ secrets.MAVEN_USER }} | ||
MAVEN_PASS: ${{ secrets.MAVEN_PASS }} | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup JDK (Java 17) | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: 21 | ||
distribution: 'temurin' | ||
|
||
- name: gradlew Permission Grant | ||
run: chmod +x gradlew | ||
|
||
- name: Build w/ Gradle | ||
run: ./gradlew buildOrPublish | ||
|
||
- name: Capture Build Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Artifacts | ||
path: build/libs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# gradle | ||
|
||
.gradle/ | ||
build/ | ||
out/ | ||
classes/ | ||
|
||
# eclipse | ||
|
||
*.launch | ||
|
||
# idea | ||
|
||
.idea/ | ||
*.iml | ||
*.ipr | ||
*.iws | ||
|
||
# vscode | ||
|
||
.settings/ | ||
.vscode/ | ||
bin/ | ||
.classpath | ||
.project | ||
|
||
# macos | ||
|
||
*.DS_Store | ||
|
||
# fabric | ||
|
||
run/ | ||
|
||
# java | ||
|
||
hs_err_*.log | ||
replay_*.log | ||
*.hprof | ||
*.jfr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 devOS: Sanity Edition, Team Nautical | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Fabric Nautical Template | ||
Team Nautical's take on the Fabric Example Mod but Kotlin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
plugins { | ||
kotlin("jvm") version "2.0.20" | ||
`maven-publish` | ||
java | ||
|
||
alias(libs.plugins.grgit) | ||
alias(libs.plugins.fabric.loom) | ||
} | ||
|
||
val archivesBaseName = "${project.property("archives_base_name").toString()}+mc${libs.versions.minecraft.get()}" | ||
version = getModVersion() | ||
group = project.property("maven_group")!! | ||
|
||
repositories { | ||
maven("https://api.modrinth.com/maven") | ||
maven("https://maven.terraformersmc.com/") | ||
maven("https://maven.parchmentmc.org") | ||
maven("https://mvn.devos.one/snapshots") | ||
maven("https://maven.quiltmc.org/repository/release/") | ||
} | ||
|
||
//All dependencies and their versions are in ./gradle/libs.versions.toml | ||
dependencies { | ||
|
||
minecraft(libs.minecraft) | ||
|
||
mappings(loom.layered { | ||
officialMojangMappings() | ||
parchment("org.parchmentmc.data:parchment-1.21:2024.07.28@zip") | ||
// mappings("${libs.quilt.mappings.get()}:intermediary-v2") // if you wanna deal with it be my guest, im not - asoji | ||
}) | ||
|
||
//Fabric | ||
modImplementation(libs.fabric.loader) | ||
modImplementation(libs.fabric.api) | ||
modImplementation(libs.fabric.language.kotlin) | ||
|
||
//Mods | ||
modImplementation(libs.bundles.dependencies) | ||
modLocalRuntime(libs.bundles.dev.mods) | ||
|
||
include(modImplementation("gay.asoji:fmw:1.0.0+build.8")!!) // just to avoid the basic long metadata calls | ||
} | ||
|
||
// Write the version to the fabric.mod.json | ||
tasks.processResources { | ||
inputs.property("version", project.version) | ||
|
||
filesMatching("fabric.mod.json") { | ||
expand(mutableMapOf("version" to project.version)) | ||
} | ||
} | ||
|
||
tasks.withType<JavaCompile>().configureEach { | ||
options.release.set(21) | ||
} | ||
|
||
java { | ||
withSourcesJar() | ||
|
||
sourceCompatibility = JavaVersion.VERSION_21 | ||
targetCompatibility = JavaVersion.VERSION_21 | ||
} | ||
|
||
tasks.jar { | ||
from("LICENSE") { | ||
rename { "${it}_${project.base.archivesName.get()}"} | ||
} | ||
} | ||
|
||
// This will attempt to publish the mod to the devOS Maven, otherwise it will build the mod locally | ||
// This is auto run by GitHub Actions | ||
task("buildOrPublish") { | ||
group = "build" | ||
var mavenUser = System.getenv().get("MAVEN_USER") | ||
if (!mavenUser.isNullOrEmpty()) { | ||
dependsOn(tasks.getByName("publish")) | ||
println("prepared for publish") | ||
} else { | ||
dependsOn(tasks.getByName("build")) | ||
println("prepared for build") | ||
} | ||
} | ||
|
||
// TODO: Uncomment for a non template mod! | ||
publishing { | ||
// publications { | ||
// create<MavenPublication>("mavenJava") { | ||
// groupId = project.property("maven_group").toString() | ||
// artifactId = project.property("archives_base_name").toString() | ||
// version = getModVersion() | ||
// | ||
// from(components.get("java")) | ||
// } | ||
// } | ||
// | ||
// repositories { | ||
// maven { | ||
// url = uri("https://mvn.devos.one/${System.getenv()["PUBLISH_SUFFIX"]}/") | ||
// credentials { | ||
// username = System.getenv()["MAVEN_USER"] | ||
// password = System.getenv()["MAVEN_PASS"] | ||
// } | ||
// } | ||
// } | ||
} | ||
|
||
fun getModVersion(): String { | ||
val modVersion = project.property("mod_version") | ||
val buildId = System.getenv("GITHUB_RUN_NUMBER") | ||
|
||
// CI builds only | ||
if (buildId != null) { | ||
return "${modVersion}+build.${buildId}" | ||
} | ||
|
||
// If a git repo can't be found, grgit won't work, this non-null check exists so you don't run grgit stuff without a git repo | ||
if (grgitService.service.get().grgit.head() != null) { | ||
var id = grgitService.service.get().grgit.head().abbreviatedId ?: "NO-COMMIT-HASH" | ||
|
||
// Flag the build if the build tree is not clean | ||
// (aka you have uncommitted changes) | ||
if (!grgitService.service.get().grgit.status().isClean()) { | ||
id += "-dirty" | ||
} | ||
// ex: 1.0.0+rev.91949fa or 1.0.0+rev.91949fa-dirty | ||
return "${modVersion}+rev.${id}" | ||
} | ||
|
||
// No tracking information could be found about the build | ||
return "${modVersion}+unknown" | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Done to increase the memory available to gradle. | ||
org.gradle.jvmargs=-Xmx1G | ||
org.gradle.parallel=true | ||
|
||
# Mod Properties | ||
mod_version=0.1.0 | ||
maven_group=one.devos.nautical | ||
archives_base_name=template | ||
|
||
# Dependencies are handled in ./gradle/libs.versions.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[versions] | ||
# The latest versions are available at https://fabricmc.net/develop | ||
minecraft = "1.21.1" | ||
#quilt_mappings = "1.21+build.18" | ||
fabric_loader = "0.16.5" | ||
fabric_api = "0.105.0+1.21.1" | ||
fabric_language_kotlin = "1.12.2+kotlin.2.0.20" | ||
sodium_version = "mc1.21-0.6.0-beta.2-fabric" | ||
mod_menu_version = "11.0.2" | ||
joml_version = "1.10.5" | ||
|
||
[libraries] | ||
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" } | ||
#quilt_mappings = { module = "org.quiltmc:quilt-mappings", version.ref = "quilt_mappings" } | ||
fabric_loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric_loader" } | ||
fabric-api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric_api" } | ||
fabric_language_kotlin = { module = "net.fabricmc:fabric-language-kotlin", version.ref = "fabric_language_kotlin" } | ||
sodium = { module = "maven.modrinth:sodium", version.ref = "sodium_version" } | ||
joml = { module = "org.joml:joml", version.ref = "joml_version" } | ||
mod_menu = { module = "com.terraformersmc:modmenu", version.ref = "mod_menu_version" } | ||
|
||
# If you have multiple similar dependencies, you can declare a dependency bundle and reference it on the build script with "libs.bundles.example". | ||
[bundles] | ||
dev_mods = [ "joml", "sodium" ] | ||
dependencies = [ "mod_menu" ] | ||
|
||
[plugins] | ||
grgit = { id = "org.ajoberstar.grgit", version = "5.2.2"} | ||
fabric_loom = { id = "fabric-loom", version = "1.7-SNAPSHOT" } | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.