From 5f123afcab121a3b56ba0c0be01ca5ad3ecdf2ac Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 2 Dec 2014 19:01:32 +0200 Subject: [PATCH] Create "thin" build type and clean up previous commit. The "thin" build type relies on system scala library, while "debug" and "release" provide the library itself. --- README.md | 6 +++- app/build.gradle | 58 ++++++++++++++++++-------------- app/src/main/AndroidManifest.xml | 4 +-- app/src/thin/AndroidManifest.xml | 13 +++++++ 4 files changed, 52 insertions(+), 29 deletions(-) create mode 100644 app/src/thin/AndroidManifest.xml diff --git a/README.md b/README.md index 366ae5a..77e3899 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ Building ======== -To build, run `./gradlew assembleDebug` or `./gradlew assembleRelease`. +To create a debug apk, run `./gradlew assembleDebug`. Alternatively, you can use +`.gradlew thinDebug` for a faster compile, but this requires Scala libraries installed +with [Android-Scala-Installer](https://github.com/Arneball/Android-Scala-Installer) on your device. + +To create a release apk, run `./gradlew assembleRelease`. License ======= diff --git a/app/build.gradle b/app/build.gradle index ccb1a62..7348f7f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,3 +1,6 @@ +apply plugin: 'com.android.application' +apply plugin: 'jp.leafytree.android-scala' + buildscript { repositories { mavenCentral() @@ -7,11 +10,21 @@ buildscript { classpath "jp.leafytree.gradle:gradle-android-scala-plugin:1.3.1" } } -repositories { - jcenter() + +dependencies { + compile "com.android.support:support-v4:21.0.0" + // For `flat` debug config, as `flatProvided` is unknown. + provided "org.scala-lang:scala-library:2.11.4" + debugCompile "org.scala-lang:scala-library:2.11.4" + releaseCompile "org.scala-lang:scala-library:2.11.4" + compile("org.msgpack:msgpack-scala_2.11:0.6.11") { + transitive = false; + } + compile('org.msgpack:msgpack:0.6.11'){ + transitive = false; + } } -apply plugin: 'com.android.application' -apply plugin: 'jp.leafytree.android-scala' + android { compileSdkVersion 21 @@ -27,22 +40,22 @@ android { sourceSets { main { - scala { - srcDir "src/main/scala" - } + scala.srcDir "src/main/scala" } androidTest { - scala { - srcDir "src/androidTest/scala" - } + scala.srcDir "src/androidTest/scala" } } buildTypes { + thin { + minifyEnabled false + applicationIdSuffix ".debug" + signingConfig signingConfigs.debug + } debug { -// minifyEnabled true - proguardFile file("proguard-rules.pro") + minifyEnabled false applicationIdSuffix ".debug" } release { @@ -51,6 +64,14 @@ android { } } + // Needed to rename `app-thin.apk` to `app-debug.apk` (because Android Studio doesn't let us + // specify a different apk name). + applicationVariants.all { variant -> + def apk = variant.outputFile; + def newName = apk.name.replace("app-thin", "app-debug"); + variant.outputFile = new File(apk.parentFile, newName); + } + // Avoid duplicate file errors during packaging. packagingOptions { exclude 'decoder.properties' @@ -59,16 +80,3 @@ android { exclude 'META-INF/NOTICE' } } - -dependencies { - compile "com.android.support:support-v4:21.+" - provided "org.scala-lang:scala-library:2.11.4" - compile("org.msgpack:msgpack-scala_2.11:0.6.11") { - transitive = false; - } - compile('org.msgpack:msgpack:0.6.11'){ - transitive = false; - } -} - - diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3049328..c7783cd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -8,15 +8,13 @@ + - - - + + + + + + + + + + +