mirror of
https://github.com/Anuken/Mindustry.git
synced 2024-11-15 10:13:28 +03:00
265 lines
7.4 KiB
Groovy
265 lines
7.4 KiB
Groovy
buildscript{
|
|
repositories{
|
|
mavenLocal()
|
|
mavenCentral()
|
|
google()
|
|
maven{ url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
|
jcenter()
|
|
}
|
|
|
|
dependencies{
|
|
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.6'
|
|
classpath "com.badlogicgames.gdx:gdx-tools:1.9.9"
|
|
classpath "com.badlogicgames.packr:packr:2.1-SNAPSHOT"
|
|
}
|
|
}
|
|
|
|
allprojects{
|
|
apply plugin: "idea"
|
|
|
|
version = 'release'
|
|
|
|
ext{
|
|
versionNumber = '4'
|
|
versionModifier = 'beta'
|
|
if(!project.hasProperty("versionType")) versionType = 'official'
|
|
appName = 'Mindustry'
|
|
gdxVersion = '1.9.9'
|
|
roboVMVersion = '2.3.6'
|
|
arcHash = null
|
|
|
|
debugged = {
|
|
return new File(projectDir.parent, '../debug').exists() && !project.hasProperty("release")
|
|
}
|
|
|
|
localArc = {
|
|
return (!project.hasProperty("release")) && new File(projectDir.parent, '../Arc').exists()
|
|
}
|
|
|
|
getArcHash = {
|
|
//get latest commit hash from gtihub since JITPack's '-snapshot' version doesn't work correctly
|
|
if(arcHash == null){
|
|
try{
|
|
arcHash = 'git ls-remote https://github.com/Anuken/Arc.git'.execute().text.split("\t")[0]
|
|
}catch(e){
|
|
e.printStackTrace()
|
|
arcHash = "-SNAPSHOT"
|
|
}
|
|
}
|
|
return arcHash
|
|
}
|
|
|
|
arcModule = { String name ->
|
|
if(localArc()){
|
|
return project(":Arc:$name")
|
|
}else{
|
|
//skip to last submodule
|
|
if(name.contains(':')) name = name.split(':').last()
|
|
return "com.github.Anuken.Arc:$name:${getArcHash()}"
|
|
}
|
|
}
|
|
|
|
getVersionString = {
|
|
String buildVersion = getBuildVersion()
|
|
return "$versionNumber-$versionModifier-$buildVersion"
|
|
}
|
|
|
|
getBuildVersion = {
|
|
if(!project.hasProperty("buildversion")) return "custom build"
|
|
return project.getProperties()["buildversion"]
|
|
}
|
|
|
|
getPackage = {
|
|
return project.ext.mainClassName.substring(0, project.ext.mainClassName.indexOf("desktop") - 1)
|
|
}
|
|
|
|
generateLocales = {
|
|
def output = 'en\n'
|
|
def bundles = new File(project(':core').projectDir, 'assets/bundles/')
|
|
bundles.listFiles().each{ other ->
|
|
if(other.name == "bundle.properties") return
|
|
output += other.name.substring("bundle".length() + 1, other.name.lastIndexOf('.')) + "\n"
|
|
}
|
|
new File(project(':core').projectDir, 'assets/locales').text = output
|
|
}
|
|
|
|
writeVersion = {
|
|
def pfile = new File(project(':core').projectDir, 'assets/version.properties')
|
|
def props = new Properties()
|
|
|
|
try{
|
|
pfile.createNewFile()
|
|
}catch(Exception ignored){
|
|
}
|
|
|
|
if(pfile.exists()){
|
|
props.load(new FileInputStream(pfile))
|
|
|
|
String buildid = getBuildVersion()
|
|
|
|
props["type"] = versionType
|
|
props["number"] = versionNumber
|
|
props["modifier"] = versionModifier
|
|
props["build"] = buildid
|
|
|
|
props.store(pfile.newWriter(), "Autogenerated file. Do not modify.")
|
|
}
|
|
}
|
|
}
|
|
|
|
repositories{
|
|
mavenLocal()
|
|
mavenCentral()
|
|
maven{ url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
|
maven{ url "https://oss.sonatype.org/content/repositories/releases/" }
|
|
maven{ url 'https://jitpack.io' }
|
|
}
|
|
}
|
|
|
|
project(":desktop"){
|
|
apply plugin: "java"
|
|
|
|
dependencies{
|
|
compile project(":core")
|
|
compile project(":net")
|
|
|
|
if(debugged()) compile project(":debug")
|
|
|
|
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
|
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
|
|
|
compile arcModule("backends:backend-lwjgl3")
|
|
compile 'com.github.MinnDevelopment:java-discord-rpc:v2.0.0'
|
|
}
|
|
}
|
|
|
|
project(":ios"){
|
|
apply plugin: "java"
|
|
apply plugin: "robovm"
|
|
|
|
task incrementConfig{
|
|
def vfile = file('robovm.properties')
|
|
|
|
def props = new Properties()
|
|
if(vfile.exists()){
|
|
props.load(new FileInputStream(vfile))
|
|
}
|
|
|
|
props['app.id'] = 'io.anuke.mindustry'
|
|
props['app.version'] = '4.0'
|
|
props['app.mainclass'] = 'io.anuke.mindustry.IOSLauncher'
|
|
props['app.executable'] = 'IOSLauncher'
|
|
props['app.name'] = 'Mindustry'
|
|
props['app.build'] = (!props.containsKey("app.build") ? 40 : props['app.build'].toInteger() + 1) + ""
|
|
props.store(vfile.newWriter(), null)
|
|
}
|
|
|
|
dependencies{
|
|
compile project(":core")
|
|
compile project(":net")
|
|
compileOnly project(":annotations")
|
|
|
|
compile arcModule("backends:backend-robovm")
|
|
|
|
compile "com.mobidevelop.robovm:robovm-rt:$roboVMVersion"
|
|
compile "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion"
|
|
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
|
|
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios"
|
|
}
|
|
}
|
|
|
|
project(":core"){
|
|
apply plugin: "java"
|
|
|
|
task finish{
|
|
generateLocales()
|
|
}
|
|
|
|
task cleanGen{
|
|
doFirst{
|
|
delete{
|
|
delete "../core/src/io/anuke/mindustry/gen/"
|
|
}
|
|
}
|
|
}
|
|
|
|
task copyGen{
|
|
doLast{
|
|
copy{
|
|
from("../core/build/classes/java/main/io/anuke/mindustry/gen/"){
|
|
include "**/*.java"
|
|
}
|
|
|
|
into "../core/src/io/anuke/mindustry/gen"
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies{
|
|
compileJava.dependsOn(cleanGen)
|
|
compileJava.finalizedBy(copyGen)
|
|
|
|
compile arcModule("arc-core")
|
|
compile arcModule("extensions:freetype")
|
|
//compile arcModule("extensions:postprocessing")
|
|
if(localArc() && debugged()) compile arcModule("extensions:recorder")
|
|
|
|
compileOnly project(":annotations")
|
|
annotationProcessor project(":annotations")
|
|
}
|
|
}
|
|
|
|
project(":server"){
|
|
apply plugin: "java"
|
|
|
|
dependencies{
|
|
compile project(":core")
|
|
compile project(":net")
|
|
compile arcModule("backends:backend-headless")
|
|
}
|
|
}
|
|
|
|
project(":tests"){
|
|
apply plugin: "java"
|
|
|
|
dependencies{
|
|
testImplementation project(":core")
|
|
testImplementation "org.junit.jupiter:junit-jupiter-params:5.3.1"
|
|
testImplementation "org.junit.jupiter:junit-jupiter-api:5.3.1"
|
|
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.3.1"
|
|
compile arcModule("backends:backend-headless")
|
|
}
|
|
|
|
test{
|
|
useJUnitPlatform()
|
|
workingDir = new File("../core/assets")
|
|
}
|
|
}
|
|
|
|
project(":tools"){
|
|
apply plugin: "java"
|
|
|
|
dependencies{
|
|
compile project(":core")
|
|
}
|
|
}
|
|
|
|
project(":annotations"){
|
|
apply plugin: "java"
|
|
|
|
dependencies{
|
|
compile 'com.squareup:javapoet:1.11.0'
|
|
}
|
|
}
|
|
|
|
project(":net"){
|
|
apply plugin: "java"
|
|
|
|
dependencies{
|
|
compile project(":core")
|
|
compile "org.lz4:lz4-java:1.4.1"
|
|
compile 'com.github.Anuken:kryonet:a64d2280880e80566ca1bdaffa55de43e51cad38'
|
|
compile 'com.github.Anuken:WaifUPnP:05eb46bc577fd7674596946ba288c96c0cedd893'
|
|
}
|
|
}
|