From 11736fceb90d618b4a473f8308a209f25ac7ab45 Mon Sep 17 00:00:00 2001 From: fred-boy Date: Thu, 26 Sep 2019 23:40:27 +0700 Subject: [PATCH] Update gradle --- android/AndroidManifest.xml | 14 +-- android/build.gradle | 115 +++++++---------------- build.gradle | 44 +++++---- core/build.gradle | 9 +- desktop/build.gradle | 46 ++++----- gradle/wrapper/gradle-wrapper.properties | 6 +- 6 files changed, 85 insertions(+), 149 deletions(-) diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 522b4b8..dbde2a4 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -1,16 +1,12 @@ - - - - + xmlns:tools="http://schemas.android.com/tools" package="ru.deadsoftware.cavedroid"> + android:allowBackup="true" + android:icon="@drawable/ic_launcher" + android:label="@string/app_name" + android:theme="@style/GdxTheme" tools:ignore="GoogleAppIndexingWarning"> - 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") @@ -82,58 +91,4 @@ task run(type: Exec) { def adb = path + "/platform-tools/adb" commandLine "$adb", 'shell', 'am', 'start', '-n', 'ru.deadsoftware.cavedroid/ru.deadsoftware.cavedroid.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") - } - } - } - } - } - } -} -dependencies { -} +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 8e69a31..1a9b554 100644 --- a/build.gradle +++ b/build.gradle @@ -1,28 +1,28 @@ buildscript { - + repositories { mavenLocal() mavenCentral() + maven { url "https://plugins.gradle.org/m2/" } maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } jcenter() + google() } dependencies { - classpath 'com.android.tools.build:gradle:2.1.3' - + classpath 'com.android.tools.build:gradle:3.5.0' + } } allprojects { - apply plugin: "eclipse" - apply plugin: "idea" version = 'alpha0.4' ext { appName = "CaveDroid" - gdxVersion = '1.9.7' - roboVMVersion = '2.3.1' + gdxVersion = '1.9.10' + roboVMVersion = '2.3.7' box2DLightsVersion = '1.4' ashleyVersion = '1.7.0' aiVersion = '1.8.0' @@ -31,20 +31,22 @@ allprojects { repositories { mavenLocal() mavenCentral() + jcenter() + google() maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } maven { url "https://oss.sonatype.org/content/repositories/releases/" } } } project(":desktop") { - apply plugin: "java" + apply plugin: "java-library" dependencies { - compile project(":core") - compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" - compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" - + implementation project(":core") + api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" + api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" + } } @@ -54,27 +56,23 @@ project(":android") { configurations { natives } dependencies { - compile project(":core") - compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion" + implementation project(":core") + 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" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64" - + } } project(":core") { - apply plugin: "java" + apply plugin: "java-library" dependencies { - compile "com.badlogicgames.gdx:gdx:$gdxVersion" - - } -} + api "com.badlogicgames.gdx:gdx:$gdxVersion" -tasks.eclipse.doLast { - delete ".project" -} + } +} \ No newline at end of file diff --git a/core/build.gradle b/core/build.gradle index 03cd1be..f17ab83 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,11 +1,6 @@ apply plugin: "java" -sourceCompatibility = 1.6 +sourceCompatibility = 1.8 [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' -sourceSets.main.java.srcDirs = [ "src/" ] - - -eclipse.project { - name = appName + "-core" -} +sourceSets.main.java.srcDirs = [ "src/" ] \ No newline at end of file diff --git a/desktop/build.gradle b/desktop/build.gradle index bd50a04..b3a6693 100644 --- a/desktop/build.gradle +++ b/desktop/build.gradle @@ -1,17 +1,27 @@ apply plugin: "java" -sourceCompatibility = 1.6 +sourceCompatibility = 1.8 sourceSets.main.java.srcDirs = [ "src/" ] +sourceSets.main.resources.srcDirs = ["../android/assets"] project.ext.mainClassName = "ru.deadsoftware.cavedroid.desktop.DesktopLauncher" -project.ext.assetsDir = new File("../android/assets"); +project.ext.assetsDir = new File("../android/assets") task run(dependsOn: classes, type: JavaExec) { main = project.mainClassName classpath = sourceSets.main.runtimeClasspath standardInput = System.in workingDir = project.assetsDir - ignoreExitValue = true + ignoreExitValue = true as JavaExecSpec +} + +task runTouch(dependsOn: classes, type: JavaExec) { + main = project.mainClassName + classpath = sourceSets.main.runtimeClasspath + standardInput = System.in + workingDir = project.assetsDir + ignoreExitValue = true as JavaExecSpec + args "--touch" } task debug(dependsOn: classes, type: JavaExec) { @@ -19,37 +29,19 @@ task debug(dependsOn: classes, type: JavaExec) { classpath = sourceSets.main.runtimeClasspath standardInput = System.in workingDir = project.assetsDir - ignoreExitValue = true + ignoreExitValue = true as JavaExecSpec debug = true } task dist(type: Jar) { - from files(sourceSets.main.output.classesDir) - from files(sourceSets.main.output.resourcesDir) - from {configurations.compile.collect {zipTree(it)}} - from files(project.assetsDir); - manifest { attributes 'Main-Class': project.mainClassName } -} - -dist.dependsOn classes - -eclipse { - project { - name = appName + "-desktop" - linkedResource name: 'assets', type: '2', location: 'PARENT-1-PROJECT_LOC/android/assets' + from { + configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) } } + with jar } -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) - } -} + +dist.dependsOn classes \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0eb9142..3745855 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Jun 09 23:06:52 EDT 2017 +#Thu Sep 26 22:30:23 NOVT 2019 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +zipStoreBase=GRADLE_USER_HOME -- 2.29.2