Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
btwonion committed Mar 23, 2024
1 parent d4b9dfa commit 809a19b
Show file tree
Hide file tree
Showing 24 changed files with 961 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# https://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
max_line_length = 140

end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{java,kt,kts,scala,rs,xml,kt.spec,kts.spec}]
indent_size = 4

[*.{kt,kts}]
ktlint_code_style = ktlint_official
ktlint_ignore_back_ticked_identifier = true
ij_kotlin_allow_trailing_comma_on_call_site = false
ij_kotlin_allow_trailing_comma = false

ktlint_standard = enabled

# Don't allow any wildcard imports
ij_kotlin_packages_to_use_import_on_demand = unset

# Prevent wildcard imports
ij_kotlin_name_count_to_use_star_import = 99
ij_kotlin_name_count_to_use_star_import_for_members = 99

[*.md]
trim_trailing_whitespace = false
max_line_length = unset

[gradle/verification-metadata.xml]
indent_size = 3

[*.yml]
ij_yaml_spaces_within_brackets = false
39 changes: 39 additions & 0 deletions .github/workflows/build-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Used when a commit is pushed to the repository
# This makes use of caching for faster builds and uploads the resulting artifacts
name: build-commit

on: [ push ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Extract current branch name
shell: bash
# bash pattern expansion to grab branch name without slashes
run: ref="${GITHUB_REF#refs/heads/}" && echo "branch=${ref////-}" >> $GITHUB_OUTPUT
id: ref
- name: Checkout sources
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Initialize caches
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/loom-cache
~/.gradle/wrapper
key: ${{ runner.os }}-build-commit-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-build-commit-
- name: Build artifacts
run: ./gradlew build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: better-boat-movement-artifacts-${{ steps.ref.outputs.branch }}
path: build/libs/*.jar
29 changes: 29 additions & 0 deletions .github/workflows/build-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Used when building external pull requests
# We don't want to publish build artifacts or expose our other caches to possibly untrusted code
name: build-pull-request

on: [ pull_request ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Initialize caches
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/loom-cache
~/.gradle/wrapper
key: ${{ runner.os }}-build-external-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-build-external-
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Build artifacts
run: ./gradlew build
22 changes: 22 additions & 0 deletions .github/workflows/ktlint-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: ktlint-commit

on: [ push ]

jobs:
ktlint:
name: Check Code Quality
runs-on: ubuntu-latest

steps:
- name: Clone repo
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: ktlint
uses: ScaCap/action-ktlint@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-check
filter_mode: nofilter
level: info
fail_on_error: true
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.idea
.gradle
build
run
156 changes: 156 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
@file:Suppress("SpellCheckingInspection")

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.9.23"
kotlin("plugin.serialization") version "1.9.23"
id("fabric-loom") version "1.6-SNAPSHOT"

id("com.modrinth.minotaur") version "2.8.7"
id("com.github.breadmoirai.github-release") version "2.5.2"

`maven-publish`
signing
}

group = "dev.nyon"
val majorVersion = "1.0.0"
val mcVersion = "1.20.1"
version = "$majorVersion-$mcVersion"
val authors = listOf("btwonion")
val githubRepo = "btwonion/better-boat-movement"

repositories {
mavenCentral()
maven("https://maven.terraformersmc.com")
maven("https://maven.parchmentmc.org")
maven("https://repo.nyon.dev/releases")
maven("https://maven.isxander.dev/releases")
maven("https://oss.sonatype.org/content/repositories/snapshots/")
}

dependencies {
minecraft("com.mojang:minecraft:$mcVersion")
mappings(loom.layered {

Check failure on line 35 in build.gradle.kts

View workflow job for this annotation

GitHub Actions / Check Code Quality

[ktlint] reported by reviewdog 🐶 A multiline expression should start on a new line Raw Output: build.gradle.kts:35:14: error: A multiline expression should start on a new line (standard:multiline-expression-wrapping)

Check failure on line 35 in build.gradle.kts

View workflow job for this annotation

GitHub Actions / Check Code Quality

[ktlint] reported by reviewdog 🐶 Missing newline after "(" Raw Output: build.gradle.kts:35:14: error: Missing newline after "(" (standard:wrapping)
parchment("org.parchmentmc.data:parchment-1.20.1:2023.09.03@zip")
officialMojangMappings()
})

Check failure on line 38 in build.gradle.kts

View workflow job for this annotation

GitHub Actions / Check Code Quality

[ktlint] reported by reviewdog 🐶 Missing newline before ")" Raw Output: build.gradle.kts:38:5: error: Missing newline before ")" (standard:wrapping)

implementation("org.vineflower:vineflower:1.9.3")
modImplementation("net.fabricmc:fabric-loader:0.15.7")
modImplementation("net.fabricmc.fabric-api:fabric-api:0.92.0+$mcVersion")
modImplementation("net.fabricmc:fabric-language-kotlin:1.10.19+kotlin.1.9.23")

modImplementation("dev.isxander.yacl:yet-another-config-lib-fabric:3.2.2+1.20")
modImplementation("com.terraformersmc:modmenu:7.2.2")

include(modImplementation("dev.nyon:konfig:1.1.0-1.20.4")!!)
}

tasks {
processResources {
val modId = "better-boat-movement"
val modName = "BetterBoatMovement"
val modDescription = "Increases boat step height to move up water and blocks"

inputs.property("id", modId)
inputs.property("name", modName)
inputs.property("description", modDescription)
inputs.property("version", project.version)
inputs.property("github", githubRepo)

filesMatching("fabric.mod.json") {
expand(
"id" to modId,
"name" to modName,
"description" to modDescription,
"version" to project.version,
"github" to githubRepo
)
}
}

register("releaseMod") {
group = "publishing"

dependsOn("modrinthSyncBody")
dependsOn("modrinth")
dependsOn("githubRelease")
dependsOn("publish")
}

withType<JavaCompile> {
options.release.set(17)
}

withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}
}

val changelogText =
buildString {
append("# v${project.version}\n")
file("changelog.md").readText().also { append(it) }
}

modrinth {
token.set(findProperty("modrinth.token")?.toString())
projectId.set("")
versionNumber.set("${project.version}")
versionType.set("release")
uploadFile.set(tasks["remapJar"])
gameVersions.set(listOf(mcVersion))
loaders.set(listOf("fabric", "quilt"))
dependencies {
required.project("fabric-api")
required.project("fabric-language-kotlin")
required.project("yacl")
optional.project("modmenu")
}
changelog.set(changelogText)
syncBodyFrom.set(file("readme.md").readText())
}

githubRelease {
token(findProperty("github.token")?.toString())

val split = githubRepo.split("/")
owner = split[0]
repo = split[1]
tagName = "v${project.version}"
body = changelogText
overwrite = true
releaseAssets(tasks["remapJar"].outputs.files)
targetCommitish = "main"
}

publishing {
repositories {
maven {
name = "nyon"
url = uri("https://repo.nyon.dev/releases")
credentials(PasswordCredentials::class)
authentication {
create<BasicAuthentication>("basic")
}
}
}
publications {
create<MavenPublication>("maven") {
groupId = "dev.nyon"
artifactId = "better-boat-movement"
version = project.version.toString()
from(components["java"])
}
}
}

java {
withSourcesJar()
}

signing {
sign(publishing.publications)
}
Empty file added changelog.md
Empty file.
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kotlin.code.style=official
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
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.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 809a19b

Please sign in to comment.