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

293 lines
8.4 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{
2019-08-14 06:26:25 +03:00
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.7'
2019-07-22 19:42:42 +03:00
classpath "com.badlogicgames.gdx:gdx-tools:1.9.10"
classpath "com.badlogicgames.packr:packr:2.1-SNAPSHOT"
2017-04-30 04:25:59 +03:00
}
}
allprojects{
2017-12-19 08:05:41 +03:00
version = 'release'
2018-02-22 03:50:27 +03:00
ext{
versionNumber = '4'
versionModifier = 'beta'
if(!project.hasProperty("versionType")) versionType = 'official'
appName = 'Mindustry'
2019-07-22 19:42:42 +03:00
gdxVersion = '1.9.10'
2019-08-14 06:26:25 +03:00
roboVMVersion = '2.3.7'
2018-12-29 20:22:41 +03:00
arcHash = null
2019-04-08 16:03:18 +03:00
debugged = {
2019-05-12 19:00:19 +03:00
return new File(projectDir.parent, '../debug').exists() && !project.hasProperty("release") && project.hasProperty("args")
}
2018-12-29 20:22:41 +03:00
localArc = {
2019-03-23 20:40:13 +03:00
return (!project.hasProperty("release")) && new File(projectDir.parent, '../Arc').exists()
2018-12-29 20:22:41 +03:00
}
getArcHash = {
2019-06-23 18:03:05 +03:00
//get latest commit hash from github 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()
2019-03-25 02:58:51 +03:00
arcHash = "-SNAPSHOT"
2018-12-29 21:06:17 +03:00
}
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()
2019-04-08 16:03:18 +03:00
}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' }
2019-04-13 21:57:26 +03:00
jcenter()
2017-04-30 04:25:59 +03:00
}
tasks.withType(Javadoc).all{ enabled = false }
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")
2019-04-08 16:03:18 +03:00
if(debugged()) 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")
2019-04-13 21:41:56 +03:00
compile 'com.github.MinnDevelopment:java-discord-rpc:v2.0.2'
2017-04-30 04:25:59 +03:00
}
}
project(":desktop-sdl"){
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-sdl")
compile 'com.github.MinnDevelopment:java-discord-rpc:v2.0.2'
}
}
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")
2019-03-24 01:33:33 +03:00
compileOnly project(":annotations")
2019-04-08 16:03:18 +03:00
2018-12-29 19:59:43 +03:00
compile arcModule("backends:backend-robovm")
2019-04-08 16:03:18 +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"
2019-06-23 17:52:03 +03:00
task preGen{
generateLocales()
}
dependencies{
2019-06-20 22:34:48 +03:00
if(System.properties["user.name"] == "anuke"){
2019-05-05 18:36:38 +03:00
task cleanGen{
doFirst{
delete{
delete "../core/src/io/anuke/mindustry/gen/"
}
}
}
task copyGen{
doLast{
copy{
from("../core/build/generated/sources/annotationProcessor/java/main/io/anuke/mindustry/gen"){
include "**/*.java"
}
into "../core/src/io/anuke/mindustry/gen"
}
}
}
compileJava.dependsOn(cleanGen)
compileJava.finalizedBy(copyGen)
}
2019-06-23 18:03:05 +03:00
2019-06-23 17:52:03 +03:00
compileJava.dependsOn(preGen)
2019-05-05 18:36:38 +03:00
2018-12-29 19:59:43 +03:00
compile arcModule("arc-core")
compile arcModule("extensions:freetype")
compile arcModule("extensions:arcnet")
if(localArc() && debugged()) 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")
2019-06-20 23:27:57 +03:00
//for render tests
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
2019-07-27 04:24:07 +03:00
compile arcModule("backends:backend-sdl")
2018-06-16 01:06:05 +03:00
}
}
project(":annotations"){
apply plugin: "java"
dependencies{
compile 'com.squareup:javapoet:1.11.0'
2019-05-05 18:36:38 +03:00
compile files("${System.getProperty('java.home')}/../lib/tools.jar")
}
}
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"
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
}