Skip to content

Commit

Permalink
Re-run libGDX setup and replace project files with those
Browse files Browse the repository at this point in the history
  • Loading branch information
Lonami committed Mar 29, 2020
1 parent ece4810 commit 9c6be35
Show file tree
Hide file tree
Showing 30 changed files with 634 additions and 304 deletions.
10 changes: 5 additions & 5 deletions android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="dev.lonami.klooni">
package="dev.lonami.klooni" >

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:isGame="true"
android:appCategory="game"
android:label="@string/app_name"
android:theme="@style/GdxTheme"
android:fullBackupContent="@xml/backup_rules"
tools:ignore="GoogleAppIndexingWarning">
android:fullBackupContent="@xml/backup_rules">
<activity
android:name="dev.lonami.klooni.AndroidLauncher"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
android:configChanges="keyboard|keyboardHidden|navigation|orientation|screenSize|screenLayout">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down
112 changes: 36 additions & 76 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
android {
buildToolsVersion "25.0.3"
compileSdkVersion 28
buildToolsVersion "29.0.3"
compileSdkVersion 29
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
Expand All @@ -12,7 +12,6 @@ android {
jniLibs.srcDirs = ['libs']
}

androidTest.setRoot('tests')
}
packagingOptions {
exclude 'META-INF/robovm/ios/robovm.xml'
Expand All @@ -21,41 +20,54 @@ android {
applicationId "dev.lonami.klooni"
//noinspection MinSdkTooLow
minSdkVersion 8
targetSdkVersion 28

targetSdkVersion 29
versionCode 830
versionName "0.8.3"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}


// 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() {
file("libs/armeabi/").mkdirs()
file("libs/armeabi-v7a/").mkdirs()
file("libs/arm64-v8a/").mkdirs()
file("libs/x86_64/").mkdirs()
file("libs/x86/").mkdirs()
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"
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")
Expand All @@ -78,56 +90,4 @@ task run(type: Exec) {
commandLine "$adb", 'shell', 'am', 'start', '-n', 'dev.lonami.klooni/dev.lonami.klooni.AndroidLauncher'
}

// 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")
}
}
}
}
}
}
}
eclipse.project.name = appName + "-android"
File renamed without changes.
17 changes: 6 additions & 11 deletions android/project.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# This file is used by the Eclipse ADT plugin. It is unnecessary for IDEA and Android Studio projects, which
# configure Proguard and the Android target via the build.gradle file.

# To enable ProGuard to work with Eclipse ADT, uncomment this (available properties: sdk.dir, user.home)
# and ensure proguard.jar in the Android SDK is up to date (or alternately reduce the android target to 23 or lower):
# proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-rules.pro

# Project target.
target=android-19
59 changes: 35 additions & 24 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,27 @@ buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
google()
}
dependencies {
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.0'
classpath 'org.wisepersist:gwt-gradle-plugin:1.0.9'
// Don't update to avoid breaking the build; noinspection GradleDependency
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.8'
}
}

allprojects {
apply plugin: "eclipse"
apply plugin: "idea"

version = '0.8.3'
ext {
appName = "1010! Klooni"
gdxVersion = '1.9.5'
roboVMVersion = '2.3.0'
gdxVersion = '1.9.10'
roboVMVersion = '2.3.8'
box2DLightsVersion = '1.4'
ashleyVersion = '1.7.0'
aiVersion = '1.8.0'
Expand All @@ -30,20 +31,21 @@ allprojects {
repositories {
mavenLocal()
mavenCentral()
jcenter()
google()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
google()
}
}

project(":desktop") {
apply plugin: "java"
apply plugin: "java-library"


dependencies {
implementation project(":core")
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
}
}

Expand All @@ -54,7 +56,7 @@ project(":android") {

dependencies {
implementation project(":core")
implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
api "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"
Expand All @@ -63,29 +65,38 @@ project(":android") {
}
}

project(":core") {
apply plugin: "java"
project(":ios") {
apply plugin: "java-library"
apply plugin: "robovm"


dependencies {
implementation "com.badlogicgames.gdx:gdx:$gdxVersion"
implementation project(":core")
api "com.mobidevelop.robovm:robovm-rt:$roboVMVersion"
api "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion"
api "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
}
}

project(":ios") {
apply plugin: "java"
apply plugin: "robovm"

project(":html") {
apply plugin: "java-library"
apply plugin: "gwt"
apply plugin: "war"

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"
api "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
api "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
api "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"

}
}

tasks.eclipse.doLast {
delete ".project"
project(":core") {
apply plugin: "java-library"

dependencies {
api "com.badlogicgames.gdx:gdx:$gdxVersion"
}
}
5 changes: 1 addition & 4 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,4 @@ sourceCompatibility = 1.6

sourceSets.main.java.srcDirs = ["src/"]


eclipse.project {
name = appName + "-core"
}
eclipse.project.name = appName + "-core"
9 changes: 4 additions & 5 deletions core/src/Klooni.gwt.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE module PUBLIC
"-//Google Inc.//DTD Google Web Toolkit trunk//EN"
"http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd">
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://www.gwtproject.org/doctype/2.8.0/gwt-module.dtd">
<module>
<source path="io/github/lonamiwebs/klooni" />
</module>
<source path="dev/lonami/klooni" />
</module>
39 changes: 16 additions & 23 deletions desktop/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apply plugin: "java"

sourceCompatibility = 1.6
sourceSets.main.java.srcDirs = ["src/"]
sourceSets.main.resources.srcDirs = ["../android/assets"]

project.ext.mainClassName = "dev.lonami.klooni.desktop.DesktopLauncher"
project.ext.assetsDir = new File("../android/assets")
Expand All @@ -14,34 +15,26 @@ task run(dependsOn: classes, type: JavaExec) {
ignoreExitValue = true
}

task dist(type: Jar) {
from files(sourceSets.main.output.classesDirs)
from files(sourceSets.main.output.resourcesDir)
from { configurations.compile.collect { zipTree(it) } }
from files(project.assetsDir)
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(type: Jar) {
manifest {
attributes 'Main-Class': project.mainClassName
}
dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
with jar
}

dist.dependsOn classes

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"))
// Result of "new" was being ignored
// 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)
}
}
eclipse.project.name = appName + "-desktop"
Loading

0 comments on commit 9c6be35

Please sign in to comment.