habitica-android/Habitica/build.gradle

308 lines
11 KiB
Groovy
Raw Normal View History

2017-10-26 13:52:12 +00:00
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
2017-10-26 18:33:01 +00:00
apply plugin: 'kotlin-kapt'
2017-10-26 13:52:12 +00:00
apply plugin: 'io.fabric'
apply plugin: 'com.noveogroup.android.check'
apply plugin: 'realm-android'
buildscript {
repositories {
mavenLocal()
2018-11-06 15:11:02 +00:00
google()
2017-10-26 13:52:12 +00:00
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
jcenter()
}
dependencies {
2018-10-17 14:28:23 +00:00
classpath 'io.fabric.tools:gradle:1.25.4'
2018-11-05 12:57:42 +00:00
classpath('com.noveogroup.android:check:1.2.5') {
2017-10-26 13:52:12 +00:00
exclude module: 'checkstyle'
exclude module: 'pmd-java'
}
classpath 'com.puppycrawl.tools:checkstyle:7.5'
classpath 'net.sourceforge.pmd:pmd-java:5.5.3'
}
}
repositories {
mavenLocal()
mavenCentral()
2017-10-26 18:33:01 +00:00
google()
2017-10-26 13:52:12 +00:00
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 {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//Networking
2018-10-29 15:39:10 +00:00
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0'
2017-10-26 13:52:12 +00:00
//REST API handling
2018-07-05 11:24:58 +00:00
implementation('com.squareup.retrofit2:retrofit:2.4.0') {
2017-10-26 13:52:12 +00:00
exclude module: 'okhttp'
}
2018-07-05 11:24:58 +00:00
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
2017-10-26 13:52:12 +00:00
//Crash Logging
2018-10-29 15:39:10 +00:00
releaseImplementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') {
2017-10-26 13:52:12 +00:00
transitive = true
}
//Dependency Injection
2018-10-29 15:39:10 +00:00
implementation 'com.google.dagger:dagger:2.17'
kapt 'com.google.dagger:dagger-compiler:2.17'
2018-11-06 13:04:27 +00:00
compileOnly 'javax.annotation:javax.annotation-api:1.3.1'
2017-10-26 13:52:12 +00:00
//App Compatibility and Material Design
2018-11-06 15:11:02 +00:00
implementation 'androidx.appcompat:appcompat:1.0.1'
implementation 'com.google.android.material:material:1.1.0-alpha01'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
2017-10-26 13:52:12 +00:00
//QR Code
2018-07-05 11:24:58 +00:00
implementation 'com.github.kenglxn.QRGen:android:2.5.0'
2017-10-26 13:52:12 +00:00
// Emojis
implementation 'com.github.viirus:emoji-lib:0.0.5'
// Markdown
implementation 'com.commonsware.cwac:anddown:0.4.0'
// About View for all dependent Libraries, we are using
implementation('com.mikepenz:aboutlibraries:5.9.4@aar') {
transitive = true
}
// a better fab alternative
implementation 'com.github.clans:fab:1.6.4'
//Eventbus
2018-01-30 12:41:22 +00:00
implementation 'org.greenrobot:eventbus:3.1.1'
2017-10-26 13:52:12 +00:00
// IAP Handling / Verification
2018-01-30 12:41:22 +00:00
implementation 'org.solovyev.android:checkout:1.2.1'
2017-10-26 13:52:12 +00:00
//Facebook
2018-07-05 11:24:58 +00:00
implementation('com.facebook.android:facebook-android-sdk:4.34.0') {
2017-10-26 13:52:12 +00:00
transitive = true
}
implementation 'fr.avianey.com.viewpagerindicator:library:2.4.1@aar'
//RxJava
2018-10-29 15:39:10 +00:00
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.2'
2017-10-26 13:52:12 +00:00
//Analytics
2018-07-05 11:24:58 +00:00
implementation 'com.amplitude:android-sdk:2.18.1'
2018-11-07 14:17:25 +00:00
implementation 'com.instabug.library:instabug:8.0.11'
2017-10-26 13:52:12 +00:00
// Fresco Image Management Library
2018-10-29 15:39:10 +00:00
implementation('com.facebook.fresco:fresco:1.11.0') {
2017-10-26 13:52:12 +00:00
exclude module: 'bolts-android'
}
2018-10-29 15:39:10 +00:00
implementation('com.facebook.fresco:animated-gif:1.11.0') {
2017-10-26 13:52:12 +00:00
exclude module: 'bolts-android'
}
//Tests
testImplementation 'junit:junit:4.12'
testImplementation 'org.assertj:assertj-core:2.6.0'
2018-10-29 15:39:10 +00:00
testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.2'
2018-07-05 11:24:58 +00:00
testImplementation 'org.robolectric:robolectric:3.8'
testImplementation 'org.robolectric:shadows-multidex:3.8'
2017-10-26 13:52:12 +00:00
testImplementation 'org.robolectric:shadows-support-v4:3.3.2'
testImplementation 'org.mockito:mockito-core:2.8.9'
testImplementation 'org.powermock:powermock-api-mockito2:1.7.0'
testImplementation 'org.powermock:powermock-module-junit4-rule-agent:1.7.0'
testImplementation 'org.powermock:powermock-module-junit4-rule:1.7.0'
testImplementation 'org.powermock:powermock-module-junit4:1.7.0'
//Leak Detection
2018-10-29 15:39:10 +00:00
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.2'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.2'
2017-10-26 13:52:12 +00:00
//Push Notifications
implementation 'com.google.firebase:firebase-core:11.4.2'
implementation 'com.google.firebase:firebase-messaging:11.4.2'
implementation 'com.google.android.gms:play-services-auth:11.4.2'
implementation 'com.roughike:bottom-bar:2.3.1'
implementation 'io.realm:android-adapters:3.0.0'
2017-10-26 13:52:12 +00:00
implementation(project(':seeds-sdk')) {
exclude group: 'com.google.android.gms'
exclude group: 'com.android.support', module: 'multidex'
}
2018-07-05 11:24:58 +00:00
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
2018-11-06 15:11:02 +00:00
implementation 'androidx.multidex:multidex:2.0.0'
2018-08-09 12:37:53 +00:00
implementation 'com.nex3z:flow-layout:1.2.2'
2018-11-06 15:11:02 +00:00
implementation 'androidx.core:core-ktx:1.0.1'
implementation "androidx.lifecycle:lifecycle-extensions:2.0.0"
2018-11-06 15:11:02 +00:00
kapt "androidx.lifecycle:lifecycle-compiler:2.0.0"
2018-11-09 15:35:06 +00:00
implementation 'com.plattysoft.leonids:LeonidsLib:1.3.2'
2017-10-26 13:52:12 +00:00
}
android {
2018-08-03 08:31:52 +00:00
compileSdkVersion 28
2018-10-17 14:28:23 +00:00
buildToolsVersion '28.0.3'
2017-10-26 13:52:12 +00:00
2018-11-05 12:57:42 +00:00
2017-10-26 13:52:12 +00:00
defaultConfig {
2018-10-19 09:09:24 +00:00
minSdkVersion 15
2017-10-26 13:52:12 +00:00
applicationId "com.habitrpg.android.habitica"
vectorDrawables.useSupportLibrary = true
buildConfigField "String", "STORE", "\"google\""
2018-07-25 10:40:50 +00:00
multiDexEnabled true
2018-11-05 12:57:42 +00:00
2018-11-13 12:41:31 +00:00
versionCode 2030
2018-11-05 12:57:42 +00:00
versionName "1.6"
2017-10-26 13:52:12 +00:00
}
lintOptions {
abortOnError false
}
signingConfigs {
release
}
flavorDimensions "buildType"
buildTypes {
debug {
applicationIdSuffix ".debug"
debuggable true
multiDexEnabled true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// Disable fabric build ID generation for debug builds
ext.enableCrashlytics = false
ext.alwaysUpdateBuildId = false
resValue "string", "content_provider", "com.habitrpg.android.habitica.debug.fileprovider"
resValue "string", "app_name", "Habitica Debug"
}
release {
signingConfig signingConfigs.release
debuggable false
2018-07-25 10:40:50 +00:00
multiDexEnabled true
2017-10-26 13:52:12 +00:00
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
resValue "string", "content_provider", "com.habitrpg.android.habitica.fileprovider"
resValue "string", "app_name", "Habitica"
}
}
productFlavors {
dev {
dimension "buildType"
}
prod {
dimension "buildType"
}
amazon {
buildConfigField "String", "STORE", "\"amazon\""
dimension "buildType"
}
}
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']
}
2018-07-05 11:24:58 +00:00
/*robolectric {
2017-10-26 13:52:12 +00:00
manifest.srcFile 'AndroidManifestTesting.xml'
java.srcDir file('src/test/java/')
res.srcDirs = ['res']
2018-07-05 11:24:58 +00:00
}*/
//instrumentTest.setRoot('tests')
2017-10-26 13:52:12 +00:00
release { java.srcDirs = ['src/release/java'] }
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dexOptions {
preDexLibraries false
javaMaxHeapSize "6g" // Use gig increments depending on needs
}
lintOptions {
disable 'MissingTranslation','InvalidPackage'
enable 'LogConditional','IconExpectedSize','MissingRegistered','TypographyQuotes'
}
}
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()) {
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()) {
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 == "lint") {
task.enabled = false
}
}
2018-11-06 13:04:27 +00:00
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xmaxerrs" << "500"
}
}
2017-10-26 13:52:12 +00:00
check { findbugs { skip true } }
apply plugin: 'com.google.gms.google-services'