Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update buildscript #3785

Merged
merged 4 commits into from
Feb 8, 2024
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
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* text eol=lf
* text=auto eol=lf
*.bat text eol=crlf
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ jobs:
build:
strategy:
matrix:
java: [17-jdk, 20-jdk]
java: [17-jdk, 21-jdk]
runs-on: ubuntu-22.04
container:
image: eclipse-temurin:${{ matrix.java }}
options: --user root
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: ./gradlew build javadocJar checkMappings --stacktrace --warning-mode fail
- name: Build artifacts
if: ${{ matrix.java == '20-jdk' }}
if: ${{ matrix.java == '21-jdk' }}
continue-on-error: true
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: build/libs/

test-build-logic:
runs-on: ubuntu-22.04
container:
image: eclipse-temurin:20-jdk
image: eclipse-temurin:21-jdk
options: --user root
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v2
- run: ./gradlew :filament:build
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ jobs:
if: ${{ github.repository_owner == 'FabricMC' }}
runs-on: ubuntu-22.04
container:
image: eclipse-temurin:20-jdk
image: eclipse-temurin:21-jdk
options: --user root
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# 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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-filament.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ jobs:
build:
runs-on: ubuntu-22.04
container:
image: eclipse-temurin:20-jdk
image: eclipse-temurin:21-jdk
options: --user root
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: ./gradlew :filament:build :filament:publish --stacktrace --no-configuration-cache
env:
MAVEN_URL: ${{ secrets.MAVEN_URL }}
Expand Down
16 changes: 9 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ import net.fabricmc.filament.task.mappingio.MergeMappingsTask
import net.fabricmc.mappingio.format.MappingFormat
import net.fabricmc.nameproposal.MappingNameCompleter
import org.gradle.work.DisableCachingByDefault
import com.diffplug.spotless.LineEnding
import groovy.xml.XmlSlurper

import java.util.zip.GZIPOutputStream

Expand Down Expand Up @@ -186,15 +188,15 @@ tasks.register('mapSpecializedMethods', MapSpecializedMethodsTask) {
tasks.register('convertToV1', ConvertMappingsTask) {
input = mapSpecializedMethods.output
output = new File(tempDir, "yarn-mappings.tiny")
outputFormat = MappingFormat.TINY
outputFormat = MappingFormat.TINY_FILE
}

tasks.register('mergeTiny', MergeMappingsTask) {
group = buildMappingGroup
output = new File(tempDir, "mappings.tiny")
mappingInputs.from downloadIntermediary.output
mappingInputs.from convertToV1.output
outputFormat = MappingFormat.TINY
outputFormat = MappingFormat.TINY_FILE
}

// Disable the default jar task
Expand Down Expand Up @@ -281,7 +283,7 @@ tasks.withType(AbstractArchiveTask).configureEach {
}

spotless {
lineEndings = com.diffplug.spotless.LineEnding.UNIX
lineEndings = LineEnding.UNIX

java {
licenseHeaderFile(rootProject.file("HEADER"))
Expand Down Expand Up @@ -347,7 +349,7 @@ tasks.register('mergeV2', MergeMappingsTask) {
output = new File(tempDir, "merged-v2.tiny")
mappingInputs.from downloadIntermediary.output
mappingInputs.from insertAutoGeneratedEnumMappings.output
outputFormat = MappingFormat.TINY_2
outputFormat = MappingFormat.TINY_2_FILE
}

tasks.register('v2UnmergedYarnJar', Jar) {
Expand Down Expand Up @@ -510,8 +512,8 @@ javadoc {
source fileTree(fakeSourceDir) + sourceSets.constants.allJava + sourceSets.packageDocs.allJava
classpath = configurations.javadocClasspath.plus minecraftLibraries

def fs = services.get(FileSystemOperations.class)
def outputDir = javadoc.outputDirectory
def fs = project.services.get(FileSystemOperations.class)
def outputDir = javadoc.destinationDir

doLast {
fs.copy {
Expand Down Expand Up @@ -558,7 +560,7 @@ check.dependsOn javadocLint

publishing {
publications {
maven(MavenPublication) {
register("maven", MavenPublication) {
groupId 'net.fabricmc'
artifactId "yarn"
version yarnVersion
Expand Down
15 changes: 11 additions & 4 deletions filament/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ dependencies {
implementation "net.fabricmc:tiny-remapper:$properties.tiny_remapper_version"
implementation "net.fabricmc:mappingpoet:$properties.mappingpoet_version"
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.4.2'
implementation 'net.fabricmc:mapping-io:0.4.0'
implementation 'net.fabricmc:mapping-io:0.5.1'

// Contains a number of useful utilities we can re-use.
implementation ("net.fabricmc:fabric-loom:1.2.7") {
implementation ("net.fabricmc:fabric-loom:1.5.7") {
transitive = false
}

Expand All @@ -61,7 +61,14 @@ test {

checkstyle {
configFile = file('checkstyle.xml')
toolVersion = '10.3.3'
toolVersion = '10.13.0'
}

// Workaround https://github.com/gradle/gradle/issues/27035
configurations.checkstyle {
resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") {
select("com.google.guava:guava:0")
}
}

gradlePlugin {
Expand Down Expand Up @@ -91,7 +98,7 @@ publishing {
/**
* Run this task to download the gradle sources next to the api jar, you may need to manually attach the sources jar
*/
task downloadGradleSources() {
tasks.register('downloadGradleSources') {
doLast {
// Awful hack to find the gradle api location
def gradleApiFile = project.configurations.detachedConfiguration(dependencies.gradleApi()).files.stream()
Expand Down
14 changes: 7 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ org.gradle.configuration-cache=true
enigma_version=2.3.3
unpick_version=2.3.0
cfr_version=0.2.1
name_proposal_version=0.1.5
asm_version=9.5
name_proposal_version=0.2.0
asm_version=9.6

# Javadoc generation/linking
fabric_loader_version=0.14.25
jetbrains_annotations_version=23.0.0
fabric_loader_version=0.15.6
jetbrains_annotations_version=24.1.0
mappingpoet_version=0.3.2

# Build logic
tiny_remapper_version=0.8.5
junit_version=5.7.1
assertj_version=3.19.0
tiny_remapper_version=0.10.1
junit_version=5.10.2
assertj_version=3.25.3
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
14 changes: 7 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -202,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down