diff --git a/build.gradle b/build.gradle index aa0a6a74ca..c11d09b0dd 100644 --- a/build.gradle +++ b/build.gradle @@ -13,13 +13,16 @@ buildscript { 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.5.2' 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" } } @@ -56,7 +59,6 @@ allprojects { project(":desktop") { apply plugin: "kotlin" - dependencies { implementation project(":core") implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" @@ -67,6 +69,7 @@ project(":desktop") { 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' + } } diff --git a/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt b/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt index 114b94cb36..1eab44f604 100644 --- a/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt +++ b/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt @@ -181,7 +181,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera val tileInfo = TileInfo() if (terrain.type == TerrainType.TerrainFeature) { tileInfo.baseTerrain = when { - terrain.occursOn == null -> terrain.occursOn!!.first() + terrain.occursOn != null -> terrain.occursOn.first() else -> "Grassland" } tileInfo.terrainFeature = terrain.name diff --git a/desktop/build.gradle b/desktop/build.gradle index 86baa7fd1b..78772f5f5d 100644 --- a/desktop/build.gradle +++ b/desktop/build.gradle @@ -24,7 +24,7 @@ task debug(dependsOn: classes, type: JavaExec) { debug = true } -task dist(type: Jar) { +task dist(dependsOn: classes, type: Jar) { from files(sourceSets.main.output.resourcesDir) from files(sourceSets.main.output.classesDirs) // see Laurent1967's comment on https://github.com/libgdx/libgdx/issues/5491 @@ -39,7 +39,20 @@ task dist(type: Jar) { } } -dist.dependsOn classes +//task packrWindows(){ +// PackrConfig config = new PackrConfig(); +// config.platform = PackrConfig.Platform.Windows32; +// config.jdk = "/User/badlogic/Downloads/openjdk-for-mac.zip"; +// config.executable = "myapp"; +// config.classpath = Arrays.asList("myjar.jar"); +// config.removePlatformLibs = config.classpath; +// config.mainClass = "com.my.app.MainClass"; +// config.vmArgs = Arrays.asList("Xmx1G"); +// config.minimizeJre = "soft"; +// config.outDir = new File("out-mac"); +// +// new Packr().pack(config); +//} eclipse { project { @@ -58,8 +71,8 @@ task afterEclipseImport(description: "Post processing after project generation", printer.print(classpath) } } - -dependencies { - implementation "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop" - implementation project(path: ':core') -} \ No newline at end of file +// +//dependencies { +// implementation "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop" +// implementation project(path: ':core') +//} \ No newline at end of file diff --git a/out-mac/config.json b/out-mac/config.json new file mode 100644 index 0000000000..b133ce6533 --- /dev/null +++ b/out-mac/config.json @@ -0,0 +1,9 @@ +{ + "classPath": [ + "myjar.jar" + ], + "mainClass": "com.my.app.MainClass", + "vmArgs": [ + "-Xmx1G" + ] +} \ No newline at end of file diff --git a/tests/src/de/tomgrill/gdxtesting/examples/AssetExistsExampleTest.java b/tests/src/de/tomgrill/gdxtesting/examples/AssetExistsExampleTest.java deleted file mode 100644 index 2413606c43..0000000000 --- a/tests/src/de/tomgrill/gdxtesting/examples/AssetExistsExampleTest.java +++ /dev/null @@ -1,30 +0,0 @@ -// Taken from https://github.com/TomGrill/gdx-testing - -package de.tomgrill.gdxtesting.examples; - -import com.badlogic.gdx.Gdx; -import com.unciv.models.gamebasics.GameBasics; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import de.tomgrill.gdxtesting.GdxTestRunner; - -import static org.junit.Assert.assertTrue; - -@RunWith(GdxTestRunner.class) -public class AssetExistsExampleTest { - - @Test - public void gamePngExists() { - assertTrue("This test will only pass when the game.png exists", - Gdx.files.local("game.png").exists()); - } - - @Test - public void gameBasicsLoad() { - assertTrue("This test will only pass when the game.png exists", - GameBasics.INSTANCE.getBuildings().size() > 0); - } - -} diff --git a/tests/src/de/tomgrill/gdxtesting/examples/BasicTests.kt b/tests/src/de/tomgrill/gdxtesting/examples/BasicTests.kt new file mode 100644 index 0000000000..4614f62d67 --- /dev/null +++ b/tests/src/de/tomgrill/gdxtesting/examples/BasicTests.kt @@ -0,0 +1,36 @@ +// Taken from https://github.com/TomGrill/gdx-testing + +package de.tomgrill.gdxtesting.examples + +import com.badlogic.gdx.Gdx +import com.unciv.UnCivGame +import com.unciv.models.gamebasics.GameBasics +import com.unciv.ui.mapeditor.MapEditorScreen +import de.tomgrill.gdxtesting.GdxTestRunner +import org.junit.Assert.assertTrue +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(GdxTestRunner::class) +class BasicTests { + + @Test + fun gamePngExists() { + assertTrue("This test will only pass when the game.png exists", + Gdx.files.local("game.png").exists()) + } + + @Test + fun gameBasicsLoad() { + assertTrue("This test will only pass when the GameBasics can initialize, and there are buildings", + GameBasics.Buildings.size > 0) + } + + @Test + fun canOpenMapEditorScreen() { + UnCivGame.Current.setScreen(MapEditorScreen(UnCivGame.Current.gameInfo.tileMap)) + assertTrue("This test will only pass when we can open the map editor screen", + GameBasics.Buildings.size > 0) + } + +}