Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
andantet committed Nov 7, 2024
0 parents commit 04a9aba
Show file tree
Hide file tree
Showing 18 changed files with 717 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Automatically build the project and run any configured tests for every push
# and submitted pull request. This can help catch issues that only occur on
# certain platforms or Java versions, and provides a first line of defence
# against bad commits.

name: build
on: [pull_request, push]

jobs:
build:
strategy:
matrix:
# Use these Java versions
java: [
21, # Current Java LTS
]
runs-on: ubuntu-22.04
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'microsoft'
- name: make gradle wrapper executable
run: chmod +x ./gradlew
- name: build
run: ./gradlew build
- name: capture build artifacts
if: ${{ matrix.java == '21' }} # Only upload artifacts built from latest java
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: build/libs/
41 changes: 41 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 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
.kotlin/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2024 Daniel Orr

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.
131 changes: 131 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
plugins {
id "fabric-loom" version "1.8-SNAPSHOT"
id "org.jetbrains.kotlin.jvm"
id "maven-publish"
}

version = mod_version
group = maven_group

base {
archivesName = mod_id
}

repositories {
maven {
name = "Andante"
url = "https://maven.andante.dev/releases/"
}
}

sourceSets {
test {
compileClasspath += main.compileClasspath
runtimeClasspath += main.runtimeClasspath
}
}

loom {
accessWidenerPath = file("src/main/resources/${mod_id}.accesswidener")
splitEnvironmentSourceSets()

mods {
mod_id {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}

runs {
client {
ideConfigGenerated = false
}

testServer {
inherit(server)
name("Minecraft Server (Test)")
source(sourceSets.test)
}
}
}

dependencies {
minecraft "com.mojang:minecraft:$minecraft_version"
mappings "net.fabricmc:yarn:$minecraft_version+build.$yarn_build:v2"

modImplementation "net.fabricmc:fabric-loader:$loader_version"
modImplementation "net.fabricmc.fabric-api:fabric-api:$fabric_version"

modImplementation "net.fabricmc:fabric-language-kotlin:$fabric_kotlin_version+kotlin.$kotlin_version"

testImplementation sourceSets.main.output
}

processResources {
inputs.property "version", project.version

filesMatching("fabric.mod.json") {
expand "version": project.version
}
}

tasks.withType(JavaCompile).configureEach {
it.options.release = 21
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = 21
}
}

java {
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

jar {
from("LICENSE") {
rename { "${it}_${base.archivesName.get()}"}
}
}

publishing {
publications {
mavenJava(MavenPublication) {
artifactId = mod_id
from components.java

pom {
name = "Railroad"
description = "A library for creating server-side camera animation tracks."
url = "https://mcbrawls.net"

licenses {
license {
name = "MIT"
url = "https://opensource.org/licenses/MIT"
distribution = "repo"
}
}
}
}
}

repositories {
// Andante's Maven
def env = System.getenv()
def mavenUsername = env["MAVEN_USERNAME_ANDANTE"]
def mavenPassword = env["MAVEN_PASSWORD_ANDANTE"]
if (mavenUsername && mavenPassword) {
maven {
name = "Andante"
url = "https://maven.andante.dev/releases/"
credentials.username = mavenUsername
credentials.password = mavenPassword
}
}
}
}
20 changes: 20 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# gradle
org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true

# minecraft
minecraft_version=1.21.3
yarn_build=2

# fabric
loader_version=0.16.9
fabric_version=0.107.0+1.21.3

# kotlin
kotlin_version=2.0.21
fabric_kotlin_version=1.12.3

# mod properties
mod_version=1.3.0
maven_group=net.mcbrawls
mod_id=railroad
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.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 04a9aba

Please sign in to comment.