Gradle Kotlin DSL (#2634)
* Ease migration to Gradle Kotlin DSL by changing quotes, function calls and plugin definitions * Migrate build scripts to Gradle Kotlin DSL
This commit is contained in:
parent
c9e63b3e00
commit
47d7e8ef09
17 changed files with 587 additions and 527 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -68,6 +68,7 @@ com_crashlytics_export_strings.xml
|
||||||
/html/build/
|
/html/build/
|
||||||
/ios/build/
|
/ios/build/
|
||||||
/ios-moe/build/
|
/ios-moe/build/
|
||||||
|
/buildSrc/build
|
||||||
|
|
||||||
/nbbuild/
|
/nbbuild/
|
||||||
/android/nbbuild/
|
/android/nbbuild/
|
||||||
|
|
|
@ -1,186 +0,0 @@
|
||||||
android {
|
|
||||||
buildToolsVersion "29.0.2"
|
|
||||||
compileSdkVersion 29
|
|
||||||
sourceSets {
|
|
||||||
main {
|
|
||||||
manifest.srcFile 'AndroidManifest.xml'
|
|
||||||
java.srcDirs = ['src']
|
|
||||||
aidl.srcDirs = ['src']
|
|
||||||
renderscript.srcDirs = ['src']
|
|
||||||
res.srcDirs = ['res']
|
|
||||||
assets.srcDirs = ['assets']
|
|
||||||
jniLibs.srcDirs = ['libs']
|
|
||||||
}
|
|
||||||
|
|
||||||
androidTest.setRoot('tests')
|
|
||||||
}
|
|
||||||
packagingOptions {
|
|
||||||
exclude 'META-INF/robovm/ios/robovm.xml'
|
|
||||||
}
|
|
||||||
defaultConfig {
|
|
||||||
applicationId "com.unciv.app"
|
|
||||||
minSdkVersion 14
|
|
||||||
targetSdkVersion 29
|
|
||||||
versionCode appCodeNumber
|
|
||||||
versionName appVersion
|
|
||||||
|
|
||||||
archivesBaseName = "Unciv"
|
|
||||||
}
|
|
||||||
|
|
||||||
// necessary for Android Work lib
|
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Had to add this crap for Travis to build, it wanted to sign the app
|
|
||||||
// but couldn't create the debug keystore for some reason
|
|
||||||
|
|
||||||
signingConfigs {
|
|
||||||
debug {
|
|
||||||
storeFile rootProject.file('debug.keystore')
|
|
||||||
keyAlias 'androiddebugkey'
|
|
||||||
keyPassword 'android'
|
|
||||||
storePassword 'android'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
// Don't add local save files and fonts to release, obviously
|
|
||||||
aaptOptions {
|
|
||||||
ignoreAssetsPattern "!SaveFiles:!fonts:!maps:!music:!mods"
|
|
||||||
}
|
|
||||||
|
|
||||||
minifyEnabled false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
|
|
||||||
debug {
|
|
||||||
// Don't add local save files and fonts to release, obviously
|
|
||||||
aaptOptions {
|
|
||||||
ignoreAssetsPattern "!SaveFiles:!fonts:!maps:!music"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lintOptions {
|
|
||||||
disable 'MissingTranslation'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// called every time gradle gets executed, takes the native dependencies of
|
|
||||||
// the natives configuration, and extracts them to the proper libs/ folders
|
|
||||||
// so they get packed with the APK.
|
|
||||||
task copyAndroidNatives() {
|
|
||||||
doFirst {
|
|
||||||
file("libs/armeabi/").mkdirs()
|
|
||||||
file("libs/armeabi-v7a/").mkdirs()
|
|
||||||
file("libs/arm64-v8a/").mkdirs()
|
|
||||||
file("libs/x86_64/").mkdirs()
|
|
||||||
file("libs/x86/").mkdirs()
|
|
||||||
configurations.natives.files.each { jar ->
|
|
||||||
def outputDir = null
|
|
||||||
if(jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a")
|
|
||||||
if(jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a")
|
|
||||||
if(jar.name.endsWith("natives-armeabi.jar")) outputDir = file("libs/armeabi")
|
|
||||||
if(jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64")
|
|
||||||
if(jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86")
|
|
||||||
if(outputDir != null) {
|
|
||||||
copy {
|
|
||||||
from zipTree(jar)
|
|
||||||
into outputDir
|
|
||||||
include "*.so"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.whenTaskAdded { packageTask ->
|
|
||||||
if (packageTask.name.contains("package")) {
|
|
||||||
packageTask.dependsOn 'copyAndroidNatives'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task run(type: Exec) {
|
|
||||||
def path
|
|
||||||
def localProperties = project.file("../local.properties")
|
|
||||||
if (localProperties.exists()) {
|
|
||||||
Properties properties = new Properties()
|
|
||||||
localProperties.withInputStream { instr ->
|
|
||||||
properties.load(instr)
|
|
||||||
}
|
|
||||||
def sdkDir = properties.getProperty('sdk.dir')
|
|
||||||
if (sdkDir) {
|
|
||||||
path = sdkDir
|
|
||||||
} else {
|
|
||||||
path = "$System.env.ANDROID_HOME"
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
path = "$System.env.ANDROID_HOME"
|
|
||||||
}
|
|
||||||
|
|
||||||
def adb = path + "/platform-tools/adb"
|
|
||||||
commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.unciv.app/AndroidLauncher'
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation 'androidx.core:core:1.2.0'
|
|
||||||
implementation "androidx.work:work-runtime-ktx:2.3.2"
|
|
||||||
}
|
|
||||||
|
|
||||||
// sets up the Android Eclipse project, using the old Ant based build.
|
|
||||||
eclipse {
|
|
||||||
// need to specify Java source sets explicitly, SpringSource Gradle Eclipse plugin
|
|
||||||
// ignores any nodes added in classpath.file.withXml
|
|
||||||
sourceSets {
|
|
||||||
main {
|
|
||||||
java.srcDirs "src", 'gen'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
jdt {
|
|
||||||
sourceCompatibility = 1.6
|
|
||||||
targetCompatibility = 1.6
|
|
||||||
}
|
|
||||||
|
|
||||||
classpath {
|
|
||||||
plusConfigurations += [ project.configurations.compile ]
|
|
||||||
containers 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK', 'com.android.ide.eclipse.adt.LIBRARIES'
|
|
||||||
}
|
|
||||||
|
|
||||||
project {
|
|
||||||
name = appName + "-android"
|
|
||||||
natures 'com.android.ide.eclipse.adt.AndroidNature'
|
|
||||||
buildCommands.clear()
|
|
||||||
buildCommand "com.android.ide.eclipse.adt.ResourceManagerBuilder"
|
|
||||||
buildCommand "com.android.ide.eclipse.adt.PreCompilerBuilder"
|
|
||||||
buildCommand "org.eclipse.jdt.core.javabuilder"
|
|
||||||
buildCommand "com.android.ide.eclipse.adt.ApkBuilder"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// sets up the Android Idea project, using the old Ant based build.
|
|
||||||
idea {
|
|
||||||
module {
|
|
||||||
sourceDirs += file("src")
|
|
||||||
scopes = [ COMPILE: [plus:[project.configurations.compile]]]
|
|
||||||
|
|
||||||
iml {
|
|
||||||
withXml {
|
|
||||||
def node = it.asNode()
|
|
||||||
def builder = NodeBuilder.newInstance()
|
|
||||||
builder.current = node
|
|
||||||
builder.component(name: "FacetManager") {
|
|
||||||
facet(type: "android", name: "Android") {
|
|
||||||
configuration {
|
|
||||||
option(name: "UPDATE_PROPERTY_FILES", value:"true")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
162
android/build.gradle.kts
Normal file
162
android/build.gradle.kts
Normal file
|
@ -0,0 +1,162 @@
|
||||||
|
import com.unciv.build.BuildConfig
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("com.android.application")
|
||||||
|
id("kotlin-android")
|
||||||
|
id("kotlin-android-extensions")
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
buildToolsVersion("29.0.2")
|
||||||
|
compileSdkVersion(29)
|
||||||
|
sourceSets {
|
||||||
|
getByName("main").apply {
|
||||||
|
manifest.srcFile("AndroidManifest.xml")
|
||||||
|
java.srcDirs("src")
|
||||||
|
aidl.srcDirs("src")
|
||||||
|
renderscript.srcDirs("src")
|
||||||
|
res.srcDirs("res")
|
||||||
|
assets.srcDirs("assets")
|
||||||
|
jniLibs.srcDirs("libs")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
packagingOptions {
|
||||||
|
exclude("META-INF/robovm/ios/robovm.xml")
|
||||||
|
}
|
||||||
|
defaultConfig {
|
||||||
|
applicationId = "com.unciv.app"
|
||||||
|
minSdkVersion(14)
|
||||||
|
targetSdkVersion(29)
|
||||||
|
versionCode = BuildConfig.appCodeNumber
|
||||||
|
versionName = BuildConfig.appVersion
|
||||||
|
|
||||||
|
base.archivesBaseName = "Unciv"
|
||||||
|
}
|
||||||
|
|
||||||
|
// necessary for Android Work lib
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Had to add this crap for Travis to build, it wanted to sign the app
|
||||||
|
// but couldn't create the debug keystore for some reason
|
||||||
|
|
||||||
|
signingConfigs {
|
||||||
|
getByName("debug") {
|
||||||
|
storeFile = rootProject.file("debug.keystore")
|
||||||
|
keyAlias = "androiddebugkey"
|
||||||
|
keyPassword = "android"
|
||||||
|
storePassword = "android"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
getByName("release") {
|
||||||
|
// Don't add local save files and fonts to release, obviously
|
||||||
|
aaptOptions {
|
||||||
|
ignoreAssetsPattern = "!SaveFiles:!fonts:!maps:!music:!mods"
|
||||||
|
}
|
||||||
|
|
||||||
|
isMinifyEnabled = false
|
||||||
|
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
|
||||||
|
}
|
||||||
|
|
||||||
|
getByName("debug") {
|
||||||
|
// Don't add local save files and fonts to release, obviously
|
||||||
|
aaptOptions {
|
||||||
|
ignoreAssetsPattern = "!SaveFiles:!fonts:!maps:!music"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lintOptions {
|
||||||
|
disable("MissingTranslation")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// called every time gradle gets executed, takes the native dependencies of
|
||||||
|
// the natives configuration, and extracts them to the proper libs/ folders
|
||||||
|
// so they get packed with the APK.
|
||||||
|
task("copyAndroidNatives") {
|
||||||
|
val natives: Configuration by configurations
|
||||||
|
|
||||||
|
doFirst {
|
||||||
|
file("libs/armeabi/").mkdirs()
|
||||||
|
file("libs/armeabi-v7a/").mkdirs()
|
||||||
|
file("libs/arm64-v8a/").mkdirs()
|
||||||
|
file("libs/x86_64/").mkdirs()
|
||||||
|
file("libs/x86/").mkdirs()
|
||||||
|
natives.forEach { jar ->
|
||||||
|
val outputDir: File? = when {
|
||||||
|
jar.name.endsWith("natives-arm64-v8a.jar") -> file("libs/arm64-v8a")
|
||||||
|
jar.name.endsWith("natives-armeabi-v7a.jar") -> file("libs/armeabi-v7a")
|
||||||
|
jar.name.endsWith("natives-armeabi.jar") -> file("libs/armeabi")
|
||||||
|
jar.name.endsWith("natives-x86_64.jar") -> file("libs/x86_64")
|
||||||
|
jar.name.endsWith("natives-x86.jar") -> file("libs/x86")
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
outputDir?.let {
|
||||||
|
copy {
|
||||||
|
from(zipTree(jar))
|
||||||
|
into(outputDir)
|
||||||
|
include("*.so")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.whenTaskAdded {
|
||||||
|
if ("package" in name) {
|
||||||
|
dependsOn("copyAndroidNatives")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register<JavaExec>("run") {
|
||||||
|
val localProperties = project.file("../local.properties")
|
||||||
|
val path = if (localProperties.exists()) {
|
||||||
|
val properties = Properties()
|
||||||
|
localProperties.inputStream().use { properties.load(it) }
|
||||||
|
|
||||||
|
properties.getProperty("sdk.dir") ?: System.getenv("ANDROID_HOME")
|
||||||
|
} else {
|
||||||
|
System.getenv("ANDROID_HOME")
|
||||||
|
}
|
||||||
|
|
||||||
|
val adb = "$path/platform-tools/adb"
|
||||||
|
|
||||||
|
doFirst {
|
||||||
|
project.exec {
|
||||||
|
commandLine(adb, "shell", "am", "start", "-n", "com.unciv.app/AndroidLauncher")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation("androidx.core:core:1.2.0")
|
||||||
|
implementation("androidx.work:work-runtime-ktx:2.3.2")
|
||||||
|
}
|
||||||
|
|
||||||
|
// sets up the Android Eclipse project, using the old Ant based build.
|
||||||
|
eclipse {
|
||||||
|
jdt {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_6
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_6
|
||||||
|
}
|
||||||
|
|
||||||
|
classpath {
|
||||||
|
plusConfigurations = plusConfigurations.apply { add(project.configurations.compile.get()) }
|
||||||
|
containers("com.android.ide.eclipse.adt.ANDROID_FRAMEWORK", "com.android.ide.eclipse.adt.LIBRARIES")
|
||||||
|
}
|
||||||
|
|
||||||
|
project {
|
||||||
|
name = "${BuildConfig.appName}-android"
|
||||||
|
natures("com.android.ide.eclipse.adt.AndroidNature")
|
||||||
|
buildCommands.clear()
|
||||||
|
buildCommand("com.android.ide.eclipse.adt.ResourceManagerBuilder")
|
||||||
|
buildCommand("com.android.ide.eclipse.adt.PreCompilerBuilder")
|
||||||
|
buildCommand("org.eclipse.jdt.core.javabuilder")
|
||||||
|
buildCommand("com.android.ide.eclipse.adt.ApkBuilder")
|
||||||
|
}
|
||||||
|
}
|
164
build.gradle
164
build.gradle
|
@ -1,164 +0,0 @@
|
||||||
buildscript {
|
|
||||||
|
|
||||||
ext.kotlinVersion = '1.3.71'
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
// Chinese mirrors for quicker loading for chinese devs - uncomment if you're chinese
|
|
||||||
// maven{ url 'https://maven.aliyun.com/repository/jcenter'}
|
|
||||||
// maven{ url 'https://maven.aliyun.com/repository/google'}
|
|
||||||
// maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'}
|
|
||||||
// maven{ url 'https://maven.aliyun.com/repository/public'}
|
|
||||||
google()
|
|
||||||
mavenLocal()
|
|
||||||
mavenCentral()
|
|
||||||
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
|
||||||
jcenter()
|
|
||||||
maven{ url 'https://jitpack.io' } // for the anuken packr
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
|
||||||
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
|
|
||||||
classpath 'com.android.tools.build:gradle:3.6.3'
|
|
||||||
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.1'
|
|
||||||
|
|
||||||
// This is for wrapping the .jar file into a standalone executable
|
|
||||||
classpath "com.github.anuken:packr:-SNAPSHOT"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
allprojects {
|
|
||||||
apply plugin: "eclipse"
|
|
||||||
apply plugin: "idea"
|
|
||||||
|
|
||||||
version = '1.0.1'
|
|
||||||
ext {
|
|
||||||
appName = "Unciv"
|
|
||||||
appCodeNumber = 428
|
|
||||||
appVersion = "3.8.9"
|
|
||||||
|
|
||||||
gdxVersion = '1.9.10'
|
|
||||||
roboVMVersion = '2.3.1'
|
|
||||||
ashleyVersion = '1.7.0'
|
|
||||||
aiVersion = '1.8.0'
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
// Chinese mirrors for quicker loading for chinese devs - uncomment if you're chinese
|
|
||||||
// maven{ url 'https://maven.aliyun.com/repository/jcenter'}
|
|
||||||
// maven{ url 'https://maven.aliyun.com/repository/google'}
|
|
||||||
// maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'}
|
|
||||||
// maven{ url 'https://maven.aliyun.com/repository/public'}
|
|
||||||
google()
|
|
||||||
jcenter()
|
|
||||||
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' } // for java-discord-rpc
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
project(":desktop") {
|
|
||||||
apply plugin: "kotlin"
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation project(":core")
|
|
||||||
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
|
|
||||||
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
|
||||||
|
|
||||||
implementation "com.badlogicgames.gdx:gdx-tools:$gdxVersion" // This is for the TexturePacker class
|
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" // This iss so the JAR works with Kotlin
|
|
||||||
|
|
||||||
implementation 'com.github.MinnDevelopment:java-discord-rpc:v2.0.1'
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
project(":android") {
|
|
||||||
apply plugin: "android"
|
|
||||||
apply plugin: "kotlin-android"
|
|
||||||
apply plugin: "kotlin-android-extensions"
|
|
||||||
|
|
||||||
configurations { natives }
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation project(":core")
|
|
||||||
implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
|
|
||||||
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
|
|
||||||
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
|
|
||||||
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
|
|
||||||
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
|
|
||||||
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
project(":ios") {
|
|
||||||
apply plugin: "kotlin"
|
|
||||||
apply plugin: "robovm"
|
|
||||||
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation project(":core")
|
|
||||||
implementation "com.mobidevelop.robovm:robovm-rt:$roboVMVersion"
|
|
||||||
implementation "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion"
|
|
||||||
implementation "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
|
|
||||||
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
project(":core") {
|
|
||||||
apply plugin: "kotlin"
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation "com.badlogicgames.gdx:gdx:$gdxVersion"
|
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Taken from https://github.com/TomGrill/gdx-testing
|
|
||||||
project(":tests") {
|
|
||||||
apply plugin: "java"
|
|
||||||
apply plugin: "kotlin"
|
|
||||||
|
|
||||||
test{
|
|
||||||
workingDir= file("../android/assets")
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets.test.java.srcDirs = ["src/"]
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If you do have some classes to test in os specific code you may want to uncomment
|
|
||||||
* some of these lines.
|
|
||||||
*
|
|
||||||
* BUT: I recommend to create seperate test sub projects for each platform. Trust me :)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
implementation project(":core")
|
|
||||||
|
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
|
|
||||||
|
|
||||||
implementation "junit:junit:4.12"
|
|
||||||
implementation "org.mockito:mockito-all:1.9.5"
|
|
||||||
|
|
||||||
implementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
|
|
||||||
implementation "com.badlogicgames.gdx:gdx:$gdxVersion"
|
|
||||||
|
|
||||||
testImplementation 'junit:junit:4.12'
|
|
||||||
testImplementation "org.mockito:mockito-all:1.9.5"
|
|
||||||
testImplementation "io.mockk:mockk:1.9.3"
|
|
||||||
|
|
||||||
testImplementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
|
|
||||||
testImplementation "com.badlogicgames.gdx:gdx:$gdxVersion"
|
|
||||||
testImplementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
|
|
||||||
tasks.eclipse.doLast {
|
|
||||||
delete ".project"
|
|
||||||
}
|
|
155
build.gradle.kts
Normal file
155
build.gradle.kts
Normal file
|
@ -0,0 +1,155 @@
|
||||||
|
import com.unciv.build.BuildConfig
|
||||||
|
import com.unciv.build.BuildConfig.gdxVersion
|
||||||
|
import com.unciv.build.BuildConfig.kotlinVersion
|
||||||
|
import com.unciv.build.BuildConfig.roboVMVersion
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
// Chinese mirrors for quicker loading for chinese devs - uncomment if you're chinese
|
||||||
|
// maven{ url "https://maven.aliyun.com/repository/jcenter"}
|
||||||
|
// maven{ url "https://maven.aliyun.com/repository/google"}
|
||||||
|
// maven{ url "https://maven.aliyun.com/repository/gradle-plugin"}
|
||||||
|
// maven{ url "https://maven.aliyun.com/repository/public"}
|
||||||
|
google()
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
|
||||||
|
jcenter()
|
||||||
|
maven{ url = uri("https://jitpack.io") } // for the anuken packr
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${com.unciv.build.BuildConfig.kotlinVersion}")
|
||||||
|
classpath("de.richsource.gradle.plugins:gwt-gradle-plugin:0.6")
|
||||||
|
classpath("com.android.tools.build:gradle:3.6.3")
|
||||||
|
classpath("com.mobidevelop.robovm:robovm-gradle-plugin:2.3.1")
|
||||||
|
|
||||||
|
// This is for wrapping the .jar file into a standalone executable
|
||||||
|
classpath("com.github.anuken:packr:-SNAPSHOT")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
apply(plugin = "eclipse")
|
||||||
|
apply(plugin = "idea")
|
||||||
|
|
||||||
|
|
||||||
|
version = "1.0.1"
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
// Chinese mirrors for quicker loading for chinese devs - uncomment if you're chinese
|
||||||
|
// maven{ url "https://maven.aliyun.com/repository/jcenter"}
|
||||||
|
// maven{ url "https://maven.aliyun.com/repository/google"}
|
||||||
|
// maven{ url "https://maven.aliyun.com/repository/gradle-plugin"}
|
||||||
|
// maven{ url "https://maven.aliyun.com/repository/public"}
|
||||||
|
google()
|
||||||
|
jcenter()
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
|
||||||
|
maven { url = uri("https://oss.sonatype.org/content/repositories/releases/") }
|
||||||
|
maven{ url = uri("https://jitpack.io") } // for java-discord-rpc
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
project(":desktop") {
|
||||||
|
apply(plugin = "kotlin")
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
"implementation"(project(":core"))
|
||||||
|
"implementation"("com.badlogicgames.gdx:gdx-backend-lwjgl:${gdxVersion}")
|
||||||
|
"implementation"("com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop")
|
||||||
|
|
||||||
|
"implementation"("com.badlogicgames.gdx:gdx-tools:$gdxVersion") // This is for the TexturePacker class
|
||||||
|
"implementation"("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion") // This iss so the JAR works with Kotlin
|
||||||
|
|
||||||
|
"implementation"("com.github.MinnDevelopment:java-discord-rpc:v2.0.1")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
project(":android") {
|
||||||
|
apply(plugin = "com.android.application")
|
||||||
|
apply(plugin = "kotlin-android")
|
||||||
|
apply(plugin = "kotlin-android-extensions")
|
||||||
|
|
||||||
|
val natives by configurations.creating
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
"implementation"(project(":core"))
|
||||||
|
"implementation"("com.badlogicgames.gdx:gdx-backend-android:$gdxVersion")
|
||||||
|
natives("com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi")
|
||||||
|
natives("com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a")
|
||||||
|
natives("com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a")
|
||||||
|
natives("com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86")
|
||||||
|
natives("com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
project(":ios") {
|
||||||
|
apply(plugin = "kotlin")
|
||||||
|
apply(plugin = "robovm")
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
"implementation"(project(":core"))
|
||||||
|
"implementation"("com.mobidevelop.robovm:robovm-rt:$roboVMVersion")
|
||||||
|
"implementation"("com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion")
|
||||||
|
"implementation"("com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion")
|
||||||
|
"implementation"("com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
project(":core") {
|
||||||
|
apply(plugin = "kotlin")
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
"implementation"("com.badlogicgames.gdx:gdx:$gdxVersion")
|
||||||
|
"implementation"("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Taken from https://github.com/TomGrill/gdx-testing
|
||||||
|
project(":tests") {
|
||||||
|
apply(plugin = "java")
|
||||||
|
apply(plugin = "kotlin")
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If you do have some classes to test in os specific code you may want to uncomment
|
||||||
|
* some of these lines.
|
||||||
|
*
|
||||||
|
* BUT: I recommend to create seperate test sub projects for each platform. Trust me :)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
"implementation"(project(":core"))
|
||||||
|
|
||||||
|
"implementation"("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
|
||||||
|
|
||||||
|
"implementation"("junit:junit:4.12")
|
||||||
|
"implementation"("org.mockito:mockito-all:1.9.5")
|
||||||
|
|
||||||
|
"implementation"("com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion")
|
||||||
|
"implementation"("com.badlogicgames.gdx:gdx:$gdxVersion")
|
||||||
|
|
||||||
|
"testImplementation"("junit:junit:4.12")
|
||||||
|
"testImplementation"("org.mockito:mockito-all:1.9.5")
|
||||||
|
"testImplementation"("io.mockk:mockk:1.9.3")
|
||||||
|
|
||||||
|
"testImplementation"("com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion")
|
||||||
|
"testImplementation"("com.badlogicgames.gdx:gdx:$gdxVersion")
|
||||||
|
"testImplementation"("com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop")
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
"eclipse" {
|
||||||
|
doLast {
|
||||||
|
delete(".project")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
7
buildSrc/build.gradle.kts
Normal file
7
buildSrc/build.gradle.kts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
plugins {
|
||||||
|
`kotlin-dsl`
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
13
buildSrc/src/main/kotlin/BuildConfig.kt
Normal file
13
buildSrc/src/main/kotlin/BuildConfig.kt
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
package com.unciv.build
|
||||||
|
|
||||||
|
object BuildConfig {
|
||||||
|
const val kotlinVersion = "1.3.71"
|
||||||
|
const val appName = "Unciv"
|
||||||
|
const val appCodeNumber = 428
|
||||||
|
const val appVersion = "3.8.9"
|
||||||
|
|
||||||
|
const val gdxVersion = "1.9.10"
|
||||||
|
const val roboVMVersion = "2.3.1"
|
||||||
|
const val ashleyVersion = "1.7.0"
|
||||||
|
const val aiVersion = "1.8.0"
|
||||||
|
}
|
|
@ -1,10 +0,0 @@
|
||||||
apply plugin: "kotlin"
|
|
||||||
|
|
||||||
sourceCompatibility = 1.6
|
|
||||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
|
||||||
|
|
||||||
sourceSets.main.java.srcDirs = [ "src/" ]
|
|
||||||
|
|
||||||
eclipse.project {
|
|
||||||
name = appName + "-core"
|
|
||||||
}
|
|
28
core/build.gradle.kts
Normal file
28
core/build.gradle.kts
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import com.unciv.build.BuildConfig
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("kotlin")
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_6
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
compileJava {
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
}
|
||||||
|
compileTestJava {
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
java.srcDir("src/")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
eclipse.project {
|
||||||
|
name = "${BuildConfig.appName}-core"
|
||||||
|
}
|
|
@ -1,122 +0,0 @@
|
||||||
import com.badlogicgames.packr.Packr
|
|
||||||
import com.badlogicgames.packr.PackrConfig
|
|
||||||
|
|
||||||
apply plugin: "kotlin"
|
|
||||||
|
|
||||||
sourceCompatibility = 1.6
|
|
||||||
sourceSets.main.java.srcDirs = [ "src/" ]
|
|
||||||
|
|
||||||
project.ext.mainClassName = "com.unciv.app.desktop.DesktopLauncher"
|
|
||||||
project.ext.assetsDir = file("../android/assets")
|
|
||||||
project.ext.discordDir = file("discord_rpc")
|
|
||||||
def deployFolder = file("../deploy")
|
|
||||||
|
|
||||||
task run(dependsOn: classes, type: JavaExec) {
|
|
||||||
main = project.mainClassName
|
|
||||||
classpath = sourceSets.main.runtimeClasspath
|
|
||||||
standardInput = System.in
|
|
||||||
workingDir = project.assetsDir
|
|
||||||
ignoreExitValue = true
|
|
||||||
}
|
|
||||||
|
|
||||||
task debug(dependsOn: classes, type: JavaExec) {
|
|
||||||
main = project.mainClassName
|
|
||||||
classpath = sourceSets.main.runtimeClasspath
|
|
||||||
standardInput = System.in
|
|
||||||
workingDir = project.assetsDir
|
|
||||||
ignoreExitValue = true
|
|
||||||
debug = true
|
|
||||||
}
|
|
||||||
|
|
||||||
task dist(dependsOn: classes, type: Jar) { // Compiles the jar file
|
|
||||||
from files(sourceSets.main.output.resourcesDir)
|
|
||||||
from files(sourceSets.main.output.classesDirs)
|
|
||||||
// see Laurent1967's comment on https://github.com/libgdx/libgdx/issues/5491
|
|
||||||
from {configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }}
|
|
||||||
from files(project.assetsDir)
|
|
||||||
// This is for the .dll and .so files to make the Discord RPC work on all desktops
|
|
||||||
from files(project.discordDir)
|
|
||||||
archiveFileName = "${appName}.jar"
|
|
||||||
|
|
||||||
manifest {
|
|
||||||
attributes 'Main-Class': project.mainClassName
|
|
||||||
attributes 'Specification-Version': appVersion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(platform in PackrConfig.Platform.values()) {
|
|
||||||
def platformName = platform.toString()
|
|
||||||
task "packr${platformName}"(dependsOn: dist) {
|
|
||||||
|
|
||||||
def jarFile = "desktop/build/libs/${appName}.jar".toString()
|
|
||||||
PackrConfig config = new PackrConfig()
|
|
||||||
config.platform = platform
|
|
||||||
|
|
||||||
def forTravis = true // change to false for local build
|
|
||||||
if(forTravis) {
|
|
||||||
if (platform == PackrConfig.Platform.Linux32 || platform == PackrConfig.Platform.Linux64)
|
|
||||||
config.jdk = System.env.'JAVA_HOME'
|
|
||||||
// take the jdk straight from the building linux computer
|
|
||||||
|
|
||||||
if (platform == PackrConfig.Platform.Windows64)
|
|
||||||
config.jdk = "jdk-windows-64.zip" // see how we download and name this in travis yml
|
|
||||||
if (platform == PackrConfig.Platform.Windows32)
|
|
||||||
config.jdk = "jdk-windows-32.zip" // see how we download and name this in travis yml
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// for my computer
|
|
||||||
config.jdk = "C:/Users/LENOVO/Downloads/java-1.8.0-openjdk-1.8.0.232-1.b09.ojdkbuild.windows.x86_64.zip"
|
|
||||||
}
|
|
||||||
config.executable = "Unciv"
|
|
||||||
config.classpath = Arrays.asList(jarFile)
|
|
||||||
config.removePlatformLibs = config.classpath
|
|
||||||
config.mainClass = project.ext.mainClassName
|
|
||||||
config.vmArgs = Arrays.asList("Xmx1G")
|
|
||||||
config.minimizeJre = "desktop/packrConfig.json"
|
|
||||||
config.outDir = file("packr")
|
|
||||||
|
|
||||||
doLast {
|
|
||||||
if(config.outDir.exists()) delete(config.outDir)
|
|
||||||
new Packr().pack(config)
|
|
||||||
}
|
|
||||||
|
|
||||||
task "zip${platformName}"(type: Zip) {
|
|
||||||
archiveFileName = "${appName}-${platformName}.zip"
|
|
||||||
from config.outDir
|
|
||||||
destinationDirectory = deployFolder
|
|
||||||
}
|
|
||||||
|
|
||||||
finalizedBy "zip${platformName}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task zipLinuxFilesForJar(type: Zip) {
|
|
||||||
archiveFileName = "linuxFilesForJar.zip"
|
|
||||||
from file("linuxFilesForJar")
|
|
||||||
destinationDirectory = deployFolder
|
|
||||||
}
|
|
||||||
|
|
||||||
task packr(){
|
|
||||||
for(platform in PackrConfig.Platform.values())
|
|
||||||
finalizedBy "packr${platform.toString()}"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
eclipse {
|
|
||||||
project {
|
|
||||||
name = appName + "-desktop"
|
|
||||||
linkedResource name: 'assets', type: '2', location: 'PARENT-1-PROJECT_LOC/android/assets'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task afterEclipseImport(description: "Post processing after project generation", group: "IDE") {
|
|
||||||
doLast {
|
|
||||||
def classpath = new XmlParser().parse(file(".classpath"))
|
|
||||||
new Node(classpath, "classpathentry", [ kind: 'src', path: 'assets' ])
|
|
||||||
def writer = new FileWriter(file(".classpath"))
|
|
||||||
def printer = new XmlNodePrinter(new PrintWriter(writer))
|
|
||||||
printer.setPreserveWhitespace(true)
|
|
||||||
printer.print(classpath)
|
|
||||||
}
|
|
||||||
}
|
|
149
desktop/build.gradle.kts
Normal file
149
desktop/build.gradle.kts
Normal file
|
@ -0,0 +1,149 @@
|
||||||
|
import com.badlogicgames.packr.Packr
|
||||||
|
import com.badlogicgames.packr.PackrConfig
|
||||||
|
import com.unciv.build.BuildConfig
|
||||||
|
import groovy.util.Node
|
||||||
|
import groovy.util.XmlNodePrinter
|
||||||
|
import groovy.util.XmlParser
|
||||||
|
import java.io.FileWriter
|
||||||
|
import java.io.PrintWriter
|
||||||
|
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("kotlin")
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_6
|
||||||
|
}
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
java.srcDir("src/")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val mainClassName = "com.unciv.app.desktop.DesktopLauncher"
|
||||||
|
val assetsDir = file("../android/assets")
|
||||||
|
val discordDir = file("discord_rpc")
|
||||||
|
val deployFolder = file("../deploy")
|
||||||
|
|
||||||
|
tasks.register<JavaExec>("run") {
|
||||||
|
dependsOn(tasks.getByName("classes"))
|
||||||
|
|
||||||
|
main = mainClassName
|
||||||
|
classpath = sourceSets.main.get().runtimeClasspath
|
||||||
|
standardInput = System.`in`
|
||||||
|
workingDir = assetsDir
|
||||||
|
isIgnoreExitValue = true
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register<JavaExec>("debug") {
|
||||||
|
dependsOn(tasks.getByName("classes"))
|
||||||
|
main = mainClassName
|
||||||
|
classpath = sourceSets.main.get().runtimeClasspath
|
||||||
|
standardInput = System.`in`
|
||||||
|
workingDir = assetsDir
|
||||||
|
isIgnoreExitValue = true
|
||||||
|
debug = true
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register<Jar>("dist") { // Compiles the jar file
|
||||||
|
dependsOn(tasks.getByName("classes"))
|
||||||
|
|
||||||
|
from(files(sourceSets.main.get().output.resourcesDir))
|
||||||
|
from(files(sourceSets.main.get().output.classesDirs))
|
||||||
|
// see Laurent1967's comment on https://github.com/libgdx/libgdx/issues/5491
|
||||||
|
from({configurations.compileClasspath.get().resolve().map { if(it.isDirectory) it else zipTree(it) }})
|
||||||
|
from(files(assetsDir))
|
||||||
|
// This is for the .dll and .so files to make the Discord RPC work on all desktops
|
||||||
|
from(files(discordDir))
|
||||||
|
archiveName = "${BuildConfig.appName}.jar"
|
||||||
|
|
||||||
|
manifest {
|
||||||
|
attributes(mapOf("Main-Class" to mainClassName, "Specification-Version" to BuildConfig.appVersion))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(platform in PackrConfig.Platform.values()) {
|
||||||
|
val platformName = platform.toString()
|
||||||
|
|
||||||
|
tasks.create("packr${platformName}") {
|
||||||
|
dependsOn(tasks.getByName("dist"))
|
||||||
|
|
||||||
|
val jarFile = "desktop/build/libs/${BuildConfig.appName}.jar"
|
||||||
|
val config = PackrConfig()
|
||||||
|
config.platform = platform
|
||||||
|
|
||||||
|
val forTravis = true // change to false for local build
|
||||||
|
if(forTravis) {
|
||||||
|
if (platform == PackrConfig.Platform.Linux32 || platform == PackrConfig.Platform.Linux64)
|
||||||
|
config.jdk = System.getenv("JAVA_HOME")
|
||||||
|
// take the jdk straight from the building linux computer
|
||||||
|
|
||||||
|
if (platform == PackrConfig.Platform.Windows64)
|
||||||
|
config.jdk = "jdk-windows-64.zip" // see how we download and name this in travis yml
|
||||||
|
if (platform == PackrConfig.Platform.Windows32)
|
||||||
|
config.jdk = "jdk-windows-32.zip" // see how we download and name this in travis yml
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// for my computer
|
||||||
|
config.jdk = "C:/Users/LENOVO/Downloads/java-1.8.0-openjdk-1.8.0.232-1.b09.ojdkbuild.windows.x86_64.zip"
|
||||||
|
}
|
||||||
|
config.apply {
|
||||||
|
executable = "Unciv"
|
||||||
|
classpath = listOf(jarFile)
|
||||||
|
removePlatformLibs = config.classpath
|
||||||
|
mainClass = mainClassName
|
||||||
|
vmArgs = listOf("Xmx1G")
|
||||||
|
minimizeJre = "desktop/packrConfig.json"
|
||||||
|
outDir = file("packr")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
doLast {
|
||||||
|
if(config.outDir.exists()) delete(config.outDir)
|
||||||
|
Packr().pack(config)
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register<Zip>("zip${platformName}") {
|
||||||
|
archiveName = "${BuildConfig.appName}-${platformName}.zip"
|
||||||
|
from(config.outDir)
|
||||||
|
destinationDir = deployFolder
|
||||||
|
}
|
||||||
|
|
||||||
|
finalizedBy("zip${platformName}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register<Zip>("zipLinuxFilesForJar") {
|
||||||
|
archiveName = "linuxFilesForJar.zip"
|
||||||
|
from(file("linuxFilesForJar"))
|
||||||
|
destinationDir = deployFolder
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register("packr") {
|
||||||
|
for(platform in PackrConfig.Platform.values())
|
||||||
|
finalizedBy("packr${platform.toString()}")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
eclipse {
|
||||||
|
project {
|
||||||
|
name = "${BuildConfig.appName}-desktop"
|
||||||
|
linkedResource(mapOf("name" to "assets", "type" to "2", "location" to "PARENT-1-PROJECT_LOC/android/assets"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register("afterEclipseImport") {
|
||||||
|
description = "Post processing after project generation"
|
||||||
|
group = "IDE"
|
||||||
|
|
||||||
|
doLast {
|
||||||
|
val classpath = XmlParser().parse(file(".classpath"))
|
||||||
|
Node(classpath, "classpathentry", mapOf("kind" to "src", "path" to "assets"))
|
||||||
|
val writer = FileWriter(file(".classpath"))
|
||||||
|
val printer = XmlNodePrinter(PrintWriter(writer))
|
||||||
|
printer.isPreserveWhitespace = true
|
||||||
|
printer.print(classpath)
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,22 +0,0 @@
|
||||||
sourceSets.main.java.srcDirs = [ "src/" ]
|
|
||||||
|
|
||||||
sourceCompatibility = '1.7'
|
|
||||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
|
||||||
|
|
||||||
ext {
|
|
||||||
mainClassName = "IOSLauncher"
|
|
||||||
}
|
|
||||||
|
|
||||||
launchIPhoneSimulator.dependsOn build
|
|
||||||
launchIPadSimulator.dependsOn build
|
|
||||||
launchIOSDevice.dependsOn build
|
|
||||||
createIPA.dependsOn build
|
|
||||||
|
|
||||||
robovm {
|
|
||||||
archs = "thumbv7:arm64"
|
|
||||||
}
|
|
||||||
|
|
||||||
eclipse.project {
|
|
||||||
name = appName + "-ios"
|
|
||||||
natures 'org.robovm.eclipse.RoboVMNature'
|
|
||||||
}
|
|
39
ios/build.gradle.kts
Normal file
39
ios/build.gradle.kts
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
import com.android.build.gradle.internal.tasks.factory.dependsOn
|
||||||
|
import com.unciv.build.BuildConfig
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
java.srcDir("src/")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_7
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
compileJava {
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
}
|
||||||
|
compileTestJava {
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extra.set("mainClassName", "IOSLauncher")
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
launchIPhoneSimulator.dependsOn(build)
|
||||||
|
launchIPadSimulator.dependsOn(build)
|
||||||
|
launchIOSDevice.dependsOn(build)
|
||||||
|
createIPA.dependsOn(build)
|
||||||
|
}
|
||||||
|
|
||||||
|
robovm {
|
||||||
|
archs = "thumbv7:arm64"
|
||||||
|
}
|
||||||
|
|
||||||
|
eclipse.project {
|
||||||
|
name = "${BuildConfig.appName}-ios"
|
||||||
|
natures("org.robovm.eclipse.RoboVMNature")
|
||||||
|
}
|
|
@ -1 +0,0 @@
|
||||||
include 'desktop', 'android', 'ios', 'core', 'tests'
|
|
1
settings.gradle.kts
Normal file
1
settings.gradle.kts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
include("desktop", "android", "ios", "core", "tests")
|
|
@ -1,22 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
apply plugin: "java"
|
|
||||||
|
|
||||||
sourceCompatibility = 1.6
|
|
||||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
test {
|
|
||||||
java {
|
|
||||||
srcDir 'src'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
eclipse.project {
|
|
||||||
name = appName + "-tests"
|
|
||||||
}
|
|
32
tests/build.gradle.kts
Normal file
32
tests/build.gradle.kts
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
import com.unciv.build.BuildConfig
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("java")
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_6
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
test {
|
||||||
|
workingDir = file("../android/assets")
|
||||||
|
}
|
||||||
|
|
||||||
|
compileJava {
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
}
|
||||||
|
compileTestJava {
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
test {
|
||||||
|
java.srcDir("src")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
eclipse.project {
|
||||||
|
name = "${BuildConfig.appName}-tests"
|
||||||
|
}
|
Loading…
Reference in a new issue