Mindustry/settings.gradle
2023-10-30 14:56:40 -04:00

48 lines
1.7 KiB
Groovy

if(JavaVersion.current().ordinal() < JavaVersion.VERSION_16.ordinal()){
throw new Exception("!!! YOU MUST USE JAVA 16 OR ABOVE TO COMPILE AND RUN MINDUSTRY !!! Read the README. Your version: ${System.properties["java.version"]}")
}
include 'desktop', 'core', 'server', 'ios', 'annotations', 'tools', 'tests'
def use = { ... names ->
for(String name : names){
include(name)
project(name).projectDir = new File(settingsDir, "../${name.substring(1).replace(":", "/")}")
}
}
def hasSdk = System.getenv("ANDROID_HOME") != null
if(new File(settingsDir, 'local.properties').exists()){
def properties = new Properties()
properties.load(new File(settingsDir, 'local.properties').newDataInputStream())
if(properties.containsKey("sdk.dir")) hasSdk = true
}
if(System.getenv("JITPACK") == "true") hasSdk = false
if(hasSdk){
//hack: pretend the Android module doesn't exist when imported through IntelliJ
//why? because IntelliJ chokes on the new version of the Android plugin
//UPDATE: it no longer chokes on AGP with the latest version, but instead gives a completely different error. brilliant.
if(!System.getProperty("jna.tmpdir")?.contains("JetBrains")){
include 'android'
}
}else{
println("No Android SDK found. Skipping Android module.")
}
if(!hasProperty("release") && !hasProperty("noLocalArc")){
if(new File(rootDir.parent, 'Arc').exists()){
println("Compiling with localArc")
includeBuild("../Arc")
}
if(new File(rootDir.parent, 'Mindustry-Debug').exists()){
include(":debug")
project(":debug").projectDir = new File(rootDir.parent, "Mindustry-Debug")
}
}else{
println("Not including local repositories.")
}