Skip to content
Open
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
54 changes: 33 additions & 21 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,37 @@
# Based on https://github.com/FabricMC/fabric-example-mod/blob/1.18/.github/workflows/build.yml
name: Java CI with Gradle

on: [push, pull_request]
on: [ push, pull_request ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v1
with:
java-version: 8
- name: Setup gradlew
run: gradle wrapper
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build targets with Gradle
run: make
- name: Upload build artifacts
uses: actions/upload-artifact@v1
with:
name: build-artifacts
path: dist
build:
strategy:
matrix:
# Use these Java versions
java: [
17, # Current Java LTS & minimum supported by Minecraft
]
os: [ ubuntu-20.04 ] # You can add windows here if you want to build on that OS as well
runs-on: ${{ matrix.os }}
steps:
- name: checkout repository
uses: actions/checkout@v2
- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Setup gradlew
run: gradle wrapper
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: build
run: make
- 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
with:
name: Artifacts
path: dist/
56 changes: 34 additions & 22 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,40 @@
name: Publish Release

on:
release:
types:
- published
release:
types:
- published

jobs:
build:
runs-on: ubuntu-latest
build:
strategy:
matrix:
# Use these Java versions
java: [
17, # Current Java LTS & minimum supported by Minecraft
]
os: [ ubuntu-20.04 ] # You can add windows here if you want to build on that OS as well
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v1
with:
java-version: 8
- name: Setup gradlew
run: gradle wrapper
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build targets with Gradle
run: make
- name: Upload assets to GitHub
uses: AButler/upload-release-assets@v2.0
with:
files: "dist/*;LICENSE"
repo-token: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: checkout repository
uses: actions/checkout@v2
- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Setup gradlew
run: gradle wrapper
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: build
run: make
- name: Upload assets to GitHub
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS
uses: AButler/upload-release-assets@v2.0
with:
files: "dist/*;LICENSE"
repo-token: ${{ secrets.GITHUB_TOKEN }}
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
build/
out/
classes/
gradle/wrapper/gradle-wrapper.jar

# eclipse

*.launch

# idea

Expand All @@ -20,6 +25,10 @@ bin/
.classpath
.project

# macos

*.DS_Store

# fabric

run/
Expand Down
16 changes: 6 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
MAJOR_VERSION=hscroll-1.16
MINOR_VERSIONS := 1 2 3 4
MAJOR_VERSION=hscroll-1.18
MINOR_VERSIONS := 1 2
BUILD_VERSION=001
TARGET_VERSIONS=$(patsubst %,$(MAJOR_VERSION).%-$(BUILD_VERSION),$(MINOR_VERSIONS))

Expand All @@ -10,14 +10,10 @@ TARGETS := $(patsubst %,dist/%.jar,$(TARGET_VERSIONS))

default: $(TARGETS)

build/libs/hscroll-1.16.1-$(BUILD_VERSION).jar: $(SOURCES)
./gradlew build -Pminecraft_version=1.16.1 -Pyarn_mappings=1.16.1+build.21 -Ploader_version=0.10.8 -Pfabric_version=0.18.0+build.387-1.16.1 -Pmod_version=1.16.1-$(BUILD_VERSION)
build/libs/hscroll-1.16.2-$(BUILD_VERSION).jar: $(SOURCES)
./gradlew build -Pminecraft_version=1.16.2 -Pyarn_mappings=1.16.2+build.47 -Ploader_version=0.10.8 -Pfabric_version=0.27.1+1.16 -Pmod_version=1.16.2-$(BUILD_VERSION)
build/libs/hscroll-1.16.3-$(BUILD_VERSION).jar: $(SOURCES)
./gradlew build -Pminecraft_version=1.16.3 -Pyarn_mappings=1.16.3+build.47 -Ploader_version=0.10.8 -Pfabric_version=0.27.1+1.16 -Pmod_version=1.16.3-$(BUILD_VERSION)
build/libs/hscroll-1.16.4-$(BUILD_VERSION).jar: $(SOURCES)
./gradlew build -Pminecraft_version=1.16.4 -Pyarn_mappings=1.16.4+build.7 -Ploader_version=0.10.8 -Pfabric_version=0.27.1+1.16 -Pmod_version=1.16.4-$(BUILD_VERSION)
build/libs/hscroll-1.18.2-$(BUILD_VERSION).jar: $(SOURCES)
./gradlew build -Pminecraft_version=1.18.2 -Pyarn_mappings=1.18.2+build.2 -Ploader_version=0.13.3 -Pfabric_version=0.28.5+1.15 -Pmod_version=1.18.2-$(BUILD_VERSION)
build/libs/hscroll-1.18.1-$(BUILD_VERSION).jar: $(SOURCES)
./gradlew build -Pminecraft_version=1.18.1 -Pyarn_mappings=1.18.1+build.22 -Ploader_version=0.13.3 -Pfabric_version=0.28.5+1.15 -Pmod_version=1.18.1-$(BUILD_VERSION)

dist/%.jar: build/libs/%.jar
@mkdir -p $(@D)
Expand Down
66 changes: 32 additions & 34 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,74 +1,72 @@
plugins {
id 'fabric-loom' version '0.4-SNAPSHOT'
id 'fabric-loom' version '0.11-SNAPSHOT'
id 'maven-publish'
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group

minecraft {
repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
}

dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modCompile "net.fabricmc:fabric-loader:${project.loader_version}"
modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
}

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

from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
filesMatching("fabric.mod.json") {
expand "version": project.version
}

from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
}

// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
tasks.withType(JavaCompile).configureEach {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
}

// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this task, sources will not be generated.
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}

jar {
from "LICENSE"
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
}

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
artifact(remapJar) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
from components.java
}
}

// select the repositories you want to publish to
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// uncomment to publish to the local maven
// mavenLocal()
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
20 changes: 8 additions & 12 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
maven_group = net.fabricmc
archives_base_name = hscroll

# This file uses the lowest supported version config since they are
# built in order from lowest to highest.

# Fabric Properties
minecraft_version=1.16.1
yarn_mappings=1.16.1+build.21
loader_version=0.10.8

#Fabric api
fabric_version=0.18.0+build.387-1.16.1
# check these on https://fabricmc.net/develop
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.2
loader_version=0.13.3

# Mod Properties
mod_version = 1.16.1.jar
mod_version = 1.18.2.jar
maven_group = net.fabricmc
archives_base_name = hscroll

# Dependencies
fabric_version=0.48.0+1.18.2
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading