Skip to content

Commit

Permalink
Update Gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
Kotori316 committed Dec 2, 2023
1 parent fadae32 commit c148c65
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 84 deletions.
16 changes: 8 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ plugins {

tasks.named("wrapper", Wrapper.class) {
distributionType = Wrapper.DistributionType.BIN
gradleVersion = "8.4"
gradleVersion = "8.5"
}

version = "${libs.versions.scala3.get()}-build-${project.build_number}"

final boolean RELEASE_DEBUG = Boolean.parseBoolean(System.getenv("RELEASE_DEBUG") ?: "true")
githubRelease {
setOwner("Kotori316")
repo.set('SLP')
repo.set("SLP")
token = project.findProperty("githubToken") ?: System.getenv("REPO_TOKEN") ?: ""
targetCommitish.set(project.branch as String)
targetCommitish.set(project.property("branch") as String)
prerelease.set(project.version.toString().contains("SNAPSHOT"))
body.set("""\
For Minecraft ${libs.versions.minecraft.get()}
Expand Down Expand Up @@ -92,14 +92,14 @@ subprojects {

testLogging {
events "skipped", "failed", "standardOut", "standardError"
exceptionFormat 'full'
exceptionFormat "full"
}
}

tasks.register('data') {
tasks.register("data") {
doLast {
println("Java: ${System.getProperty('java.version')} JVM: ${System.getProperty('java.vm.version')}" +
"(${System.getProperty('java.vendor')}) Arch: ${System.getProperty('os.arch')}")
println("Java: ${System.getProperty("java.version")} JVM: ${System.getProperty("java.vm.version")}" +
"(${System.getProperty("java.vendor")}) Arch: ${System.getProperty("os.arch")}")
println("Scala: ${libs.versions.scala3.get()}")
println("Build Number: $build_number, ${build_number.getClass()}")
println("Version: $version, ${version.getClass()}")
Expand Down Expand Up @@ -146,7 +146,7 @@ static void start_group(String name) {
println("::group::${name}")
}

@SuppressWarnings('SpellCheckingInspection')
@SuppressWarnings("SpellCheckingInspection")
static void end_group() {
println("::endgroup::")
}
70 changes: 35 additions & 35 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter

plugins {
id 'scala'
id 'net.minecraftforge.gradle' version '[6.0.16,6.2)'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
id 'maven-publish'
id 'signing'
id "scala"
id "net.minecraftforge.gradle" version "[6.0.16,6.2)"
id "org.parchmentmc.librarian.forgegradle" version "1.+"
id "maven-publish"
id "signing"
id "com.matthewprenger.cursegradle" version "1.4.0"
id "com.modrinth.minotaur" version "2.+"
id "com.github.johnrengelman.shadow" version "7.1.2"
Expand All @@ -19,17 +19,17 @@ archivesBaseName = "ScalableCatsForce"
jarJar.enable()

minecraft {
mappings channel: 'parchment', version: ((libs.versions.parchment.get() + "-" + libs.versions.minecraft.get()) as String)
mappings channel: "parchment", version: ((libs.versions.parchment.get() + "-" + libs.versions.minecraft.get()) as String)
// copyIdeResources = true
runs {
client {
workingDirectory project.file('Minecraft')
workingDirectory project.file("Minecraft")

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property "forge.logging.markers", "SCAN,REGISTRIES,REGISTRYDUMP"

// Recommended logging level for the console
property 'forge.logging.console.level', 'info'
property "forge.logging.console.level", "info"
property "mixin.debug", "true"

mods {
Expand All @@ -40,13 +40,13 @@ minecraft {
}

server {
workingDirectory project.file('run-server')
workingDirectory project.file("run-server")

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property "forge.logging.markers", "SCAN,REGISTRIES,REGISTRYDUMP"

// Recommended logging level for the console
property 'forge.logging.console.level', 'info'
property "forge.logging.console.level", "info"

mods {
"scala-library-object" {
Expand All @@ -55,14 +55,14 @@ minecraft {
}
}
data {
workingDirectory project.file('run-server')
property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
workingDirectory project.file("run-server")
property "forge.logging.markers", "REGISTRIES,REGISTRYDUMP"
property "forge.logging.console.level", "debug"

if (Boolean.valueOf(System.getenv("GITHUB_ACTIONS")))
args '--mod', "slp_test,scala-library-object,scala-library-java", '--dev'
args "--mod", "slp_test,scala-library-object,scala-library-java", "--dev"
else
args '--mod', "slp_test", '--all'
args "--mod", "slp_test", "--all"

mods {
"slp_test" {
Expand All @@ -80,11 +80,11 @@ dependencies {
implementation(libs.bundles.cats) { transitive = false }

// Jar in Jar
jarJar(group: 'org.scala-lang', name: 'scala-library', version: "[${libs.versions.scala2.get()}, 3.0)") { transitive = false }
jarJar(group: 'org.scala-lang', name: 'scala3-library_3', version: "[3.0, ${libs.versions.scala3.get()}]") { transitive = false }
jarJar(group: 'org.typelevel', name: "cats-core_3", version: "[2.0, ${libs.versions.cats.get()}]") { transitive = false }
jarJar(group: 'org.typelevel', name: "cats-kernel_3", version: "[2.0, ${libs.versions.cats.get()}]") { transitive = false }
jarJar(group: 'org.typelevel', name: "cats-free_3", version: "[2.0, ${libs.versions.cats.get()}]") { transitive = false }
jarJar(group: "org.scala-lang", name: "scala-library", version: "[${libs.versions.scala2.get()}, 3.0)") { transitive = false }
jarJar(group: "org.scala-lang", name: "scala3-library_3", version: "[3.0, ${libs.versions.scala3.get()}]") { transitive = false }
jarJar(group: "org.typelevel", name: "cats-core_3", version: "[2.0, ${libs.versions.cats.get()}]") { transitive = false }
jarJar(group: "org.typelevel", name: "cats-kernel_3", version: "[2.0, ${libs.versions.cats.get()}]") { transitive = false }
jarJar(group: "org.typelevel", name: "cats-free_3", version: "[2.0, ${libs.versions.cats.get()}]") { transitive = false }

// Test Dependencies.
testImplementation(libs.jupiter.api)
Expand All @@ -96,8 +96,8 @@ dependencies {
jar {
manifest {
attributes([
'FMLModType' : 'LANGPROVIDER',
'Automatic-Module-Name': 'kotori_scala',
"FMLModType" : "LANGPROVIDER",
"Automatic-Module-Name": "kotori_scala",
])
attributes([
"Specification-Title" : project.name,
Expand All @@ -109,15 +109,15 @@ jar {
"Implementation-Timestamp": ZonedDateTime.now().format(DateTimeFormatter.ISO_INSTANT),
])
}
archiveClassifier.set('dev')
archiveClassifier.set("dev")
}

tasks.register('normalJar', Jar) {
tasks.register("normalJar", Jar) {
}

tasks.register('srcJar', Jar) {
tasks.register("srcJar", Jar) {
from sourceSets.main.allSource
archiveClassifier.set('sources')
archiveClassifier.set("sources")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

Expand All @@ -127,7 +127,7 @@ artifacts {
}

shadowJar {
def groupNames = ['org.scala-lang', 'org.scala-lang.modules', 'org.typelevel']
def groupNames = ["org.scala-lang", "org.scala-lang.modules", "org.typelevel"]
archiveClassifier.set("with-library")
dependencies {
include(dependency {
Expand All @@ -144,10 +144,10 @@ tasks.jarJar.configure {
reobf {
jarJar {}
}
tasks.jarJar.finalizedBy('reobfJarJar')
tasks.jarJar.finalizedBy("reobfJarJar")

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
options.encoding = "UTF-8" // Use the UTF-8 charset for Java compilation
}

// ---------- Publish ----------
Expand All @@ -156,10 +156,10 @@ final boolean RELEASE_DEBUG = Boolean.parseBoolean(System.getenv("RELEASE_DEBUG"
curseforge {
apiKey = project.findProperty("curseforge_additional-enchanted-miner_key") ?: System.getenv("CURSE_TOKEN") ?: ""
project {
id = '320926'
changelogType = 'markdown'
id = "320926"
changelogType = "markdown"
changelog = getChangelog()
releaseType = 'release'
releaseType = "release"
addGameVersion("1.20.2")
addGameVersion("Forge")
mainArtifact(tasks.shadowJar)
Expand Down Expand Up @@ -199,7 +199,7 @@ publishing {
pom {
name = archivesBaseName
description = "Scala Loading library build with Minecraft ${libs.versions.minecraft.get()} and Forge ${libs.versions.forge.get()}"
url = 'https://github.com/Kotori316/SLP'
url = "https://github.com/Kotori316/SLP"
packaging = "jar"
withXml {
def pomNode = asNode() as Node
Expand Down
5 changes: 5 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ build_number=3
branch=1.20
mod_id=scala-library-object
# the dependencies are declared in gradle/libs.versions.toml

# https://docs.gradle.org/current/userguide/upgrading_version_8.html#xml_parsing_now_requires_recent_parsers
systemProp.javax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
systemProp.javax.xml.transform.TransformerFactory=com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
systemProp.javax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
22 changes: 13 additions & 9 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -130,26 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
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 @@ -198,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
Loading

0 comments on commit c148c65

Please sign in to comment.