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
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* text=auto eol=lf
gradlew text eol=lf
*.bat text eol=crlf
*.cmd text eol=crlf
gradle-wrapper.jar -text -diff -merge -filter
20 changes: 11 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,38 @@
# against bad commits.

name: build
on: [pull_request, push]
on: [ pull_request, push ]

jobs:
build:
strategy:
matrix:
# Use these Java versions
java: [
17,
21, # Current Java LTS & minimum supported by Minecraft
]
# and run on both Linux and Windows
os: [ubuntu-22.04, windows-2022]
os: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v5
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/actions/wrapper-validation@v5
- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v5
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: gradle
- name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: build
run: ./gradlew build
- name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v2
if: ${{ runner.os == 'Linux' && matrix.java == '21' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v5
with:
name: Artifacts
path: build/libs/
path: build/libs/
169 changes: 0 additions & 169 deletions build.gradle

This file was deleted.

149 changes: 149 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
@file:Suppress("UnstableApiUsage")
import com.smushytaco.lwjgl_gradle.Preset
plugins {
alias(libs.plugins.loom)
alias(libs.plugins.lwjgl)
java
`maven-publish`
}
val modVersion = providers.gradleProperty("mod_version")
val modGroup = providers.gradleProperty("mod_group")
val modName = providers.gradleProperty("mod_name")

val javaVersion = libs.versions.java.map { it.toInt() }

base.archivesName = modName
group = modGroup.get()
version = modVersion.get()
loom {
noIntermediateMappings()
customMinecraftMetadata.set("https://downloads.betterthanadventure.net/bta-client/${libs.versions.btaChannel.get()}/v${libs.versions.bta.get()}/manifest.json")
}
repositories {
mavenCentral()
maven("https://jitpack.io")
maven("https://maven.fabricmc.net/") { name = "Fabric" }
maven("https://maven.thesignalumproject.net/infrastructure") { name = "SignalumMavenInfrastructure" }
maven("https://maven.thesignalumproject.net/releases") { name = "SignalumMavenReleases" }
ivy("https://github.com/Better-than-Adventure") {
patternLayout { artifact("[organisation]/releases/download/v[revision]/[module].jar") }
metadataSources { artifact() }
}
ivy("https://downloads.betterthanadventure.net/bta-client/${libs.versions.btaChannel.get()}/") {
patternLayout { artifact("/v[revision]/client.jar") }
metadataSources { artifact() }
}
ivy("https://downloads.betterthanadventure.net/bta-server/${libs.versions.btaChannel.get()}/") {
patternLayout { artifact("/v[revision]/server.jar") }
metadataSources { artifact() }
}
ivy("https://piston-data.mojang.com") {
patternLayout { artifact("v1/[organisation]/[revision]/[module].jar") }
metadataSources { artifact() }
}
}
lwjgl {
version = libs.versions.lwjgl
implementation(Preset.MINIMAL_OPENGL)
}
dependencies {
minecraft("::${libs.versions.bta.get()}")
mappings(loom.layered {})

// https://piston-data.mojang.com/v1/objects/43db9b498cb67058d2e12d394e6507722e71bb45/client.jar
modRuntimeOnly("objects:client:43db9b498cb67058d2e12d394e6507722e71bb45")
modImplementation(libs.loader)
modImplementation(libs.legacyLwjgl)

implementation(libs.slf4jApi)
implementation(libs.guava)
implementation(libs.log4j.slf4j2.impl)
implementation(libs.log4j.core)
implementation(libs.log4j.api)
implementation(libs.log4j.api12)
implementation(libs.gson)

implementation(libs.commonsLang3)
include(libs.commonsLang3)
}
java {
toolchain {
languageVersion = javaVersion.map { JavaLanguageVersion.of(it) }
vendor = JvmVendorSpec.ADOPTIUM
}
sourceCompatibility = JavaVersion.toVersion(javaVersion.get())
targetCompatibility = JavaVersion.toVersion(javaVersion.get())
withSourcesJar()
}
val licenseFile = run {
val rootLicense = layout.projectDirectory.file("LICENSE")
val parentLicense = layout.projectDirectory.file("../LICENSE")
when {
rootLicense.asFile.exists() -> {
logger.lifecycle("Using LICENSE from project root: {}", rootLicense.asFile)
rootLicense
}
parentLicense.asFile.exists() -> {
logger.lifecycle("Using LICENSE from parent directory: {}", parentLicense.asFile)
parentLicense
}
else -> {
logger.warn("No LICENSE file found in project or parent directory.")
null
}
}
}
tasks {
withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
sourceCompatibility = javaVersion.get().toString()
targetCompatibility = javaVersion.get().toString()
if (javaVersion.get() > 8) options.release = javaVersion
}
named<UpdateDaemonJvm>("updateDaemonJvm") {
languageVersion = libs.versions.gradleJava.map { JavaLanguageVersion.of(it.toInt()) }
vendor = JvmVendorSpec.ADOPTIUM
}
withType<JavaExec>().configureEach { defaultCharacterEncoding = "UTF-8" }
withType<Javadoc>().configureEach { options.encoding = "UTF-8" }
withType<Test>().configureEach { defaultCharacterEncoding = "UTF-8" }
withType<Jar>().configureEach {
licenseFile?.let {
from(it) {
rename { original -> "${original}_${archiveBaseName.get()}" }
}
}
}
processResources {
val resourceMap = mapOf(
"version" to modVersion.get(),
"fabricloader" to libs.versions.loader.get(),
"java" to libs.versions.java.get()
)
inputs.properties(resourceMap)
filesMatching("fabric.mod.json") { expand(resourceMap) }
filesMatching("**/*.mixins.json") { expand(resourceMap.filterKeys { it == "java" }) }
}
}
// Removes LWJGL2 dependencies
configurations.configureEach { exclude(group = "org.lwjgl.lwjgl") }

publishing {
repositories {
maven("https://maven.thesignalumproject.net/releases") {
name = "signalumMaven"
credentials(PasswordCredentials::class)
authentication {
create<BasicAuthentication>("basic")
}
}
}
publications {
create<MavenPublication>("maven") {
groupId = modGroup.get()
artifactId = modName.get()
version = modVersion.get()
from(components["java"])
}
}
}
Loading
Loading