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

238 lines
6.5 KiB
Groovy

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.0'
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
classpath 'com.android.tools.build:gradle:3.1.3'
classpath "com.badlogicgames.gdx:gdx-tools:1.9.8"
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = 'release'
ext {
versionNumber = '4.0'
versionType = 'alpha'
appName = 'Mindustry'
gdxVersion = '1.9.8'
roboVMVersion = '2.3.0'
uCoreVersion = 'b75be1b8a4758e3f80f46d3bb598e82fcdd8c679'
getVersionString = {
String buildVersion = getBuildVersion()
return "$versionNumber-$versionType-$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",'
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('.')) + '",'
}
output = (output.substring(0, output.size() - 1) + "]")
new File(project(':core').projectDir, 'assets/locales.json').text = output;
}
writeVersion = {
def pfile = new File(project(':core').projectDir, 'assets/version.properties')
def props = new Properties()
try{
pfile.createNewFile()
}catch (Exception e){}
if(pfile.exists()) {
props.load(new FileInputStream(pfile))
String code = getBuildVersion()
props["name"] = appName
props["version"] = versionType
props["code"] = versionNumber
props["build"] = code
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")
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.github.MinnDevelopment:java-discord-rpc:v2.0.0'
}
}
project(":html") {
apply plugin: "gwt"
apply plugin: "war"
dependencies {
compile project(":core")
compileOnly project(":annotations")
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion:sources"
compile "com.badlogicgames.gdx:gdx-controllers-gwt:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-controllers-gwt:$gdxVersion:sources"
}
compileJava.options.compilerArgs = [
"-processor", "io.anuke.annotations.RemoteMethodAnnotationProcessor"
]
}
project(":ios") {
apply plugin: "java"
apply plugin: "robovm"
task copyGen{
copy{
from ("core/build/classes/java/main/io/anuke/mindustry/gen/"){
include "**/*.java"
}
into "ios/src/io/anuke/mindustry/gen"
}
doFirst{
delete{
delete "ios/src/io/anuke/mindustry/gen/"
}
}
}
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"
}
}
project(":core") {
apply plugin: "java"
task finish {
generateLocales()
}
dependencies {
compileOnly project(":annotations")
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, '../uCore').exists() && comp){
compile project(":uCore")
}else{
compile "com.github.anuken:ucore:$uCoreVersion"
}
if(new File(projectDir.parent, '../GDXGifRecorder').exists() && comp) {
compile project(":GDXGifRecorder")
}
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
}
compileJava.options.compilerArgs = [
"-processor", "io.anuke.annotations.RemoteMethodAnnotationProcessor"
]
}
project(":server") {
apply plugin: "java"
configurations {
if(findProject(":android") != null){
compile.exclude module: android
}
}
dependencies {
compileOnly project(":annotations")
compile project(":core")
compile project(":kryonet")
compile "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
}
}
project(":packer") {
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 'com.github.crykn:kryonet:2.22.1'
}
}
tasks.eclipse.doLast {
delete ".project"
}