| buildscript { |
| repositories { |
| mavenCentral() |
| jcenter() |
| } |
| dependencies { |
| // This introduces the Android plugin to make building Android |
| // applications easier. |
| classpath 'com.android.tools.build:gradle:1.5.0' |
| // We are going to define a custom VDL service. The Vanadium |
| // Gradle plugin makes that easier, so let's use that. |
| classpath 'io.v:gradle-plugin:0.9' |
| // Use the Android SDK manager, which will automatically download |
| // the required Android SDK. |
| classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0' |
| } |
| } |
| |
| // Make our lives easier by automatically downloading the appropriate Android SDK. |
| apply plugin: 'android-sdk-manager' |
| // It's an Android application. |
| apply plugin: 'com.android.application' |
| |
| // It's going to use VDL. |
| apply plugin: 'io.v.vdl' |
| |
| // Retrolambda plugin |
| apply plugin: 'me.tatarka.retrolambda' |
| |
| |
| // Conditionally apply the google services plugin, depending on existence of the configuration file. |
| // Also, add conditional source folders as source directories. |
| // This is a workaround for not having conditional compilation in Java. |
| if (new File(projectDir, 'google-services.json').exists()) { |
| apply plugin: 'com.google.gms.google-services' |
| android.sourceSets.main.java.srcDir { 'src/conditional/ga_enabled' } |
| } else { |
| android.sourceSets.main.java.srcDir { 'src/conditional/ga_disabled' } |
| } |
| |
| |
| repositories { |
| mavenCentral() |
| jcenter() |
| } |
| |
| android { |
| compileSdkVersion 23 |
| buildToolsVersion "23.0.1" |
| |
| compileOptions { |
| sourceCompatibility JavaVersion.VERSION_1_8 |
| targetCompatibility JavaVersion.VERSION_1_8 |
| } |
| |
| defaultConfig { |
| applicationId "io.v.android.apps.reader" |
| minSdkVersion 22 |
| targetSdkVersion 23 |
| versionCode 1 |
| versionName "1.0" |
| multiDexEnabled true |
| } |
| buildTypes { |
| release { |
| minifyEnabled false |
| proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' |
| } |
| } |
| // The following block prevents this app from running in arm64-v8a mode. |
| splits { |
| abi { |
| enable true |
| reset() |
| include 'armeabi-v7a' |
| include 'x86_64' |
| universalApk true |
| } |
| } |
| packagingOptions { |
| exclude 'META-INF/NOTICE.txt' |
| exclude 'META-INF/LICENSE.txt' |
| } |
| |
| sourceSets { |
| main { |
| java { |
| srcDir { '../common/src/main/java' } |
| } |
| } |
| } |
| } |
| |
| dependencies { |
| compile fileTree(dir: 'libs', include: ['*.jar']) |
| wearApp project(':wear') |
| compile 'com.android.support:design:23.0.1' |
| compile 'com.android.support:appcompat-v7:23.0.1' |
| compile 'com.android.support:cardview-v7:23.0.1' |
| compile 'com.android.support:recyclerview-v7:23.0.1' |
| compile 'com.google.android.gms:play-services-analytics:8.4.0' |
| compile 'com.google.android.gms:play-services-wearable:8.4.0' |
| compile 'org.apache.commons:commons-csv:1.2' |
| compile 'org.apache.commons:commons-io:1.3.2' |
| compile 'io.v:vanadium-android:1.5' |
| compile 'io.v:baku-toolkit:0.3.0' |
| |
| testCompile 'org.robolectric:robolectric:3.0' |
| |
| // Required by baku-toolkit. |
| compile 'org.slf4j:slf4j-android:1.7.13' |
| } |
| |
| vdl { |
| inputPaths += new File(projectDir, '../../common').canonicalPath |
| packageTranslations += 'vdl->io/v/android/apps/reader/vdl' |
| } |
| |
| |
| // To use the local version of vanadium-android library, |
| // use "-DuseLocalVanadiumLib" parameter in the gradle command. |
| if (System.getProperty('useLocalVanadiumLib') != null) { |
| |
| // NOTE: Make sure that the gradle wrapper version is 2.5 or higher, before using the dependency |
| // substitution feature. |
| configurations.all { |
| resolutionStrategy { |
| dependencySubstitution { |
| substitute module('io.v:vanadium-android') with project(':android-lib') |
| } |
| } |
| } |
| |
| // Copy the Vanadium native library to the correct location. |
| def jiriRoot = new File(projectDir, '../../../../..').canonicalPath |
| task copyVanadiumLib(type: Copy, dependsOn: ':android-lib:goBuildVanadiumLib') { |
| logger.info(jiriRoot + '/release/go/pkg/android_arm_shared_shared/v.io/x/jni') |
| from jiriRoot + '/release/go/pkg/android_arm_shared_shared/v.io/x/jni' |
| into 'src/main/jniLibs/armeabi-v7a' |
| include 'main.a' |
| rename 'main.a', 'libv23.so' |
| } |
| |
| tasks['preBuild'].dependsOn('copyVanadiumLib') |
| } |
| |
| clean { |
| delete 'src/main/jniLibs/armeabi-v7a/libv23.so' |
| } |