Working on compatibility with Create 6.

This commit is contained in:
Christian Knaapen
2025-03-15 15:24:44 +01:00
parent 8ed699b30e
commit 302efe2ee4
30 changed files with 228 additions and 1840 deletions

39
gradle/java.gradle Normal file
View File

@@ -0,0 +1,39 @@
apply plugin: 'java'
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
java.withSourcesJar()
java.withJavadocJar()
jar {
manifest {
attributes([
'Specification-Title' : mod_name,
'Specification-Vendor' : mod_author,
'Specification-Version' : project.jar.archiveVersion,
'Implementation-Title' : project.name,
'Implementation-Version' : project.jar.archiveVersion,
'Implementation-Vendor' : mod_author,
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
'Timestampe' : System.currentTimeMillis(),
'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})",
'Built-On-Minecraft' : minecraft_version
])
}
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = 'UTF-8'
it.options.release = 17
}
// Disables Gradle's custom module metadata from being published to maven. The
// metadata includes mapped dependencies which are not reasonably consumable by
// other mod developers.
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
javadoc {
// Suppress annoying warnings when generating JavaDoc files.
options.addStringOption('Xdoclint:none', '-quiet')
}

View File

@@ -0,0 +1,48 @@
/*
This module can inject build properties from a JSON file. Each property in the
JSON file will be mapped to a build property using the key of that property.
Property keys ending with _comment will be skipped.
If a secretFile property exists and points to a valid JSON file that file will
be automatically loaded. You can manually load a file using the loadProperties
method.
*/
import groovy.json.JsonSlurper
// Auto detects a secret file and injects it.
if (project.rootProject.hasProperty("secretFile")) {
project.logger.lifecycle("Automatically loading properties from the secretFile")
final def secretsFile = project.rootProject.file(project.rootProject.getProperty("secretFile"))
if (secretsFile.exists() && secretsFile.name.endsWith(".json")) {
loadProperties(secretsFile)
}
}
// Loads properties using a specified json file.
def loadProperties(propertyFile) {
if (propertyFile.exists()) {
propertyFile.withReader {
Map propMap = new JsonSlurper().parse it
for (entry in propMap) {
// Filter entries that use _comment in the key.
if (!entry.key.endsWith("_comment")) {
project.ext.set(entry.key, entry.value)
}
}
project.logger.lifecycle("Successfully loaded " + propMap.size() + " properties")
propMap.clear()
}
} else {
project.logger.warn("The property file " + propertyFile.getName() + " could not be loaded. It does not exist.")
}
}
// Allows other scripts to use these methods.
ext {
loadProperties = this.&loadProperties
}

Binary file not shown.

View File

@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists