chore: slimmed down (build|properties).gradle
This commit is contained in:
parent
7ef6f46d8a
commit
cb16fd72bf
2 changed files with 25 additions and 40 deletions
37
build.gradle
37
build.gradle
|
@ -17,14 +17,12 @@ apply plugin: "com.palantir.git-version"
|
||||||
version = gitVersion()
|
version = gitVersion()
|
||||||
group = 'co.fantabos.bscv'
|
group = 'co.fantabos.bscv'
|
||||||
archivesBaseName = 'boscovicino'
|
archivesBaseName = 'boscovicino'
|
||||||
minecraftVersion = '1.16.5'
|
def minecraftVersion = '1.16.5'
|
||||||
|
|
||||||
project.ext {
|
project.ext { // external properties coming from gradle.properties
|
||||||
forgeVersion = getProjectProperty("bscv.forge.version", "1.16.5-36.2.39")
|
forgeVersion = getProjectProperty("bscv.forge.version", "1.16.5-36.2.34")
|
||||||
copyJarDo = getProjectProperty("copyjar.do", "false")
|
deployJarDo = getProjectProperty("deployJar.do", "false")
|
||||||
copyJarUseVersionSubDir = getProjectProperty("copyjar.useVersionSubDir", "false")
|
deployJarTargetDir = getProjectProperty("deployJar.targetDir", getOsGameDir())
|
||||||
copyJarKeepBackups = getProjectProperty("copyjar.keepBackups", "true")
|
|
||||||
copyJarTargetGameDir = getProjectProperty("copyjar.targetGameDir", getOsGameDir())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def getProjectProperty(String property, String fallback) { //allows for custom gradle.properties while retaining default fallback values
|
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() {
|
def getOsGameDir() {
|
||||||
if (org.gradle.internal.os.OperatingSystem.current().isWindows())
|
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())
|
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
|
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.
|
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')
|
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
|
//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
|
from project.jar
|
||||||
into modDir
|
into project.ext.copyJarTargetGameDir
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
|
|
|
@ -4,17 +4,17 @@
|
||||||
# Still, beware that misuse of the properties file may result in build failure.
|
# 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.
|
# 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.
|
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||||
bscv.mc.version=1.16.5
|
org.gradle.jvmargs=-Xmx3G
|
||||||
#The Forge version the client is built with. Minor version changes SHOULD work fine.
|
|
||||||
bscv.forge.version=1.16.5-36.2.39
|
# Disable gradle daemon, making it start and stop for each build
|
||||||
#Tells build.gradle to automatically copy the resulting artifact to your mods folder.
|
org.gradle.daemon=false
|
||||||
copyjar.do=false
|
|
||||||
#Whether you want tha artifact to be stored in a version-specific subfolder (e.g. mods/1.12.2/).
|
# Specify path to jdk to use for building
|
||||||
copyjar.useVersionSubDir=false
|
org.gradle.java.home=/usr/lib/jvm/java-8-openjdk/
|
||||||
#Saves old artifacts found in the mods folder in a .backup subfolder.
|
|
||||||
copyjar.keepBackups=true
|
# Automatically copy built jar into target directory
|
||||||
#Tells the build.gradle where to find the game folder to copy the JAR in.
|
deployJar.do=true
|
||||||
#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.
|
# Target directory for jar deployment
|
||||||
copyjar.targetGameDir=C:/Program Files/MultiMC/instances/BoSCoVicino/.minecraft
|
deployJar.targetDir=/home/alemi/.local/share/PrismLauncher/instances/bscv/.minecraft/mods/
|
||||||
|
|
Loading…
Reference in a new issue