fuckin gradle fixes

~ by Mikescher
This commit is contained in:
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")
}
}
}
}
}
}
}
}