chore: slimmed down (build|properties).gradle

This commit is contained in:
əlemi 2023-02-02 00:23:02 +01:00
parent 7ef6f46d8a
commit cb16fd72bf
No known key found for this signature in database
GPG key ID: BBCBFE5D7244634E
2 changed files with 25 additions and 40 deletions

View file

@ -17,14 +17,12 @@ apply plugin: "com.palantir.git-version"
version = gitVersion()
group = 'co.fantabos.bscv'
archivesBaseName = 'boscovicino'
minecraftVersion = '1.16.5'
def minecraftVersion = '1.16.5'
project.ext {
forgeVersion = getProjectProperty("bscv.forge.version", "1.16.5-36.2.39")
copyJarDo = getProjectProperty("copyjar.do", "false")
copyJarUseVersionSubDir = getProjectProperty("copyjar.useVersionSubDir", "false")
copyJarKeepBackups = getProjectProperty("copyjar.keepBackups", "true")
copyJarTargetGameDir = getProjectProperty("copyjar.targetGameDir", getOsGameDir())
project.ext { // external properties coming from gradle.properties
forgeVersion = getProjectProperty("bscv.forge.version", "1.16.5-36.2.34")
deployJarDo = getProjectProperty("deployJar.do", "false")
deployJarTargetDir = getProjectProperty("deployJar.targetDir", getOsGameDir())
}
def getProjectProperty(String property, String fallback) { //allows for custom gradle.properties while retaining default fallback values
@ -33,11 +31,11 @@ def getProjectProperty(String property, String fallback) { //allows for custom g
def getOsGameDir() {
if (org.gradle.internal.os.OperatingSystem.current().isWindows())
return System.getenv("APPDATA") + "/.minecraft"
return System.getenv("APPDATA") + "/.minecraft/mods"
else if (org.gradle.internal.os.OperatingSystem.current().isMacOsX())
return System.properties["user.home"] + "/Library/Application Support/minecraft"
return System.properties["user.home"] + "/Library/Application Support/minecraft/mods"
else
return System.properties["user.home"] + "/.minecraft"
return System.properties["user.home"] + "/.minecraft/mods"
}
java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java 8 to end users, so your mod should target Java 8.
@ -110,24 +108,11 @@ jar {
jar.finalizedBy('reobfJar')
tasks.register('copyJar', Copy) {
if(!project.ext.copyJarDo.toBoolean()) return
def modDir = "${project.ext.copyJarTargetGameDir}/mods/"
// find previous jar (if it exists)
final previousJars = project.fileTree(dir: modDir).matching {
include project.archivesBaseName + '*'
}.files
previousJars
.stream()
.filter(f -> f.toString().toLowerCase().endsWith("jar")) //dont kill old backups but smite existing jars
.forEach(f -> f.delete())
//copy jar from build/libs to the forge mod folder
//from shadowJar //we want the über version, not the small one
tasks.register('copyJar', Copy) {
if (!project.ext.deployJarDo.toBoolean()) return
from project.jar
into modDir
into project.ext.copyJarTargetGameDir
}
publishing {

View file

@ -4,17 +4,17 @@
# Still, beware that misuse of the properties file may result in build failure.
# You shouldn't touch the properties starting with "bscv" unless you really know what you are doing.
#The Minecraft version the client is for. Changing this may break things, take care.
bscv.mc.version=1.16.5
#The Forge version the client is built with. Minor version changes SHOULD work fine.
bscv.forge.version=1.16.5-36.2.39
#Tells build.gradle to automatically copy the resulting artifact to your mods folder.
copyjar.do=false
#Whether you want tha artifact to be stored in a version-specific subfolder (e.g. mods/1.12.2/).
copyjar.useVersionSubDir=false
#Saves old artifacts found in the mods folder in a .backup subfolder.
copyjar.keepBackups=true
#Tells the build.gradle where to find the game folder to copy the JAR in.
#Only use this if you want to use the auto-copy feature with third party launchers such as PolyMC and MultiMC.
#Note that, regardless of your OS, you should use "/" as folder separator.
copyjar.targetGameDir=C:/Program Files/MultiMC/instances/BoSCoVicino/.minecraft
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
org.gradle.jvmargs=-Xmx3G
# Disable gradle daemon, making it start and stop for each build
org.gradle.daemon=false
# Specify path to jdk to use for building
org.gradle.java.home=/usr/lib/jvm/java-8-openjdk/
# Automatically copy built jar into target directory
deployJar.do=true
# Target directory for jar deployment
deployJar.targetDir=/home/alemi/.local/share/PrismLauncher/instances/bscv/.minecraft/mods/