Mindustry/server/build.gradle
2018-02-01 22:16:00 -05:00

59 lines
1.6 KiB
Groovy

apply plugin: "java"
sourceCompatibility = 1.8
sourceSets.main.java.srcDirs = [ "src/" ]
project.ext.mainClassName = "io.anuke.mindustry.server.ServerLauncher"
project.ext.assetsDir = new File("../core/assets");
ext.getDeployVersion = {
if(project.gradle.startParameter.taskNames.size() == 0 || !project.gradle.startParameter.taskNames.first().contains("deploy")) return;
if(!project.hasProperty("deployversion")){
throw new InvalidUserDataException("No version set. Set version with -Pdeployversion=name");
}
return deployversion;
}
task run(dependsOn: classes, type: JavaExec) {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
if (project.hasProperty("appArgs")) {
args Eval.me(appArgs)
}
}
task debug(dependsOn: classes, type: JavaExec) {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
debug = true
}
task dist(type: Jar) {
from files(sourceSets.main.output.classesDirs)
from files(sourceSets.main.output.resourcesDir)
from {configurations.compile.collect {zipTree(it)}}
from files(project.assetsDir);
manifest {
attributes 'Main-Class': project.mainClassName
}
}
task deploy(type: Copy){
dependsOn "dist"
from "build/libs/server-release.jar"
into "../deploy/";
rename ("server-release.jar", appName + "-server-" + getDeployVersion() + ".jar");
}
dist.dependsOn classes