Skip to content

Commit dda81cb

Browse files
committed
Cleanup to build.gradle and fixing GH Actions
Removes the spotbugs and delombok steps, and updates fabric-loom to 1.12-SNAPSHOT to fix builds involving injected interfaces.
1 parent 5a2fa4a commit dda81cb

File tree

4 files changed

+47
-140
lines changed

4 files changed

+47
-140
lines changed

.github/workflows/build.yml

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,36 @@ on: [ push, pull_request ]
44

55
jobs:
66
build:
7-
uses: constellation-mc/actions/.github/workflows/gradle-build.yml@main
8-
with:
9-
java: 21
10-
gradle_tasks: spotbugs
11-
reviewdog: |
12-
cat ./build/reports/spotbugs/main/spotbugs.sarif | reviewdog -name="spotbugs" -f=sarif -reporter=github-check -level=warning
13-
14-
run_tests:
15-
uses: constellation-mc/actions/.github/workflows/mc-tests.yml@main
16-
with:
17-
java: 21
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- uses: gradle/actions/[email protected]
11+
- name: Setup Java
12+
uses: actions/setup-java@v4
13+
with:
14+
java-version: 21
15+
distribution: temurin
16+
- name: Grant execute permission for gradlew
17+
run: chmod +x gradlew
18+
- name: Setup Gradle
19+
uses: gradle/actions/[email protected]
20+
- name: Build project
21+
run: ./gradlew buildAndCollect
22+
- name: Find jars
23+
id: find_jars
24+
run: |
25+
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
26+
echo "jars<<$EOF" >> $GITHUB_OUTPUT
27+
find ./build/libs/ -type f -name "*.jar" ! -name "*-sources.jar" >> $GITHUB_OUTPUT
28+
echo "$EOF" >> $GITHUB_OUTPUT
29+
- name: Get MC version and mod version
30+
uses: christian-draeger/[email protected]
31+
id: read_properties
32+
with:
33+
path: gradle.properties
34+
properties: 'mod_version'
35+
- name: Upload artifacts
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: linkart-refabricated-${{ steps.read_properties.outputs.mod_version }}+build.${{ github.run_number }}
39+
path: ${{ steps.find_jars.outputs.jars }}

.github/workflows/publish.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

build.gradle

Lines changed: 13 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
import com.github.spotbugs.snom.SpotBugsTask
2-
31
plugins {
4-
id 'fabric-loom' version '1.11-SNAPSHOT'
2+
id 'fabric-loom' version '1.12-SNAPSHOT'
53
id 'maven-publish'
6-
id 'io.freefair.lombok' version '8.6'
7-
id 'com.github.spotbugs-base' version '6.0.14'
8-
//id 'com.diffplug.spotless' version '6.25.0'
94
id 'me.modmuss50.mod-publish-plugin' version "0.5.1"
105
}
116

@@ -37,36 +32,6 @@ base {
3732
archivesName = "linkart-refabricated"
3833
}
3934

40-
tasks.register("spotbugs", SpotBugsTask) { task ->
41-
sourceSets.each {
42-
task.sourceDirs.from(task.sourceDirs.files, it.allSource.sourceDirectories)
43-
task.classDirs.from(task.classDirs.files, it.output)
44-
task.auxClassPaths.from(task.auxClassPaths.files, it.compileClasspath)
45-
}
46-
excludeFilter = rootProject.file("spotbugs.xml")
47-
ignoreFailures = true
48-
reports {
49-
html {
50-
required = true
51-
outputLocation = rootProject.file("${rootProject.buildDir}/reports/spotbugs/main/spotbugs.html")
52-
stylesheet = 'fancy-hist.xsl'
53-
}
54-
sarif {
55-
required = true
56-
outputLocation = rootProject.file("${rootProject.buildDir}/reports/spotbugs/main/spotbugs.sarif")
57-
}
58-
}
59-
}
60-
61-
/*spotless {
62-
java {
63-
removeUnusedImports()
64-
trimTrailingWhitespace()
65-
formatAnnotations()
66-
importOrder('', 'java|javax', '\\#')
67-
}
68-
}*/
69-
7035
processResources {
7136
inputs.property "minecraft", mcVersion
7237
inputs.property "version", mod_version
@@ -88,6 +53,8 @@ loom {
8853
ideConfigGenerated true // Run configurations are not created for subprojects by default
8954
runDir "../../run" // Use a shared run folder and create separate worlds
9055
}
56+
57+
fabricModJsonPath = rootProject.file("src/main/resources/fabric.mod.json")
9158
}
9259

9360
def targetJavaVersion = 17
@@ -110,77 +77,18 @@ java {
11077
withSourcesJar()
11178
}
11279

113-
jar {
114-
from("LICENSE") {
115-
rename { "${it}_${project.archivesBaseName}" }
116-
}
117-
}
118-
119-
sourcesJar {
120-
exclude {
121-
sourceSets.main.allSource.contains it.file
122-
}
123-
from delombok
124-
}
80+
tasks.register('buildAndCollect', Copy) {
81+
group = 'build'
12582

126-
/*
127-
// configure the maven publication
128-
publishing {
129-
publications {
130-
mavenJava(MavenPublication) {
131-
artifactId 'linkart'
132-
from components.java
133-
}
134-
}
83+
from(tasks.named('remapJar').flatMap { it.archiveFile })
84+
from(tasks.named('remapSourcesJar').flatMap { it.archiveFile })
85+
into rootProject.layout.buildDirectory.dir("libs/${project.mod_version}").get().asFile
13586

136-
repositories {
137-
maven {
138-
name = "GitHubPackages"
139-
url = "https://maven.pkg.github.com/constellation-mc/Linkart"
140-
credentials {
141-
username = System.getenv("GITHUB_ACTOR")
142-
password = System.getenv("GITHUB_TOKEN")
143-
}
144-
}
145-
}
87+
dependsOn 'build'
14688
}
14789

148-
publishMods {
149-
file = remapJar.archiveFile
150-
additionalFiles.from(remapSourcesJar.archiveFile)
151-
152-
changelog = file("CHANGELOG.md").text
153-
type = ReleaseType.valueOf(providers.environmentVariable("VERSION_TYPE").getOrElse("BETA"))
154-
modLoaders.add("fabric")
155-
156-
displayName = "${project.mod_version} (${project.minecraft_version})"
157-
158-
modrinth {
159-
projectId = "sc4Mu9Zu"
160-
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
161-
minecraftVersions.add("${project.minecraft_version}")
162-
minecraftVersions.add("1.21")
163-
164-
requires("fabric-api")
165-
embeds("midnightlib")
166-
}
167-
curseforge {
168-
projectId = "622736"
169-
accessToken = providers.environmentVariable("CURSEFORGE_TOKEN")
170-
minecraftVersions.add("${project.minecraft_version}")
171-
minecraftVersions.add("1.21")
172-
173-
requires("fabric-api")
174-
embeds("midnightlib")
175-
}
176-
github {
177-
repository = "constellation-mc/Linkart"
178-
accessToken = providers.environmentVariable("GITHUB_TOKEN")
179-
commitish = providers.environmentVariable("GITHUB_SHA").getOrElse("${project.minecraft_version}-fabric")
180-
181-
type = STABLE
90+
jar {
91+
from("LICENSE") {
92+
rename { "${it}_${project.archivesBaseName}" }
18293
}
183-
184-
dryRun = local
185-
}
186-
*/
94+
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Done to increase the memory available to gradle.
2-
org.gradle.jvmargs=-Xmx2G
2+
org.gradle.jvmargs=-Xmx3G
33
# Fabric Properties
44
# check these on https://fabricmc.net/versions.html
55
minecraft_version=[VERSIONED]

0 commit comments

Comments
 (0)