diff options
author | alemidev <me@alemi.dev> | 2023-02-02 00:23:02 +0100 |
---|---|---|
committer | alemidev <me@alemi.dev> | 2023-02-02 00:23:02 +0100 |
commit | cb16fd72bf33554232d46a7934f09a2fbb07e213 (patch) | |
tree | b2b1a024904c1655be4f0cd906701db1cb21ad88 /build.gradle | |
parent | 7ef6f46d8ace2881c01f6ada0839d6dc525b1d4e (diff) |
chore: slimmed down (build|properties).gradle
Diffstat (limited to 'build.gradle')
-rw-r--r-- | build.gradle | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/build.gradle b/build.gradle index 5eed085..7eddebb 100644 --- a/build.gradle +++ b/build.gradle @@ -17,14 +17,12 @@ apply plugin: "com.palantir.git-version" version = gitVersion() group = 'co.fantabos.bscv' archivesBaseName = 'boscovicino' -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()) +def minecraftVersion = '1.16.5' + +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') +//copy jar from build/libs to the forge mod folder 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 + if (!project.ext.deployJarDo.toBoolean()) return from project.jar - into modDir + into project.ext.copyJarTargetGameDir } publishing { |