chore: slimmer build.gradle
This commit is contained in:
parent
7ebbb991d2
commit
7ef6f46d8a
1 changed files with 10 additions and 32 deletions
40
build.gradle
40
build.gradle
|
@ -8,17 +8,18 @@ buildscript {
|
|||
classpath "com.palantir.gradle.gitversion:gradle-git-version:0.13.0"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'net.minecraftforge.gradle'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: "com.palantir.git-version"
|
||||
|
||||
version gitVersion()
|
||||
group = 'co.fantabos.bscv'
|
||||
version = gitVersion()
|
||||
group = 'co.fantabos.bscv'
|
||||
archivesBaseName = 'boscovicino'
|
||||
minecraftVersion = '1.16.5'
|
||||
|
||||
project.ext {
|
||||
minecraftVersion = getProjectProperty("bscv.mc.version", "1.16.5")
|
||||
forgeVersion = getProjectProperty("bscv.forge.version", "1.16.5-36.2.39")
|
||||
copyJarDo = getProjectProperty("copyjar.do", "false")
|
||||
copyJarUseVersionSubDir = getProjectProperty("copyjar.useVersionSubDir", "false")
|
||||
|
@ -44,7 +45,7 @@ java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java
|
|||
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
|
||||
|
||||
minecraft {
|
||||
mappings channel: 'official', version: "${project.ext.minecraftVersion}"
|
||||
mappings channel: 'official', version: minecraftVersion
|
||||
runs {
|
||||
client {
|
||||
workingDirectory project.file('run')
|
||||
|
@ -113,38 +114,15 @@ tasks.register('copyJar', Copy) {
|
|||
if(!project.ext.copyJarDo.toBoolean()) return
|
||||
def modDir = "${project.ext.copyJarTargetGameDir}/mods/"
|
||||
|
||||
//check if the per-version subdirectory is disabled
|
||||
if(project.ext.copyJarUseVersionSubDir.toBoolean())
|
||||
modDir = modDir + project.ext.minecraftVersion
|
||||
|
||||
// find previous jar (if it exists)
|
||||
final previousJars = project.fileTree(dir: modDir).matching {
|
||||
include project.archivesBaseName + '*'
|
||||
}.files
|
||||
|
||||
//change filename
|
||||
if (previousJars) {
|
||||
if(copyJarKeepBackups.toBoolean()) {
|
||||
//create .backups folder
|
||||
final backupDir = modDir + '/.backups/'
|
||||
project.file(backupDir).mkdirs()
|
||||
|
||||
for (File previousJar : previousJars) {
|
||||
final n = modDir + '/.backups/' + previousJar.getName() + '.bk'
|
||||
def f = project.file(n)
|
||||
def i = 1
|
||||
while (f.exists()) {
|
||||
f = project.file(n + '_' + i)
|
||||
i++
|
||||
}
|
||||
previousJar.renameTo(f)
|
||||
}
|
||||
} else
|
||||
previousJars
|
||||
.stream()
|
||||
.filter(f -> f.toString().toLowerCase().endsWith("jar")) //dont kill old backups but smite existing jars
|
||||
.forEach(f -> f.delete())
|
||||
}
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue