Skip to content

Commit

Permalink
Merge branch 'refs/heads/1.20.1' into 1.20.4
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.txt
#	gradle.properties
#	modules/base/src/main/java/io/github/fabricators_of_create/porting_lib/mixin/client/GuiMixin.java
#	modules/tool_actions/src/main/resources/porting_lib_tool_actions.mixins.json
  • Loading branch information
IThundxr committed Jun 4, 2024
2 parents 8289bef + aad1090 commit a2b03a4
Show file tree
Hide file tree
Showing 159 changed files with 4,016 additions and 463 deletions.
15 changes: 5 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: build
on: [ pull_request, push, workflow_dispatch ]
on: [ push, pull_request ]

jobs:
build:
Expand All @@ -10,28 +10,23 @@ jobs:
steps:

- name: checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: make gradle wrapper executable
run: chmod +x ./gradlew

- name: setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17

- name: setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: false
cache-write-only: false
cache: gradle

- name: build
run: ./gradlew build

- name: capture build artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: build/libs/
34 changes: 24 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: release
on: workflow_dispatch
on:
workflow_dispatch:
inputs:
nextVersion:
type: string
required: true
description: 'The next version in development'

jobs:
build:
Expand All @@ -8,34 +14,30 @@ jobs:
java: [ 17 ]
runs-on: ubuntu-latest
env:
MAVEN_TYPE: releases
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASS: ${{ secrets.MAVEN_PASS }}
outputs:
version: ${{ steps.publish.outputs.version }}
RELEASE: true
steps:

- name: checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: make gradle wrapper executable
run: chmod +x ./gradlew

- name: setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: gradle

- name: publish
id: publish
# build to create artifacts for upload to GitHub, MR, and CF
# publish publishes to maven
# build task creates artifacts for capture and upload, then publish publishes to maven
run: ./gradlew build publish

- name: capture build artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: build/libs/
Expand All @@ -59,3 +61,15 @@ jobs:
dependencies: |
fabric-api(required){modrinth:P7dR8mSH}{curseforge:306612}
- name: prepare for next release
run: './gradlew postRelease -PnextVersion="${{ inputs.nextVersion }}"'

- name: push updated version and changelog
run: |
git config --global user.name github-actions-bot
git config --global user.email github-actions[bot]@users.noreply.github.com
git add CHANGELOG.txt
git add gradle.properties
git commit -m "Reset changelog and bump version"
git push
11 changes: 6 additions & 5 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,30 @@ jobs:
java: [ 17 ]
runs-on: ubuntu-latest
env:
MAVEN_TYPE: snapshots
SNAPSHOT: 'true'
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASS: ${{ secrets.MAVEN_PASS }}
steps:

- name: checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: make gradle wrapper executable
run: chmod +x ./gradlew

- name: setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: gradle

- name: publish
run: ./gradlew publish
# build task creates artifacts for capture and upload, then publish publishes to maven
run: ./gradlew build publish

- name: capture build artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: build/libs/
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
## Use
Porting Lib is split into modules. All modules are available on this maven:
```groovy
maven { url = "https://mvn.devos.one/<type>/" }
maven { url = "https://mvn.devos.one/releases/" }
```
Where `<type>` is either `releases` or `snapshots`.

You can depend on Porting Lib like this once you add the maven:
```groovy
Expand All @@ -23,6 +22,7 @@ Just choose a version and use its version number.
| `accessors` | Accessor mixins aplenty |
| `attributes` | Additional Entity Attributes; step height, gravity, swim speed |
| `base` | Code that has not yet been split into modules |
| `blocks` | Adds extra block extensions. |
| `brewing` | A potion recipe api |
| `client_events` | Useful client-side events |
| `common` | Miscellaneous utilities for other modules |
Expand All @@ -34,8 +34,10 @@ Just choose a version and use its version number.
| `extensions` | Extensions to vanilla classes for additional functionality |
| `fluids` | Api that provides additional fluid attributes for fluids |
| `gametest` | Tools to make GameTest creation as easy as possible |
| `gui_utils` | Adds additional utility classes and methods for screens and guis |
| `items` | Adds extra item extensions |
| `lazy_registration` | A implementation of forge's DeferredRegister system rewritten for fabric |
| `level_events` | Provides common level events for mods. |
| `loot` | A small library to modify mob loot |
| `mixin_extensions` | More features for Mixins |
| `model_builders` | Additional model builders for data generation |
Expand Down
71 changes: 51 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,19 @@ targetCompatibility = JavaVersion.VERSION_17

archivesBaseName = "porting_lib"

String branch = providers.exec {
Provider<String> branchProvider = providers.exec {
it.setCommandLine("git", "branch", "--show-current")
}.standardOutput.asText.map {
it.contains("not a git repository") ? "unknown" : it
}.get().trim()
it.contains("not a git repository") ? "unknown" : it.trim()
}

String versionNumber = providers.provider {
String version = mod_version // 2.3.1
if (System.getenv("SNAPSHOT") == "true") {
version += "-beta." + System.getenv("GITHUB_RUN_NUMBER") // 2.3.1-beta.1000
}
return version + "+" + branchProvider.get() // 2.3.1-beta.1000+1.20.1
}.get()

dependencies {
subprojects.forEach {
Expand All @@ -28,6 +36,26 @@ processResources {
exclude("template.fabric.mod.json")
}

// resets the changelog and bumps the version after an automated release.
tasks.register("postRelease") {
String nextVersion = project.hasProperty("nextVersion") ? project.property("nextVersion") : null
File changelog = rootProject.file("CHANGELOG.txt")
File props = rootProject.file("gradle.properties")
String currentVersion = mod_version

doFirst {
if (nextVersion == null) {
throw new RuntimeException("nextVersion property is not defined")
}

changelog.setText("")

String properties = props.getText()
properties = properties.replace(currentVersion, nextVersion)
props.setText(properties)
}
}

allprojects {
if (name == "buildSrc") return

Expand All @@ -36,7 +64,7 @@ allprojects {

group = "io.github.fabricators_of_create.Porting-Lib"

version = mod_version + "+" + branch
version = versionNumber

repositories {
mavenCentral()
Expand Down Expand Up @@ -70,7 +98,6 @@ allprojects {
// dev environment
minecraft("com.mojang:minecraft:$minecraft_version")
mappings(loom.layered {
it.mappings("org.quiltmc:quilt-mappings:$minecraft_version+build.$qm_version:intermediary-v2")
if (parchment_version != "none")
it.parchment("org.parchmentmc.data:parchment-$minecraft_version:$parchment_version@zip")
it.officialMojangMappings { nameSyntheticMembers = false }
Expand All @@ -88,19 +115,24 @@ allprojects {
}

loom {
// make all runs export mixins, and generate even though they're in subprojects.
runs.configureEach {
vmArg("-Dmixin.debug.export=true")
ideConfigGenerated = true
ideConfigGenerated = true // loom doesn't gen runs for subprojects, unless this is set to true.
vmArg("-Dmixin.debug.export=true") // export all mixins
vmArg("-Dmixin.debug.strict.unique=true") // strictly enforce that @Unique things are private
}
}

configurations.configureEach {
// fixes loom using a loader version from a dependency
resolutionStrategy.force("net.fabricmc:fabric-loader:$loader_version")
}

processResources {
Map<String, ?> properties = [
version: version,
loader_version: loader_version,
fabric_version: fabric_version,
minecraft_version: minecraft_semantic_version,
minecraft_dependency: minecraft_dependency,
java_version: sourceCompatibility,

// property replacement is a bit too eager
Expand All @@ -117,9 +149,6 @@ allprojects {
filesMatching("fabric.mod.json") {
expand properties
}

// include icon
from(rootProject.file("src/main/resources/assets/porting_lib/icon.png"))
}

jar.from(rootProject.file("LICENSE")) // copy license file into jar
Expand Down Expand Up @@ -162,13 +191,21 @@ subprojects {
aw.set(awFile)
}

processResources {
// include icon
into("assets/porting_lib") {
from(rootProject.file("src/main/resources/assets/porting_lib/icon.png"))
}
}

java.withSourcesJar()

publishing {
repositories {
maven {
name = "devOS"
url = "https://mvn.devos.one/${System.getenv("MAVEN_TYPE")}/"
String mavenType = System.getenv("RELEASE") == "true" ? "releases" : "snapshots"
url = "https://mvn.devos.one/$mavenType/"
credentials {
username = System.getenv("MAVEN_USER")
password = System.getenv("MAVEN_PASS")
Expand All @@ -181,13 +218,7 @@ subprojects {

publications {
register("mavenJava", MavenPublication) {
artifact(remapJar) {
builtBy(remapJar)
}

artifact(remapSourcesJar) {
builtBy remapSourcesJar
}
from((SoftwareComponent) components["java"])
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public void addModuleDependency(String name) {
dependencies.add("api", dependency);
dependencies.add("include", dependency);

if (name.equals("mixin_extensions")) {
// special case, also an AP
dependencies.add("annotationProcessor", dependency);
}

LoomGradleExtensionAPI loom = project.getExtensions().getByType(LoomGradleExtensionAPI.class);
loom.mods(mods -> mods.register("porting_lib_" + name, settings -> {
Project depProject = project.project(":" + name);
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ org.gradle.parallel=true
org.gradle.caching=true
fabric.loom.multiProjectOptimisation = true

loom_version = 1.5.+
loom_version = 1.4.+

mod_version = 3.1.0-beta

# https://fabricmc.net/develop
minecraft_version = 1.20.4
minecraft_semantic_version = 1.20.4
minecraft_dependency = =1.20.4
loader_version = 0.15.7
fabric_version = 0.96.4+1.20.4

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package io.github.fabricators_of_create.porting_lib.attributes.mixin;

import io.github.fabricators_of_create.porting_lib.attributes.extensions.PlayerAttributesExtensions;

import net.minecraft.world.entity.player.Player;

import org.spongepowered.asm.mixin.Mixin;

@Mixin(Player.class)
public class PlayerMixin implements PlayerAttributesExtensions {
// no need to do anything, all methods are defaulted.
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"compatibilityLevel": "JAVA_17",
"mixins": [
"AttributeMapMixin",
"LivingEntityMixin"
"LivingEntityMixin",
"PlayerMixin"
],
"injectors": {
"defaultRequire": 1,
Expand Down
2 changes: 2 additions & 0 deletions modules/base/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
portingLib.addModuleDependencies([
"lazy_registration",
"extensions",
"gui_utils",
"transfer",
"utility",
"entity",
"common",
"config",
"tags"
])

Expand Down
Loading

0 comments on commit a2b03a4

Please sign in to comment.