Setup forgified loom from Juuxel that allows for better production use.

This commit is contained in:
shedaniel
2020-12-08 15:10:02 +08:00
parent 27c4b42e9f
commit 42b1de13f2
5 changed files with 50 additions and 152 deletions

View File

@@ -1,29 +1,23 @@
name: Publish
name: Java CI
on:
push:
branches:
- 'dev/**'
- 'forge'
jobs:
build:
runs-on: ubuntu-20.04
container:
image: openjdk:8-jdk
options: --user root
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: gradle/wrapper-validation-action@v1
# Generate the build number based on tags to allow per branch build numbers, not something github provides by default.
- name: Generate build number
id: buildnumber
uses: einaregilsson/build-number@v3
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
token: ${{ secrets.github_token }}
prefix: ${{ github.ref }}
- run: ./gradlew build publish -x test --stacktrace
java-version: 1.8
- name: Upload to Bintray
run: ./gradlew bintrayUpload
env:
MAVEN_URL: ${{ secrets.MAVEN_URL }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
BINTRAY_USER: shedaniel
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}

View File

@@ -1,25 +0,0 @@
name: Run Tests
on: [push, pull_request]
jobs:
gradle:
strategy:
matrix:
gradle: [4.9, 4.10.2, 6.7]
java: [jdk8, jdk11, jdk15]
exclude: # Dont run older gradle versions on newer java
- java: jdk15
gradle: 4.9
- java: jdk15
gradle: 4.10.2
- java: jdk11
gradle: 4.9
- java: jdk11
gradle: 4.10.2
runs-on: ubuntu-20.04
container:
image: gradle:${{ matrix.gradle }}-${{ matrix.java }}
options: --user root
steps:
- uses: actions/checkout@v1
- uses: gradle/wrapper-validation-action@v1
- run: gradle build check -xtest --stacktrace

View File

@@ -1,6 +1,6 @@
# Forgified Loom
A fork of [Fabric Loom](https://github.com/FabricMC/fabric-loom) that supports the Forge modding toolchain.
A fork of [Juuxel's Loom fork]("https://github.com/Juuxel/fabric-loom) that is a fork of [Fabric Loom](https://github.com/FabricMC/fabric-loom) that supports the Forge modding toolchain.
Note that if ForgeGradle works fine for you, *use it*.
This is not meant to be a complete replacement for ForgeGradle,
@@ -9,43 +9,6 @@ and there are probably many bugs and limitations here that FG doesn't have.
## Usage
Starting with a Fabric project similar to the example mod,
switch your Loom to this fork, like with [Chocohead's Loom fork](https://github.com/Chocohead/Fabric-Loom/).
`settings.gradle`:
```diff
pluginManagement {
repositories {
jcenter()
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
gradlePluginPortal()
+ maven {
+ name = 'Forge'
+ url = 'https://files.minecraftforge.net/maven'
+ }
+ maven {
+ name = 'Jitpack'
+ url = 'https://jitpack.io'
+ }
}
+ resolutionStrategy {
+ eachPlugin {
+ if (requested.id.id == "fabric-loom" && requested.version?.endsWith("-SNAPSHOT") != true) {
+ useModule("com.github.Juuxel.fabric-loom:fabric-loom:${requested.version}")
+ }
+ }
+ }
}
```
`build.gradle`:
```diff
plugins {
- id 'fabric-loom' version '0.5-SNAPSHOT'
+ id 'fabric-loom' version '<commit hash here>'
}
```
Then you need to set `loom.forge = true` in your `gradle.properties`,
and add the Forge dependency:

View File

@@ -7,23 +7,18 @@ plugins {
id 'groovy'
id 'checkstyle'
id 'com.github.johnrengelman.shadow' version '4.0.4'
id "com.jfrog.bintray" version "1.8.5"
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
group = 'net.fabricmc'
group = 'me.shedaniel'
archivesBaseName = project.name
def baseVersion = '0.5'
def build = 'Forgified'
def ENV = System.getenv()
if (ENV.BUILD_NUMBER) {
build = "release #${ENV.BUILD_NUMBER}"
version = baseVersion + '.' + ENV.BUILD_NUMBER
} else {
version = baseVersion + '-SNAPSHOT'
}
def build = "release #${System.getenv("GITHUB_RUN_NUMBER") == null ? "custom" : System.getenv("GITHUB_RUN_NUMBER")}"
version = baseVersion + "." + (System.getenv("GITHUB_RUN_NUMBER") == null ? (((short) new Random().nextInt()).abs() + 1000).toString() : System.getenv("GITHUB_RUN_NUMBER"))
configurations {
forgeInjectShadow
@@ -36,14 +31,8 @@ sourceSets {
}
repositories {
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
maven {
name = 'Forge'
url = 'https://files.minecraftforge.net/maven/'
}
maven { url "https://maven.fabricmc.net/" }
maven { url "https://files.minecraftforge.net/maven/" }
mavenCentral()
}
@@ -149,71 +138,48 @@ checkstyleMain {
gradlePlugin {
plugins {
fabricLoom {
id = 'fabric-loom'
id = 'forgified.fabric-loom'
implementationClass = 'net.fabricmc.loom.LoomGradlePlugin'
}
}
}
import org.w3c.dom.Document
import org.w3c.dom.Element
import org.w3c.dom.Node
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_KEY')
publications = ["plugin", "maven"]
publish = true
pkg {
repo = "cloth"
name = "forgified.fabric-loom"
userOrg = "shedaniel"
licenses = ["MIT"]
version {
name = project.version
vcsTag = project.version
released = new Date()
vcsUrl = 'https://github.com/shedaniel/fabric-loom.git'
}
}
}
publishing {
publications {
plugin(MavenPublication) { publication ->
plugin(MavenPublication) {
groupId 'forgified.fabric-loom'
artifactId 'forgified.fabric-loom.gradle.plugin'
from components.java
artifact sourcesJar
}
maven(MavenPublication) { publication ->
groupId project.group
artifactId project.archivesBaseName
version project.version
from components['java']
from components.java
artifact sourcesJar
artifact javadocJar
}
// Also publish a snapshot so people can use the latest version if they wish
snapshot(MavenPublication) { publication ->
groupId project.group
artifactId project.archivesBaseName
version baseVersion + '-SNAPSHOT'
from components['java']
artifact sourcesJar
artifact javadocJar
}
// Manually crate the plugin marker for snapshot versions
snapshotPlugin(MavenPublication) { publication ->
groupId 'fabric-loom'
artifactId 'fabric-loom.gradle.plugin'
version baseVersion + '-SNAPSHOT'
pom.withXml({
// Based off org.gradle.plugin.devel.plugins.MavenPluginPublishPlugin
Element root = asElement()
Document document = root.getOwnerDocument()
Node dependencies = root.appendChild(document.createElement('dependencies'))
Node dependency = dependencies.appendChild(document.createElement('dependency'))
Node groupId = dependency.appendChild(document.createElement('groupId'))
groupId.setTextContent('net.fabricmc')
Node artifactId = dependency.appendChild(document.createElement('artifactId'))
artifactId.setTextContent('fabric-loom')
Node version = dependency.appendChild(document.createElement('version'))
version.setTextContent(baseVersion + '-SNAPSHOT')
})
}
}
repositories {
maven {
if (ENV.MAVEN_URL) {
url ENV.MAVEN_URL
credentials {
username ENV.MAVEN_USERNAME
password ENV.MAVEN_PASSWORD
}
}
}
}
}

View File

@@ -1,2 +1,2 @@
rootProject.name = name
rootProject.name = "forgified.fabric-loom"