fuckin gradle fixes

~ by Mikescher
This commit is contained in:
Armin Benz 2017-04-13 21:40:57 +02:00
parent a2d19985e7
commit 887c013b46
7 changed files with 36 additions and 57 deletions

View File

@ -1,6 +1,6 @@
android {
buildToolsVersion "19.1.0"
compileSdkVersion 20
buildToolsVersion '25.0.0'
compileSdkVersion 24
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
@ -14,27 +14,20 @@ android {
instrumentTest.setRoot('tests')
}
}
// needed to add JNI shared libraries to APK when compiling on CLI
tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask ->
pkgTask.jniFolders = new HashSet<File>()
pkgTask.jniFolders.add(new File(projectDir, 'libs'))
}
// 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() {
task copyAndroidNatives() {
file("libs/armeabi/").mkdirs();
file("libs/armeabi-v7a/").mkdirs();
file("libs/x86/").mkdirs();
configurations.natives.files.each { jar ->
def outputDir = null
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.jar")) outputDir = file("libs/x86")
if(outputDir != null) {
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.jar")) outputDir = file("libs/x86")
if (outputDir != null) {
copy {
from zipTree(jar)
into outputDir
@ -43,7 +36,6 @@ task copyAndroidNatives() {
}
}
}
task run(type: Exec) {
def path
def localProperties = project.file("../local.properties")
@ -65,7 +57,6 @@ task run(type: Exec) {
def adb = path + "/platform-tools/adb"
commandLine "$adb", 'shell', 'am', 'start', '-n', 'de.samdev.colorrunner.android/de.samdev.colorrunner.android.AndroidLauncher'
}
// sets up the Android Eclipse project, using the old Ant based build.
eclipse {
// need to specify Java source sets explicitely, SpringSource Gradle Eclipse plugin
@ -82,8 +73,8 @@ eclipse {
}
classpath {
plusConfigurations += project.configurations.compile
containers 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK', 'com.android.ide.eclipse.adt.LIBRARIES'
plusConfigurations += project.configurations.compile
containers 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK', 'com.android.ide.eclipse.adt.LIBRARIES'
}
project {
@ -96,12 +87,11 @@ eclipse {
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]]]
scopes = [COMPILE: [plus: [project.configurations.compile]]]
iml {
withXml {
@ -111,11 +101,11 @@ idea {
builder.component(name: "FacetManager") {
facet(type: "android", name: "Android") {
configuration {
option(name: "UPDATE_PROPERTY_FILES", value:"true")
option(name: "UPDATE_PROPERTY_FILES", value: "true")
}
}
}
}
}
}
}
}

View File

@ -1,11 +1,12 @@
buildscript {
repositories {
mavenCentral()
mavenLocal()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.10+'
classpath 'com.github.jtakakura:gradle-robovm-plugin:0.0.10'
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'org.robovm:robovm-gradle-plugin:1.9.0'
}
}
@ -16,12 +17,11 @@ allprojects {
version = '1.0'
ext {
appName = 'ColorRunner'
gdxVersion = '1.3.0'
roboVMVersion = '0.0.14'
gdxVersion = '1.6.1'
roboVMVersion = '1.2.0'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }

View File

@ -41,10 +41,10 @@ public class SplashScreen implements Screen {
Gdx.gl.glClearColor(0.25f, 0.5f, 1, 1); //Blau
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
}else if (random == 4){
Gdx.gl.glClearColor(0, 0.8f, 0.3f, 1); //Grün
Gdx.gl.glClearColor(0, 0.8f, 0.3f, 1); //Grün
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
}else if (random == 5){
Gdx.gl.glClearColor(1, 1, 1, 1); //Weiß
Gdx.gl.glClearColor(1, 1, 1, 1); //Weiß
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
}

View File

@ -1,11 +1,8 @@
apply plugin: "java"
sourceCompatibility = 1.6
sourceSets.main.java.srcDirs = [ "src/" ]
sourceSets.main.java.srcDirs = ["src/"]
project.ext.mainClassName = "de.samdev.colorrunner.desktop.DesktopLauncher"
project.ext.assetsDir = new File("../android/assets");
task run(dependsOn: classes, type: JavaExec) {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
@ -13,34 +10,30 @@ task run(dependsOn: classes, type: JavaExec) {
workingDir = project.assetsDir
ignoreExitValue = true
}
task dist(type: Jar) {
from files(sourceSets.main.output.classesDir)
from files(sourceSets.main.output.resourcesDir)
from {configurations.compile.collect {zipTree(it)}}
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'
}
}
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)
}
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)
}
}

Binary file not shown.

View File

@ -1,6 +1,6 @@
#Sat Sep 21 13:08:26 CEST 2013
#Thu Apr 13 20:04:09 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.11-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

10
gradlew vendored
View File

@ -42,11 +42,6 @@ case "`uname`" in
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
@ -61,9 +56,9 @@ while [ -h "$PRG" ] ; do
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@ -114,6 +109,7 @@ fi
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`