1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-11 08:15:35 +03:00
Mindustry/build.gradle

257 lines
7.2 KiB
Groovy
Raw Normal View History

buildscript{
repositories{
2017-04-30 04:25:59 +03:00
mavenLocal()
mavenCentral()
2017-12-20 04:51:46 +03:00
google()
maven{ url "https://oss.sonatype.org/content/repositories/snapshots/" }
2017-04-30 04:25:59 +03:00
jcenter()
}
2018-12-29 23:58:11 +03:00
dependencies{
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.5'
classpath "com.badlogicgames.gdx:gdx-tools:1.9.9"
2017-04-30 04:25:59 +03:00
}
}
allprojects{
2017-04-30 04:25:59 +03:00
apply plugin: "idea"
2017-12-19 08:05:41 +03:00
version = 'release'
2018-02-22 03:50:27 +03:00
ext{
versionNumber = '4'
2018-09-04 19:10:48 +03:00
versionModifier = 'alpha'
if(!project.hasProperty("versionType")) versionType = 'official'
appName = 'Mindustry'
2018-11-17 07:36:11 +03:00
gdxVersion = '1.9.9'
2018-04-27 23:01:37 +03:00
roboVMVersion = '2.3.0'
2018-12-29 20:22:41 +03:00
arcHash = null
localArc = {
return (System.properties["release"] == null || System.properties["release"] == "false") && new File(projectDir.parent, '../Arc').exists()
}
getArcHash = {
//get latest commit hash from gtihub since JITPack's '-snapshot' version doesn't work correctly
2018-12-29 21:06:17 +03:00
if(arcHash == null){
try{
arcHash = 'git ls-remote https://github.com/Anuken/Arc.git'.execute().text.split("\t")[0]
2018-12-30 19:41:06 +03:00
}catch(e){
2018-12-30 18:27:37 +03:00
e.printStackTrace()
2018-12-29 21:06:17 +03:00
arcHash = "-SNAPSHOT";
}
2018-12-29 23:58:11 +03:00
}
2018-12-29 20:22:41 +03:00
return arcHash
}
2018-12-29 19:59:43 +03:00
arcModule = { String name ->
2018-12-29 20:22:41 +03:00
if(localArc()){
2018-12-29 19:59:43 +03:00
return project(":Arc:$name")
}else{
2018-12-29 20:22:41 +03:00
//skip to last submodule
2018-12-29 19:59:43 +03:00
if(name.contains(':')) name = name.split(':').last()
2018-12-29 20:22:41 +03:00
return "com.github.Anuken.Arc:$name:${getArcHash()}"
2018-12-29 19:59:43 +03:00
}
}
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)
}
2018-05-03 20:04:30 +03:00
generateLocales = {
2018-09-09 23:19:53 +03:00
def output = 'en\n'
2018-08-24 20:54:53 +03:00
def bundles = new File(project(':core').projectDir, 'assets/bundles/')
bundles.listFiles().each{ other ->
2018-10-06 18:56:39 +03:00
if(other.name == "bundle.properties") return
2018-09-09 23:19:53 +03:00
output += other.name.substring("bundle".length() + 1, other.name.lastIndexOf('.')) + "\n"
}
2018-10-06 18:56:39 +03:00
new File(project(':core').projectDir, 'assets/locales').text = output
}
2018-05-03 20:04:30 +03:00
writeVersion = {
2018-08-24 20:54:53 +03:00
def pfile = new File(project(':core').projectDir, 'assets/version.properties')
2018-05-03 20:04:30 +03:00
def props = new Properties()
try{
pfile.createNewFile()
}catch(Exception ignored){}
2018-05-03 20:04:30 +03:00
if(pfile.exists()){
2018-05-03 20:04:30 +03:00
props.load(new FileInputStream(pfile))
2018-09-04 19:10:48 +03:00
String buildid = getBuildVersion()
2018-05-03 20:04:30 +03:00
2018-09-04 19:10:48 +03:00
props["type"] = versionType
props["number"] = versionNumber
props["modifier"] = versionModifier
props["build"] = buildid
2018-05-03 20:04:30 +03:00
props.store(pfile.newWriter(), "Autogenerated file. Do not modify.")
}
}
2017-04-30 04:25:59 +03:00
}
repositories{
2017-04-30 04:25:59 +03:00
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' }
2017-04-30 04:25:59 +03:00
}
}
project(":desktop"){
2017-04-30 04:25:59 +03:00
apply plugin: "java"
dependencies{
2017-04-30 04:25:59 +03:00
compile project(":core")
2018-12-27 01:38:40 +03:00
compile project(":net")
2018-12-27 23:47:17 +03:00
2018-09-26 06:27:19 +03:00
if(new File(projectDir.parent, '../debug').exists() && System.properties["release"] == null) compile project(":debug")
2018-09-11 02:33:12 +03:00
2017-04-30 04:25:59 +03:00
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
2018-11-06 20:55:13 +03:00
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
2018-12-27 01:38:40 +03:00
2018-12-29 19:59:43 +03:00
compile arcModule("backends:backend-lwjgl3")
2018-05-14 07:43:53 +03:00
compile 'com.github.MinnDevelopment:java-discord-rpc:v2.0.0'
2017-04-30 04:25:59 +03:00
}
}
project(":ios"){
2018-04-27 23:01:37 +03:00
apply plugin: "java"
apply plugin: "robovm"
2018-11-21 03:28:26 +03:00
task incrementConfig{
def vfile = file('robovm.properties')
def props = new Properties()
if(vfile.exists()){
props.load(new FileInputStream(vfile))
}
2018-11-21 03:28:26 +03:00
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) + ""
2018-11-21 03:28:26 +03:00
props.store(vfile.newWriter(), null)
}
dependencies{
2018-04-27 23:01:37 +03:00
compile project(":core")
2018-12-27 23:47:17 +03:00
compile project(":net")
2018-04-28 06:42:59 +03:00
2018-12-29 19:59:43 +03:00
compile arcModule("backends:backend-robovm")
2018-12-27 23:47:17 +03:00
2018-04-27 23:01:37 +03:00
compile "com.mobidevelop.robovm:robovm-rt:$roboVMVersion"
compile "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
2018-11-06 20:55:13 +03:00
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios"
2018-04-27 23:01:37 +03:00
}
}
project(":core"){
2017-04-30 04:25:59 +03:00
apply plugin: "java"
task finish{
generateLocales()
}
2019-01-06 17:42:08 +03:00
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{
2019-01-06 17:42:08 +03:00
compileJava.dependsOn(cleanGen)
2019-01-09 19:52:45 +03:00
compileJava.finalizedBy(copyGen)
2018-12-29 20:22:41 +03:00
2018-12-29 19:59:43 +03:00
compile arcModule("arc-core")
compile arcModule("extensions:freetype")
2019-01-27 20:31:14 +03:00
if(localArc()) compile arcModule("extensions:recorder")
2018-10-29 01:34:18 +03:00
compileOnly project(":annotations")
2018-10-28 21:26:58 +03:00
annotationProcessor project(":annotations")
2017-04-30 04:25:59 +03:00
}
}
project(":server"){
apply plugin: "java"
dependencies{
compile project(":core")
2018-12-27 01:38:40 +03:00
compile project(":net")
2018-12-29 19:59:43 +03:00
compile arcModule("backends:backend-headless")
}
}
2018-10-04 03:58:35 +03:00
project(":tests"){
apply plugin: "java"
dependencies{
2018-10-04 03:58:35 +03:00
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"
2018-12-29 19:59:43 +03:00
compile arcModule("backends:backend-headless")
2018-10-04 03:58:35 +03:00
}
test{
2018-10-04 03:58:35 +03:00
useJUnitPlatform()
workingDir = new File("../core/assets")
}
}
project(":tools"){
2018-06-16 01:06:05 +03:00
apply plugin: "java"
dependencies{
2018-06-16 01:06:05 +03:00
compile project(":core")
}
}
project(":annotations"){
apply plugin: "java"
dependencies{
compile 'com.squareup:javapoet:1.11.0'
}
}
2018-12-27 01:38:40 +03:00
project(":net"){
2018-01-01 21:32:18 +03:00
apply plugin: "java"
dependencies{
2018-01-01 21:32:18 +03:00
compile project(":core")
2018-09-09 00:07:25 +03:00
compile "org.lz4:lz4-java:1.4.1"
2019-01-04 23:12:34 +03:00
compile 'com.github.Anuken:kryonet:a64d2280880e80566ca1bdaffa55de43e51cad38'
2018-08-31 04:39:27 +03:00
compile 'com.github.Anuken:WaifUPnP:05eb46bc577fd7674596946ba288c96c0cedd893'
2018-01-01 21:32:18 +03:00
}
2018-12-30 17:21:16 +03:00
}