habitica-android/Habitica/build.gradle
2016-06-17 12:43:49 +02:00

271 lines
8.1 KiB
Groovy

apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'
apply plugin: 'io.fabric'
apply plugin: 'com.neenbedankt.android-apt'
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.21.5'
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.4.4'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
}
}
repositories {
mavenLocal()
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
maven { url 'https://maven.fabric.io/public' }
// Material View Pager
maven {
url "http://dl.bintray.com/florent37/maven"
}
// Markdown
maven {
url "https://s3.amazonaws.com/repo.commonsware.com"
}
maven {
url "https://jitpack.io"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//Networking
compile 'com.squareup.okhttp3:okhttp-urlconnection:3.2.0'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
//REST API handling
compile ('com.squareup.retrofit2:retrofit:2.0.2') {
exclude module: 'okhttp'
}
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
//Crash Logging
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true;
}
// View Elements Binding :)
compile 'com.jakewharton:butterknife:8.0.1'
apt 'com.jakewharton:butterknife-compiler:8.0.1'
//Dependency Injection
compile 'com.google.dagger:dagger:2.2'
apt 'com.google.dagger:dagger-compiler:2.2'
provided 'org.glassfish:javax.annotation:10.0-b28'
//App Compatibility and Material Design
compile('com.mikepenz:materialdrawer:5.2.6@aar') {
transitive = true
}
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:gridlayout-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:preference-v14:23.4.0'
compile 'com.android.support:multidex:1.0.1'
// Image Loading/Caching
compile 'com.squareup.picasso:picasso:2.5.2'
// Emojis
compile 'com.github.data5tream:emoji-lib:0.0.2.1'
// Markdown
compile 'com.commonsware.cwac:anddown:0.2.4'
// About View for all dependent Libraries, we are using
compile('com.mikepenz:aboutlibraries:5.6.6@aar') {
transitive = true
}
// a better fab alternative
compile 'com.github.clans:fab:1.6.3'
// ORM
apt 'com.raizlabs.android:DBFlow-Compiler:2.2.1'
compile "com.raizlabs.android:DBFlow-Core:2.2.1"
compile "com.raizlabs.android:DBFlow:2.2.1"
//Eventbus
compile 'org.greenrobot:eventbus:3.0.0'
// IAP Handling / Verification
compile 'org.solovyev.android:checkout:0.7.5@aar'
//Facebook
compile('com.facebook.android:facebook-android-sdk:4.11.0') {
transitive = true
}
compile 'fr.avianey.com.viewpagerindicator:library:2.4.1@aar'
//RxJava
compile 'io.reactivex:rxandroid:1.2.0'
compile 'io.reactivex:rxjava:1.1.5'
compile 'com.trello:rxlifecycle:0.6.1'
//Analytics
compile 'com.amplitude:android-sdk:2.7.1'
// Fresco Image Management Library
compile('com.facebook.fresco:fresco:0.10.0') {
exclude module: 'bolts-android'
}
compile('com.facebook.fresco:animated-gif:0.10.0') {
exclude module: 'bolts-android'
}
//Tests
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
testCompile 'org.robolectric:robolectric:3.0'
testCompile 'org.robolectric:shadows-multidex:3.0'
testCompile "org.robolectric:shadows-support-v4:3.0"
testCompile "org.mockito:mockito-core:1.+"
//Leak Detection
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
lintOptions {
abortOnError false
}
signingConfigs {
release
}
dexOptions{
preDexLibraries = false
}
buildTypes {
debug {
applicationIdSuffix ".debug"
debuggable true
// Disable fabric build ID generation for debug builds
ext.enableCrashlytics = false
multiDexEnabled true
}
release {
signingConfig signingConfigs.release
debuggable false
multiDexEnabled true
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src/main/java']
resources.srcDirs = ['src/main/java']
aidl.srcDirs = ['src/main/java']
renderscript.srcDirs = ['src/main/java']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
robolectric {
manifest.srcFile 'AndroidManifest.xml'
java.srcDir file('src/test/java/')
res.srcDirs = ['res']
}
release.setRoot('build-types/release')
instrumentTest.setRoot('tests')
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dexOptions {
preDexLibraries true
javaMaxHeapSize "2g" // Use gig increments depending on needs
incremental true
}
}
def Properties props = new Properties()
def propFile = new File('signingrelease.properties')
if (propFile.canRead()) {
props.load(new FileInputStream(propFile))
if (props != null && props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') &&
props.containsKey('KEY_ALIAS') && props.containsKey('KEY_PASSWORD')) {
android.signingConfigs.release.storeFile = file(props['STORE_FILE'])
android.signingConfigs.release.storePassword = props['STORE_PASSWORD']
android.signingConfigs.release.keyAlias = props['KEY_ALIAS']
android.signingConfigs.release.keyPassword = props['KEY_PASSWORD']
} else {
println 'signing.properties found but some entries are missing'
android.buildTypes.release.signingConfig = null
}
} else {
println 'signing.properties not found'
android.buildTypes.release.signingConfig = null
}
// Add Habitica Properties to buildConfigField
final File HRPG_PROPS_FILE = new File('habitica.properties')
if (HRPG_PROPS_FILE.canRead()) {
def Properties HRPG_PROPS = new Properties()
HRPG_PROPS.load(new FileInputStream(HRPG_PROPS_FILE))
if (HRPG_PROPS != null) {
android.buildTypes.all { buildType ->
HRPG_PROPS.any { property ->
buildType.buildConfigField "String", property.key, "\"${property.value}\""
}
}
} else {
throw new InvalidUserDataException('habitica.properties found but some entries are missing')
}
} else {
throw new MissingResourceException('habitica.properties not found')
}
// Add Habitica Resources to resources
final File HRPG_RES_FILE = new File('habitica.resources')
if (HRPG_RES_FILE.canRead()) {
def Properties HRPG_RES = new Properties()
HRPG_RES.load(new FileInputStream(HRPG_RES_FILE))
if (HRPG_RES != null) {
android.buildTypes.all { buildType ->
HRPG_RES.any { property ->
buildType.resValue "string", property.key, "\"${property.value}\""
}
}
} else {
throw new InvalidUserDataException('habitica.resources found but some entries are missing')
}
} else {
throw new MissingResourceException('habitica.resources not found')
}
tasks.whenTaskAdded { task ->
if (task.name.equals("lint")) {
task.enabled = false
}
}
apply plugin: 'com.getkeepsafe.dexcount'
apply plugin: 'com.android.application' //or apply plugin: 'java'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.jakewharton.hugo'