Compare commits

...
1 Commits
Author SHA1 Message Date
Martin Robertz db153cc71e update deps and bs 2023-07-15 15:36:15 +02:00
2 changed files with 138 additions and 26 deletions

No files matched your search

+134 -22
View File
@@ -1,4 +1,4 @@
//version: 1683056771 //version: 1689409577
/* /*
DO NOT CHANGE THIS FILE! DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available. Also, you may replace this file at any time if there is an update available.
@@ -69,10 +69,10 @@ plugins {
id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version
id 'com.modrinth.minotaur' version '2.+' apply false id 'com.modrinth.minotaur' version '2.+' apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.7' id 'com.gtnewhorizons.retrofuturagradle' version '1.3.19'
} }
print("You might want to check out './gradlew :faq' if your build fails.") print("You might want to check out './gradlew :faq' if your build fails.\n")
boolean settingsupdated = verifySettingsGradle() boolean settingsupdated = verifySettingsGradle()
settingsupdated = verifyGitAttributes() || settingsupdated settingsupdated = verifyGitAttributes() || settingsupdated
@@ -115,6 +115,8 @@ propertyDefaultIfUnset("usesMixinDebug", project.usesMixins)
propertyDefaultIfUnset("forceEnableMixins", false) propertyDefaultIfUnset("forceEnableMixins", false)
propertyDefaultIfUnset("channel", "stable") propertyDefaultIfUnset("channel", "stable")
propertyDefaultIfUnset("mappingsVersion", "12") propertyDefaultIfUnset("mappingsVersion", "12")
propertyDefaultIfUnset("usesMavenPublishing", true)
propertyDefaultIfUnset("mavenPublishUrl", "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases")
propertyDefaultIfUnset("modrinthProjectId", "") propertyDefaultIfUnset("modrinthProjectId", "")
propertyDefaultIfUnset("modrinthRelations", "") propertyDefaultIfUnset("modrinthRelations", "")
propertyDefaultIfUnset("curseForgeProjectId", "") propertyDefaultIfUnset("curseForgeProjectId", "")
@@ -222,6 +224,8 @@ if (enableModernJavaSyntax.toBoolean()) {
dependencies { dependencies {
annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0' annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0'
// workaround for https://github.com/bsideup/jabel/issues/174
annotationProcessor 'net.java.dev.jna:jna-platform:5.13.0'
compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') { compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') {
transitive = false // We only care about the 1 annotation class transitive = false // We only care about the 1 annotation class
} }
@@ -355,7 +359,27 @@ catch (Exception ignored) {
String identifiedVersion String identifiedVersion
String versionOverride = System.getenv("VERSION") ?: null String versionOverride = System.getenv("VERSION") ?: null
try { try {
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride // Produce a version based on the tag, or for branches something like 0.2.2-configurable-maven-and-extras.38+43090270b6-dirty
if (versionOverride == null) {
def gitDetails = versionDetails()
def isDirty = gitVersion().endsWith(".dirty") // No public API for this, isCleanTag has a different meaning
String branchName = gitDetails.branchName ?: (System.getenv('GIT_BRANCH') ?: 'git')
if (branchName.startsWith('origin/')) {
branchName = branchName.minus('origin/')
}
branchName = branchName.replaceAll("[^a-zA-Z0-9-]+", "-") // sanitize branch names for semver
identifiedVersion = gitDetails.lastTag ?: '${gitDetails.gitHash}'
if (gitDetails.commitDistance > 0) {
identifiedVersion += "-${branchName}.${gitDetails.commitDistance}+${gitDetails.gitHash}"
if (isDirty) {
identifiedVersion += "-dirty"
}
} else if (isDirty) {
identifiedVersion += "-${branchName}+${gitDetails.gitHash}-dirty"
}
} else {
identifiedVersion = versionOverride
}
} }
catch (Exception ignored) { catch (Exception ignored) {
out.style(Style.Failure).text( out.style(Style.Failure).text(
@@ -463,10 +487,19 @@ sourceSets {
} }
} }
if (file('addon.gradle').exists()) { if (file('addon.gradle.kts').exists()) {
apply from: 'addon.gradle.kts'
} else if (file('addon.gradle').exists()) {
apply from: 'addon.gradle' apply from: 'addon.gradle'
} }
// File for local tweaks not commited to Git
if (file('addon.local.gradle.kts').exists()) {
apply from: 'addon.local.gradle.kts'
} else if (file('addon.local.gradle').exists()) {
apply from: 'addon.local.gradle'
}
// Allow unsafe repos but warn // Allow unsafe repos but warn
repositories.configureEach { repo -> repositories.configureEach { repo ->
if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository) { if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository) {
@@ -477,7 +510,14 @@ repositories.configureEach { repo ->
} }
} }
apply from: 'repositories.gradle' if (file('repositories.gradle.kts').exists()) {
apply from: 'repositories.gradle.kts'
} else if (file('repositories.gradle').exists()) {
apply from: 'repositories.gradle'
} else {
logger.error("Neither repositories.gradle.kts nor repositories.gradle was found, make sure you extracted the full ExampleMod template.")
throw new RuntimeException("Missing repositories.gradle[.kts]")
}
configurations { configurations {
runtimeClasspath.extendsFrom(runtimeOnlyNonPublishable) runtimeClasspath.extendsFrom(runtimeOnlyNonPublishable)
@@ -567,9 +607,10 @@ repositories {
def mixinProviderGroup = "io.github.legacymoddingmc" def mixinProviderGroup = "io.github.legacymoddingmc"
def mixinProviderModule = "unimixins" def mixinProviderModule = "unimixins"
def mixinProviderVersion = "0.1.6" def mixinProviderVersion = "0.1.7.1"
def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}" def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}"
def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev" def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev"
ext.mixinProviderSpec = mixinProviderSpec
dependencies { dependencies {
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
@@ -608,7 +649,32 @@ configurations.all {
} }
} }
apply from: 'dependencies.gradle' dependencies {
constraints {
def minGtnhLibVersion = "0.0.13"
implementation("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
}
runtimeOnly("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
}
devOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
}
runtimeOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
}
}
}
if (file('dependencies.gradle.kts').exists()) {
apply from: 'dependencies.gradle.kts'
} else if (file('dependencies.gradle').exists()) {
apply from: 'dependencies.gradle'
} else {
logger.error("Neither dependencies.gradle.kts nor dependencies.gradle was found, make sure you extracted the full ExampleMod template.")
throw new RuntimeException("Missing dependencies.gradle[.kts]")
}
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
def mixinTmpDir = buildDir.path + File.separator + 'tmp' + File.separator + 'mixins' def mixinTmpDir = buildDir.path + File.separator + 'tmp' + File.separator + 'mixins'
@@ -721,13 +787,13 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies"
} }
dependencies { dependencies {
def lwjgl3ifyVersion = '1.3.5' def lwjgl3ifyVersion = '1.4.0'
def asmVersion = '9.4' def asmVersion = '9.4'
if (modId != 'lwjgl3ify') { if (modId != 'lwjgl3ify') {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
} }
if (modId != 'hodgepodge') { if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.8') java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.19')
} }
java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false} java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false}
@@ -820,6 +886,18 @@ public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask {
} }
this.classpath(project.java17DependenciesCfg) this.classpath(project.java17DependenciesCfg)
} }
public void setup(Project project) {
super.setup(project)
if (project.usesMixins.toBoolean()) {
this.extraJvmArgs.addAll(project.provider(() -> {
def mixinCfg = project.configurations.detachedConfiguration(project.dependencies.create(project.mixinProviderSpec))
mixinCfg.canBeConsumed = false
mixinCfg.transitive = false
enableHotswap ? ["-javaagent:" + mixinCfg.singleFile.absolutePath] : []
}))
}
}
} }
def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Distribution.CLIENT, "runClient") def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Distribution.CLIENT, "runClient")
@@ -964,6 +1042,9 @@ idea {
} }
} }
runConfigurations { runConfigurations {
"0. Build and Test"(Gradle) {
taskNames = ["build"]
}
"1. Run Client"(Gradle) { "1. Run Client"(Gradle) {
taskNames = ["runClient"] taskNames = ["runClient"]
} }
@@ -1083,6 +1164,11 @@ tasks.named("processIdeaSettings").configure {
dependsOn("injectTags") dependsOn("injectTags")
} }
tasks.named("ideVirtualMainClasses").configure {
// Make IntelliJ "Build project" build the mod jars
dependsOn("jar", "reobfJar", "spotlessCheck")
}
// workaround variable hiding in pom processing // workaround variable hiding in pom processing
def projectConfigs = project.configurations def projectConfigs = project.configurations
@@ -1103,12 +1189,14 @@ publishing {
} }
repositories { repositories {
maven { if (usesMavenPublishing.toBoolean()) {
url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases" maven {
allowInsecureProtocol = true url = mavenPublishUrl
credentials { allowInsecureProtocol = mavenPublishUrl.startsWith("http://") // Mostly for the GTNH maven
username = System.getenv("MAVEN_USER") ?: "NONE" credentials {
password = System.getenv("MAVEN_PASSWORD") ?: "NONE" username = System.getenv("MAVEN_USER") ?: "NONE"
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
}
} }
} }
} }
@@ -1261,10 +1349,14 @@ tasks.register('faq') {
description = 'Prints frequently asked questions about building a project' description = 'Prints frequently asked questions about building a project'
doLast { doLast {
print("If your build fails to fetch dependencies, they might have been deleted and replaced by newer " + print("If your build fails to fetch dependencies, run './gradlew updateDependencies'. " +
"versions.\nCheck if the versions you try to fetch are still on the distributing sites.\n" + "Or you can manually check if the versions are still on the distributing sites - " +
"The links can be found in repositories.gradle and build.gradle:repositories, " + "the links can be found in repositories.gradle and build.gradle:repositories, " +
"not build.gradle:buildscript.repositories - this one is for gradle plugin metadata.") "but not build.gradle:buildscript.repositories - those ones are for gradle plugin metadata.\n\n" +
"If your build fails to recognize the syntax of new Java versions, enable Jabel in your " +
"gradle.properties. See how it's done in GTNH ExampleMod/gradle.properties. " +
"However, keep in mind that Jabel enables only syntax features, but not APIs that were introduced in " +
"Java 9 or later.")
} }
} }
@@ -1325,8 +1417,14 @@ boolean isNewBuildScriptVersionAvailable() {
String currentBuildScript = getFile("build.gradle").getText() String currentBuildScript = getFile("build.gradle").getText()
String currentBuildScriptHash = getVersionHash(currentBuildScript) String currentBuildScriptHash = getVersionHash(currentBuildScript)
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText() String availableBuildScriptHash
String availableBuildScriptHash = getVersionHash(availableBuildScript) try {
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
availableBuildScriptHash = getVersionHash(availableBuildScript)
} catch (IOException e) {
logger.warn("Could not check for buildscript update availability: {}", e.message)
return false
}
boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash
return !isUpToDate return !isUpToDate
@@ -1491,3 +1589,17 @@ def getSecondaryArtifacts() {
if (apiPackage) secondaryArtifacts += [apiJar] if (apiPackage) secondaryArtifacts += [apiJar]
return secondaryArtifacts return secondaryArtifacts
} }
// For easier scripting of things that require variables defined earlier in the buildscript
if (file('addon.late.gradle.kts').exists()) {
apply from: 'addon.late.gradle.kts'
} else if (file('addon.late.gradle').exists()) {
apply from: 'addon.late.gradle'
}
// File for local tweaks not commited to Git
if (file('addon.late.local.gradle.kts').exists()) {
apply from: 'addon.late.local.gradle.kts'
} else if (file('addon.late.local.gradle').exists()) {
apply from: 'addon.late.local.gradle'
}
+4 -4
View File
@@ -1,13 +1,13 @@
// Add your dependencies here // Add your dependencies here
dependencies { dependencies {
compile('com.github.GTNewHorizons:ForestryMC:4.6.7:dev') compile('com.github.GTNewHorizons:ForestryMC:4.6.12-pre:dev')
compileOnly('com.github.GTNewHorizons:BloodMagic:1.4.1:dev') compileOnly('com.github.GTNewHorizons:BloodMagic:1.4.2:dev')
compileOnly('com.github.GTNewHorizons:Baubles:1.0.1.16:dev') {transitive = false} compileOnly('com.github.GTNewHorizons:Baubles:1.0.1.16:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:Botania:1.9.21-GTNH:api') {transitive = false} compileOnly('com.github.GTNewHorizons:Botania:1.9.23-GTNH:api') {transitive = false}
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') {transitive = false} compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.42.89:dev') { transitive = false } compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.43.128:dev') { transitive = false }
} }