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.5' classpath "com.badlogicgames.gdx:gdx-tools:1.9.9" } } allprojects{ apply plugin: "idea" version = 'release' ext{ versionNumber = '4' versionModifier = 'alpha' if(!project.hasProperty("versionType")) versionType = 'official' appName = 'Mindustry' gdxVersion = '1.9.9' roboVMVersion = '2.3.0' uCoreVersion = '7ffeb2a9c754f4d31ca13e02dd857876b0707dc5' 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(":kryonet") if(new File(projectDir.parent, '../debug').exists() && System.properties["release"] == null) compile project(":debug") compile "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion" compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" compile "com.badlogicgames.gdx:gdx-controllers-lwjgl3:$gdxVersion" compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop" compile 'com.github.MinnDevelopment:java-discord-rpc:v2.0.0' } } project(":ios"){ apply plugin: "java" apply plugin: "robovm" task copyGen{ doLast{ copy{ from("../core/build/classes/java/main/io/anuke/mindustry/gen/"){ include "**/*.java" } into "../core/src/io/anuke/mindustry/gen" } } doFirst{ delete{ delete "../core/src/io/anuke/mindustry/gen/" } } } 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) } build.dependsOn(incrementConfig) if(file('robovm.properties').exists()){ build.dependsOn(copyGen) } dependencies{ compile project(":core") implementation project(":kryonet") compile "com.mobidevelop.robovm:robovm-rt:$roboVMVersion" compile "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion" compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion" 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() } dependencies{ build.finalizedBy(finish) def comp = System.properties["release"] == null || System.properties["release"] == "false" if(!comp) println("Note: Compiling release build.") if(new File(projectDir.parent, '../Arc').exists() && comp){ println(project(":Arc:extensions").subprojects) compile project(":Arc:core") compile project(":Arc:extensions:freetype") }else{ //TODO compile arc from jitpack //compile 'com.github.Anuken.Arc:arc:-SNAPSHOT' } // if(new File(projectDir.parent, '../GDXGifRecorder').exists() && comp){ // compile project(":GDXGifRecorder") // } //compile "com.badlogicgames.gdx:gdx:$gdxVersion" //compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion" //compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" compileOnly project(":annotations") annotationProcessor project(":annotations") } } project(":server"){ apply plugin: "java" configurations{ if(findProject(":android") != null){ compile.exclude module: android } } dependencies{ compile project(":core") compile project(":kryonet") compile "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion" compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" } } project(":tests"){ apply plugin: "java" dependencies{ testImplementation project(":core") testImplementation('org.junit.jupiter:junit-jupiter-api:5.1.0') testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.1.0') testImplementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion" testImplementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" } 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(":kryonet"){ apply plugin: "java" dependencies{ compile project(":core") compile "org.lz4:lz4-java:1.4.1" compile 'com.github.Anuken:kryonet:53b10247b1' compile 'com.github.Anuken:WaifUPnP:05eb46bc577fd7674596946ba288c96c0cedd893' } }