2018-12-14 06:01:51 +07:00
|
|
|
buildscript{
|
|
|
|
repositories{
|
2017-04-30 08:25:59 +07:00
|
|
|
mavenLocal()
|
|
|
|
mavenCentral()
|
2017-12-20 08:51:46 +07:00
|
|
|
google()
|
2018-12-14 06:01:51 +07:00
|
|
|
maven{ url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
2017-04-30 08:25:59 +07:00
|
|
|
jcenter()
|
2019-10-23 05:45:05 +07:00
|
|
|
maven{ url 'https://jitpack.io' }
|
2017-04-30 08:25:59 +07:00
|
|
|
}
|
2018-12-30 03:58:11 +07:00
|
|
|
|
2018-12-14 06:01:51 +07:00
|
|
|
dependencies{
|
2019-11-20 07:08:41 +07:00
|
|
|
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.8'
|
2019-07-22 23:42:42 +07:00
|
|
|
classpath "com.badlogicgames.gdx:gdx-tools:1.9.10"
|
2019-10-23 05:45:05 +07:00
|
|
|
classpath "com.github.anuken:packr:-SNAPSHOT"
|
2017-04-30 08:25:59 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-14 06:01:51 +07:00
|
|
|
allprojects{
|
2017-12-19 12:05:41 +07:00
|
|
|
version = 'release'
|
2019-11-20 10:32:59 +07:00
|
|
|
apply plugin: 'maven'
|
2019-08-29 09:07:08 +07:00
|
|
|
group = 'com.github.Anuken'
|
2018-02-22 07:50:27 +07:00
|
|
|
|
2018-12-14 06:01:51 +07:00
|
|
|
ext{
|
2019-10-25 05:52:42 +07:00
|
|
|
versionNumber = '5'
|
2019-09-08 03:03:20 +07:00
|
|
|
if(!project.hasProperty("versionModifier")) versionModifier = 'release'
|
2018-12-14 06:01:51 +07:00
|
|
|
if(!project.hasProperty("versionType")) versionType = 'official'
|
2018-02-09 11:41:07 +07:00
|
|
|
appName = 'Mindustry'
|
2019-07-22 23:42:42 +07:00
|
|
|
gdxVersion = '1.9.10'
|
2019-11-20 07:08:41 +07:00
|
|
|
roboVMVersion = '2.3.8'
|
2019-11-07 01:59:35 +07:00
|
|
|
steamworksVersion = '891ed912791e01fe9ee6237a6497e5212b85c256'
|
2018-12-30 00:22:41 +07:00
|
|
|
arcHash = null
|
2019-04-08 20:03:18 +07:00
|
|
|
|
2019-11-20 07:08:41 +07:00
|
|
|
loadVersionProps = {
|
|
|
|
return new Properties().with{p -> p.load(file('../core/assets/version.properties').newReader()); return p }
|
|
|
|
}
|
|
|
|
|
2019-02-08 11:06:43 +07:00
|
|
|
debugged = {
|
2019-09-22 03:44:47 +07:00
|
|
|
return new File(projectDir.parent, '../Mindustry-Debug').exists() && !project.hasProperty("release") && project.hasProperty("args")
|
2019-02-08 11:06:43 +07:00
|
|
|
}
|
2018-12-30 00:22:41 +07:00
|
|
|
|
|
|
|
localArc = {
|
2019-09-14 00:05:10 +07:00
|
|
|
return !project.hasProperty("release") && new File(projectDir.parent, '../Arc').exists()
|
2018-12-30 00:22:41 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
getArcHash = {
|
2019-09-20 09:59:44 +07:00
|
|
|
return new Properties().with{ p -> p.load(file('gradle.properties').newReader()); return p }["archash"]
|
2018-12-30 00:22:41 +07:00
|
|
|
}
|
|
|
|
|
2018-12-29 23:59:43 +07:00
|
|
|
arcModule = { String name ->
|
2018-12-30 00:22:41 +07:00
|
|
|
if(localArc()){
|
2018-12-29 23:59:43 +07:00
|
|
|
return project(":Arc:$name")
|
|
|
|
}else{
|
2018-12-30 00:22:41 +07:00
|
|
|
//skip to last submodule
|
2018-12-29 23:59:43 +07:00
|
|
|
if(name.contains(':')) name = name.split(':').last()
|
2018-12-30 00:22:41 +07:00
|
|
|
return "com.github.Anuken.Arc:$name:${getArcHash()}"
|
2018-12-29 23:59:43 +07:00
|
|
|
}
|
|
|
|
}
|
2018-02-09 11:41:07 +07:00
|
|
|
|
2019-08-16 22:00:15 +07:00
|
|
|
generateDeployName = { String platform ->
|
|
|
|
if(platform == "windows"){
|
|
|
|
platform += "64"
|
|
|
|
}
|
|
|
|
platform = platform.capitalize()
|
|
|
|
|
|
|
|
if(platform.endsWith("64") || platform.endsWith("32")){
|
|
|
|
platform = "${platform.substring(0, platform.length() - 2)}-${platform.substring(platform.length() - 2)}bit"
|
|
|
|
}
|
|
|
|
|
2019-08-16 22:14:18 +07:00
|
|
|
return "[${platform}]${getModifierString()}[${getNeatVersionString()}]${appName}"
|
2019-08-16 22:00:15 +07:00
|
|
|
}
|
|
|
|
|
2018-02-09 11:41:07 +07:00
|
|
|
getVersionString = {
|
|
|
|
String buildVersion = getBuildVersion()
|
2018-10-17 11:36:43 +07:00
|
|
|
return "$versionNumber-$versionModifier-$buildVersion"
|
2018-02-09 11:41:07 +07:00
|
|
|
}
|
|
|
|
|
2019-08-16 22:00:15 +07:00
|
|
|
getNeatVersionString = {
|
|
|
|
String buildVersion = getBuildVersion()
|
|
|
|
return "v$buildVersion"
|
|
|
|
}
|
|
|
|
|
|
|
|
getModifierString = {
|
|
|
|
if(versionModifier != "release"){
|
|
|
|
return "[${versionModifier.toUpperCase()}]"
|
|
|
|
}
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
2018-02-09 11:41:07 +07:00
|
|
|
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-04 00:04:30 +07:00
|
|
|
|
2018-07-21 11:44:13 +07:00
|
|
|
generateLocales = {
|
2018-09-10 03:19:53 +07:00
|
|
|
def output = 'en\n'
|
2018-08-25 00:54:53 +07:00
|
|
|
def bundles = new File(project(':core').projectDir, 'assets/bundles/')
|
2018-12-14 06:01:51 +07:00
|
|
|
bundles.listFiles().each{ other ->
|
2018-10-06 22:56:39 +07:00
|
|
|
if(other.name == "bundle.properties") return
|
2018-09-10 03:19:53 +07:00
|
|
|
output += other.name.substring("bundle".length() + 1, other.name.lastIndexOf('.')) + "\n"
|
2018-07-21 11:44:13 +07:00
|
|
|
}
|
2018-10-06 22:56:39 +07:00
|
|
|
new File(project(':core').projectDir, 'assets/locales').text = output
|
2018-07-21 11:44:13 +07:00
|
|
|
}
|
|
|
|
|
2018-05-04 00:04:30 +07:00
|
|
|
writeVersion = {
|
2018-08-25 00:54:53 +07:00
|
|
|
def pfile = new File(project(':core').projectDir, 'assets/version.properties')
|
2018-05-04 00:04:30 +07:00
|
|
|
def props = new Properties()
|
|
|
|
|
|
|
|
try{
|
|
|
|
pfile.createNewFile()
|
2019-04-08 20:03:18 +07:00
|
|
|
}catch(Exception ignored){
|
|
|
|
}
|
2018-05-04 00:04:30 +07:00
|
|
|
|
2018-12-14 06:01:51 +07:00
|
|
|
if(pfile.exists()){
|
2018-05-04 00:04:30 +07:00
|
|
|
props.load(new FileInputStream(pfile))
|
|
|
|
|
2018-09-04 23:10:48 +07:00
|
|
|
String buildid = getBuildVersion()
|
2019-08-26 09:02:00 +07:00
|
|
|
println("Compiling with build: '$buildid'")
|
2018-05-04 00:04:30 +07:00
|
|
|
|
2018-09-04 23:10:48 +07:00
|
|
|
props["type"] = versionType
|
|
|
|
props["number"] = versionNumber
|
|
|
|
props["modifier"] = versionModifier
|
|
|
|
props["build"] = buildid
|
2018-05-04 00:04:30 +07:00
|
|
|
|
|
|
|
props.store(pfile.newWriter(), "Autogenerated file. Do not modify.")
|
|
|
|
}
|
|
|
|
}
|
2017-04-30 08:25:59 +07:00
|
|
|
}
|
|
|
|
|
2018-12-14 06:01:51 +07:00
|
|
|
repositories{
|
2017-04-30 08:25:59 +07:00
|
|
|
mavenLocal()
|
|
|
|
mavenCentral()
|
2018-12-14 06:01:51 +07:00
|
|
|
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-14 01:57:26 +07:00
|
|
|
jcenter()
|
2017-04-30 08:25:59 +07:00
|
|
|
}
|
2019-06-13 01:03:50 +07:00
|
|
|
|
|
|
|
tasks.withType(Javadoc).all{ enabled = false }
|
2017-04-30 08:25:59 +07:00
|
|
|
}
|
|
|
|
|
2018-12-14 06:01:51 +07:00
|
|
|
project(":desktop"){
|
2017-04-30 08:25:59 +07:00
|
|
|
apply plugin: "java"
|
|
|
|
|
2019-07-25 22:45:49 +07:00
|
|
|
dependencies{
|
|
|
|
compile project(":core")
|
|
|
|
|
|
|
|
if(debugged()) compile project(":debug")
|
|
|
|
|
|
|
|
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
|
|
|
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
|
|
|
|
2019-10-31 03:29:01 +07:00
|
|
|
compile "com.github.Anuken:steamworks4j:$steamworksVersion"
|
2019-08-19 02:26:06 +07:00
|
|
|
|
2019-07-25 22:45:49 +07:00
|
|
|
compile arcModule("backends:backend-sdl")
|
2019-10-12 11:54:48 +07:00
|
|
|
compile 'com.github.MinnDevelopment:java-discord-rpc:v2.0.1'
|
2019-07-25 22:45:49 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-14 06:01:51 +07:00
|
|
|
project(":ios"){
|
2018-04-28 03:01:37 +07:00
|
|
|
apply plugin: "java"
|
|
|
|
apply plugin: "robovm"
|
|
|
|
|
2018-11-21 07:28:26 +07:00
|
|
|
task incrementConfig{
|
|
|
|
def vfile = file('robovm.properties')
|
|
|
|
def props = new Properties()
|
2018-11-21 23:00:50 +07:00
|
|
|
if(vfile.exists()){
|
|
|
|
props.load(new FileInputStream(vfile))
|
2019-10-21 04:08:54 +07:00
|
|
|
}else{
|
|
|
|
props['app.id'] = 'io.anuke.mindustry'
|
2019-10-25 05:52:42 +07:00
|
|
|
props['app.version'] = '5.0'
|
2019-12-26 00:06:19 +07:00
|
|
|
props['app.mainclass'] = 'mindustry.IOSLauncher'
|
2019-10-21 04:08:54 +07:00
|
|
|
props['app.executable'] = 'IOSLauncher'
|
|
|
|
props['app.name'] = 'Mindustry'
|
2018-11-21 23:00:50 +07:00
|
|
|
}
|
2019-10-21 04:08:54 +07:00
|
|
|
|
2018-12-14 06:01:51 +07:00
|
|
|
props['app.build'] = (!props.containsKey("app.build") ? 40 : props['app.build'].toInteger() + 1) + ""
|
2018-11-21 07:28:26 +07:00
|
|
|
props.store(vfile.newWriter(), null)
|
|
|
|
}
|
|
|
|
|
2018-12-14 06:01:51 +07:00
|
|
|
dependencies{
|
2018-04-28 03:01:37 +07:00
|
|
|
compile project(":core")
|
2019-03-24 05:33:33 +07:00
|
|
|
compileOnly project(":annotations")
|
2019-04-08 20:03:18 +07:00
|
|
|
|
2018-12-29 23:59:43 +07:00
|
|
|
compile arcModule("backends:backend-robovm")
|
2019-04-08 20:03:18 +07:00
|
|
|
|
2018-04-28 03:01:37 +07: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-07 00:55:13 +07:00
|
|
|
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios"
|
2018-04-28 03:01:37 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-14 06:01:51 +07:00
|
|
|
project(":core"){
|
2017-04-30 08:25:59 +07:00
|
|
|
apply plugin: "java"
|
|
|
|
|
2019-06-23 21:52:03 +07:00
|
|
|
task preGen{
|
2019-10-21 04:05:23 +07:00
|
|
|
outputs.upToDateWhen{ false }
|
2018-07-21 11:44:13 +07:00
|
|
|
generateLocales()
|
2019-08-26 09:02:00 +07:00
|
|
|
writeVersion()
|
2018-07-21 11:44:13 +07:00
|
|
|
}
|
|
|
|
|
2019-11-20 07:08:41 +07:00
|
|
|
task copyChangelog{
|
|
|
|
doLast{
|
|
|
|
def props = loadVersionProps()
|
|
|
|
def androidVersion = props['androidBuildCode'].toInteger() - 2
|
|
|
|
def buildVersion = props["build"]
|
|
|
|
def loglines = file("../changelog").text.split("\n")
|
|
|
|
def maxLength = 460
|
|
|
|
|
|
|
|
def androidLogList = loglines.findAll{ line -> !line.endsWith("]") || line.endsWith("[Mobile]") || line.endsWith("[Android]")}
|
|
|
|
def result = ""
|
|
|
|
androidLogList.forEach({line ->
|
|
|
|
if(result.length() + line.length() + 1 < maxLength){
|
|
|
|
result += line + "\n"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
def changelogs = file("../fastlane/metadata/android/en-US/changelogs/")
|
|
|
|
new File(changelogs, buildVersion + ".txt").text = (result)
|
|
|
|
new File(changelogs, androidVersion + ".txt").text = (result)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-14 06:01:51 +07:00
|
|
|
dependencies{
|
2019-09-22 02:35:59 +07:00
|
|
|
if(System.properties["user.name"] == "anuke"){
|
2019-05-05 22:36:38 +07:00
|
|
|
task cleanGen{
|
|
|
|
doFirst{
|
|
|
|
delete{
|
2019-12-25 23:16:54 +07:00
|
|
|
delete "../core/src/mindustry/gen/"
|
2019-05-05 22:36:38 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task copyGen{
|
|
|
|
doLast{
|
|
|
|
copy{
|
2019-12-25 23:16:54 +07:00
|
|
|
from("../core/build/generated/sources/annotationProcessor/java/main/mindustry/gen"){
|
2019-05-05 22:36:38 +07:00
|
|
|
include "**/*.java"
|
|
|
|
}
|
|
|
|
|
2019-12-25 23:16:54 +07:00
|
|
|
into "../core/src/mindustry/gen"
|
2019-05-05 22:36:38 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
compileJava.dependsOn(cleanGen)
|
|
|
|
compileJava.finalizedBy(copyGen)
|
|
|
|
}
|
2019-06-23 22:03:05 +07:00
|
|
|
|
2019-06-23 21:52:03 +07:00
|
|
|
compileJava.dependsOn(preGen)
|
2019-05-05 22:36:38 +07:00
|
|
|
|
2019-08-23 09:49:22 +07:00
|
|
|
compile "org.lz4:lz4-java:1.4.1"
|
2018-12-29 23:59:43 +07:00
|
|
|
compile arcModule("arc-core")
|
|
|
|
compile arcModule("extensions:freetype")
|
2019-04-18 08:59:26 +07:00
|
|
|
compile arcModule("extensions:arcnet")
|
2019-12-03 13:01:18 +07:00
|
|
|
compile "org.mozilla:rhino:1.7.11"
|
2019-02-08 11:06:43 +07:00
|
|
|
if(localArc() && debugged()) compile arcModule("extensions:recorder")
|
2018-05-12 21:30:23 +07:00
|
|
|
|
2018-10-29 05:34:18 +07:00
|
|
|
compileOnly project(":annotations")
|
2018-10-29 01:26:58 +07:00
|
|
|
annotationProcessor project(":annotations")
|
2017-04-30 08:25:59 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-14 06:01:51 +07:00
|
|
|
project(":server"){
|
2018-01-28 11:42:42 +07:00
|
|
|
apply plugin: "java"
|
|
|
|
|
2018-12-14 06:01:51 +07:00
|
|
|
dependencies{
|
2018-01-28 11:42:42 +07:00
|
|
|
compile project(":core")
|
2018-12-29 23:59:43 +07:00
|
|
|
compile arcModule("backends:backend-headless")
|
2018-01-28 11:42:42 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-04 07:58:35 +07:00
|
|
|
project(":tests"){
|
|
|
|
apply plugin: "java"
|
|
|
|
|
2018-12-14 06:01:51 +07:00
|
|
|
dependencies{
|
2018-10-04 07:58:35 +07:00
|
|
|
testImplementation project(":core")
|
2018-11-23 05:30:49 +07:00
|
|
|
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 23:59:43 +07:00
|
|
|
compile arcModule("backends:backend-headless")
|
2018-10-04 07:58:35 +07:00
|
|
|
}
|
|
|
|
|
2018-12-14 06:01:51 +07:00
|
|
|
test{
|
2018-10-04 07:58:35 +07:00
|
|
|
useJUnitPlatform()
|
|
|
|
workingDir = new File("../core/assets")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-14 06:01:51 +07:00
|
|
|
project(":tools"){
|
2018-06-16 05:06:05 +07:00
|
|
|
apply plugin: "java"
|
|
|
|
|
2018-12-14 06:01:51 +07:00
|
|
|
dependencies{
|
2018-06-16 05:06:05 +07:00
|
|
|
compile project(":core")
|
2019-06-21 03:27:57 +07:00
|
|
|
|
|
|
|
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
|
|
|
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
2019-11-28 01:51:07 +07:00
|
|
|
compile "org.reflections:reflections:0.9.11"
|
2019-06-21 03:27:57 +07:00
|
|
|
|
2019-07-27 08:24:07 +07:00
|
|
|
compile arcModule("backends:backend-sdl")
|
2018-06-16 05:06:05 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-14 06:01:51 +07:00
|
|
|
project(":annotations"){
|
2018-05-12 21:30:23 +07:00
|
|
|
apply plugin: "java"
|
|
|
|
|
2018-12-14 06:01:51 +07:00
|
|
|
dependencies{
|
2020-01-23 00:24:00 +07:00
|
|
|
def arcVersion = "e287fdce0449a87fb15599c67b5167ac0273bcb6"
|
|
|
|
|
2018-05-14 06:41:50 +07:00
|
|
|
compile 'com.squareup:javapoet:1.11.0'
|
2020-01-23 00:24:00 +07:00
|
|
|
compile "com.github.Anuken.Arc:arc-core:$arcVersion"
|
2019-05-05 22:36:38 +07:00
|
|
|
compile files("${System.getProperty('java.home')}/../lib/tools.jar")
|
2018-05-14 06:41:50 +07:00
|
|
|
}
|
2018-05-12 21:30:23 +07:00
|
|
|
}
|
|
|
|
|
2019-08-22 01:46:36 +07:00
|
|
|
task deployAll{
|
|
|
|
task cleanDeployOutput{
|
|
|
|
doFirst{
|
2019-08-22 02:34:01 +07:00
|
|
|
if("${getBuildVersion()}" == "custom build" || "${getBuildVersion()}" == "") throw new IllegalArgumentException("----\n\nSET A BUILD NUMBER FIRST!\n\n----")
|
2019-08-22 01:46:36 +07:00
|
|
|
if(!project.hasProperty("release")) throw new IllegalArgumentException("----\n\nSET THE RELEASE PROJECT PROPERTY FIRST!\n\n----")
|
|
|
|
|
|
|
|
delete{
|
|
|
|
delete "deploy/"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependsOn cleanDeployOutput
|
2019-08-22 02:41:38 +07:00
|
|
|
dependsOn "desktop:packrLinux64"
|
|
|
|
dependsOn "desktop:packrWindows64"
|
|
|
|
dependsOn "desktop:packrWindows32"
|
|
|
|
dependsOn "desktop:packrMacOS"
|
2019-08-22 01:46:36 +07:00
|
|
|
dependsOn "server:deploy"
|
|
|
|
dependsOn "android:deploy"
|
2019-09-02 23:40:52 +07:00
|
|
|
}
|