Skip to content

Commit

Permalink
Updated dependencies and cleaned up gradle build files
Browse files Browse the repository at this point in the history
  • Loading branch information
emartynov authored and paolorotolo committed Feb 6, 2018
1 parent 75bee88 commit 1d43c6b
Show file tree
Hide file tree
Showing 4 changed files with 192 additions and 91 deletions.
102 changes: 40 additions & 62 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,24 @@
*
*/

apply from: "${rootDir}/dependencies.gradle"
apply plugin: 'com.android.application'
apply plugin: 'jacoco'
apply plugin: 'realm-android'

android {
compileSdkVersion 27
buildToolsVersion buildToolsVer
compileSdkVersion buildConfig.compileSdk
buildToolsVersion buildConfig.buildTools

lintOptions {
abortOnError false
}

defaultConfig {
minSdkVersion 16
targetSdkVersion 27
versionCode 41
versionName '1.4.0'
minSdkVersion buildConfig.minSdk
targetSdkVersion buildConfig.targetSdk
versionCode buildConfig.versionCode
versionName buildConfig.versionName
applicationId 'org.glucosio.android'

vectorDrawables.useSupportLibrary = true
Expand Down Expand Up @@ -75,9 +76,6 @@ android {
unitTests.returnDefaultValues = true

unitTests.all {
jacoco {
includeNoLocationClasses = true
}
// configure the test JVM arguments
jvmArgs '-noverify'
}
Expand All @@ -92,78 +90,58 @@ repositories {
mavenCentral()
jcenter()
maven { url 'https://jitpack.io' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}

dependencies {
wearApp project(':wear')

// Android Support libraries
implementation 'com.google.android.support:wearable:2.0.0'
implementation deps.android.support.wearable

implementation "com.android.support:appcompat-v7:${androidSupportVer}"
implementation "com.android.support:design:${androidSupportVer}"
implementation "com.android.support:cardview-v7:${androidSupportVer}"
implementation "com.android.support:recyclerview-v7:${androidSupportVer}"
implementation "com.android.support:percent:${androidSupportVer}"
implementation deps.android.support.design
implementation deps.android.support.cardView
implementation deps.android.support.recyclerView
implementation deps.android.support.percent

// Google Play Services
implementation "com.google.android.gms:play-services-analytics:${googlePlayServicesVer}"
implementation "com.google.android.gms:play-services-drive:${googlePlayServicesVer}"
implementation "com.google.android.gms:play-services-wearable:${googlePlayServicesVer}"
implementation "com.google.android.gms:play-services-gcm:${googlePlayServicesVer}"
implementation deps.android.gms.analytics
implementation deps.android.gms.drive
implementation deps.android.gms.gcm
implementation deps.android.gms.wearable

// Firebase
implementation "com.google.firebase:firebase-core:${googlePlayServicesVer}"
implementation "com.google.firebase:firebase-crash:${googlePlayServicesVer}"
implementation "com.google.firebase:firebase-invites:${googlePlayServicesVer}"
implementation "com.google.firebase:firebase-messaging:${googlePlayServicesVer}"
implementation deps.google.firebase.crash
implementation deps.google.firebase.invites
implementation deps.google.firebase.messaging

// Other libraries
implementation 'com.github.paolorotolo:expandableheightlistview:1.0.0'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.1'
implementation 'uk.co.chrisjenx:calligraphy:2.2.0'
implementation 'net.danlew:android.joda:2.9.9'
implementation('com.mikepenz:materialdrawer:5.8.1@aar') {
implementation deps.ChrisJenx.calligraphy
implementation deps.DanLew.androidJoda
implementation(deps.MikePenz.materialDrawer) {
transitive = true
}
implementation deps.PaoloRotolo.expandableHeightListView
implementation deps.PhilJay.mpAndroidChart

// Butterknife
implementation "com.jakewharton:butterknife:${butterKnifeVer}"
annotationProcessor "com.jakewharton:butterknife-compiler:${butterKnifeVer}"

testImplementation "junit:junit:${junitVer}"
testImplementation "org.mockito:mockito-all:${mockitoVer}"
testImplementation "com.squareup.assertj:assertj-android:${androidAssertJVer}"
testImplementation("org.robolectric:robolectric:${robolectricVer}") {
exclude group: 'commons-logging', module: 'commons-logging'
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
testImplementation("org.robolectric:shadows-supportv4:${robolectricVer}") {
exclude group: 'commons-logging', module: 'commons-logging'
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
implementation deps.JakeWharton.butterKnife.core
annotationProcessor deps.JakeWharton.butterKnife.compiler

// Tests
testImplementation deps.junit
testImplementation deps.mockito
testImplementation deps.square.assertJAndroid
testImplementation deps.robolectric.core
testImplementation deps.robolectric.shadows
// This is for Mockito and Realm (TODO: find clean solution)
testImplementation 'io.reactivex.rxjava2:rxjava:2.1.3'

testImplementation "org.powermock:powermock-module-junit4:1.6.4"
testImplementation "org.powermock:powermock-module-junit4-rule:1.6.4"
testImplementation "org.powermock:powermock-api-mockito:1.6.4"
testImplementation "org.powermock:powermock-classloading-xstream:1.6.4"

// Testing libraries
androidTestImplementation 'com.android.support.test:rules:1.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation "com.android.support:support-annotations:${androidSupportVer}"
androidTestImplementation "com.android.support:recyclerview-v7:${androidSupportVer}"
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-intents:3.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.1'
}

configurations.all {
resolutionStrategy.force "com.android.support:support-annotations:${androidSupportVer}"
resolutionStrategy.force "com.android.support:design:${androidSupportVer}"
resolutionStrategy.force "com.android.support:appcompat-v7:${androidSupportVer}"
// Instrumental Tests
androidTestImplementation deps.android.test.runner
androidTestImplementation deps.android.test.rules
androidTestImplementation deps.android.test.espresso.core
androidTestImplementation deps.android.test.espresso.intents
androidTestImplementation deps.android.test.espresso.contrib
}

def getAllLocales() {
Expand Down
54 changes: 34 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,21 @@
*/
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
apply from: 'dependencies.gradle'

repositories {
jcenter()
google()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.2'
classpath 'io.realm:realm-gradle-plugin:4.3.1'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.2'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0'
classpath 'org.jacoco:org.jacoco.core:0.7.9'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.7.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath deps.buildScript.androidGradlePlugin
classpath deps.buildScript.playServicesGradlePlugin
classpath deps.buildScript.realmGradlePlugin

classpath deps.buildScript.coveralsGradlePlugin
classpath deps.buildScript.versionsGradlePlugin
classpath deps.buildScript.dexcountGradlePlugin
}
}
allprojects {
Expand All @@ -43,20 +42,35 @@ allprojects {
google()
}

ext.buildToolsVer = '27.0.2'

ext.androidSupportVer = '27.0.2'
ext.googlePlayServicesVer = '11.8.0'
apply plugin: 'com.github.ben-manes.versions'

ext.butterKnifeVer = '8.8.1'
// Force all of the primary support libraries to use the same version.
configurations.all {
resolutionStrategy {
eachDependency { details ->
if (details.requested.group == 'com.android.support') {
details.useVersion versions.supportLibrary
}
}
}
}

ext.junitVer = '4.12'
ext.mockitoVer = '1.10.19'
ext.androidAssertJVer = '1.1.1'
ext.robolectricVer = '3.6.1'
// Force only stable dependencies
dependencyUpdates.resolutionStrategy = {
componentSelection { rules ->
rules.all { ComponentSelection selection ->
boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm', 'preview'].any {
qualifier -> selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/
}
if (rejected) {
selection.reject('Release candidate')
}
}
}
}

apply plugin: 'com.github.ben-manes.versions'
}

task wrapper(type: Wrapper) {
gradleVersion = '4.3.1'
gradleVersion = versions.gradle
}
107 changes: 107 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
ext.buildConfig = ['compileSdk' : 27,
'minSdkApp' : 24,
'minSdkWear' : 21,
'minSdk' : 16,
'targetSdk' : 27,

'buildTools' : '27.0.2',

'versionCode': 41,
'versionName': '1.4.0']

ext.versions = ['gradle' : '4.5',

'androidGradlePlugin' : '3.0.1',
'coveralsGradlePlugin' : '2.8.2',
'dexcountGradlePlugin' : '0.8.2',
'realmGradlePlugin' : '4.3.3',
'playServicesGradlePlugin': '3.2.0',
'versionsGradlePlugin' : '0.17.0',

'androidWearable' : '2.2.0',

'androidJoda' : '2.9.9.1',
'butterKnife' : '8.8.1',
'calligraphy' : '2.3.0',
'expandableHeightListView': '1.0.0',
'materialDrawer' : '6.0.4',
'mpAndroidChart' : 'v3.0.3',

'supportLibrary' : '27.0.2',

'playServices' : '11.8.0',

'assertJAndroid' : '1.2.0',
'mockito' : '1.10.19',
'robolectric' : '3.6.1',

'espresso' : '3.0.1',
'atsl' : '1.0.1',

]

ext.deps = [
'buildScript': [
'androidGradlePlugin' : "com.android.tools.build:gradle:${versions.androidGradlePlugin}",
'coveralsGradlePlugin' : "org.kt3k.gradle.plugin:coveralls-gradle-plugin:${versions.coveralsGradlePlugin}",
'dexcountGradlePlugin' : "com.getkeepsafe.dexcount:dexcount-gradle-plugin:${versions.dexcountGradlePlugin}",
'realmGradlePlugin' : "io.realm:realm-gradle-plugin:${versions.realmGradlePlugin}",
'playServicesGradlePlugin': "com.google.gms:google-services:${versions.playServicesGradlePlugin}",
'versionsGradlePlugin' : "com.github.ben-manes:gradle-versions-plugin:${versions.versionsGradlePlugin}"
],

'android' : [
'gms' : [
'analytics': "com.google.android.gms:play-services-analytics:${versions.playServices}",
'drive' : "com.google.android.gms:play-services-drive:${versions.playServices}",
'gcm' : "com.google.android.gms:play-services-gcm:${versions.playServices}",
'wearable' : "com.google.android.gms:play-services-wearable:${versions.playServices}",
],

'support' : [
'annotations' : "com.android.support:support-annotations:${versions.supportLibrary}",
'cardView' : "com.android.support:cardview-v7:${versions.supportLibrary}",
'design' : "com.android.support:design:${versions.supportLibrary}",
'percent' : "com.android.support:percent:${versions.supportLibrary}",
'recyclerView': "com.android.support:recyclerview-v7:${versions.supportLibrary}",
'wearable' : "com.google.android.support:wearable:${versions.androidWearable}"
],

'test' : [
'runner' : "com.android.support.test:runner:${versions.atsl}",
'rules' : "com.android.support.test:rules:${versions.atsl}",
'espresso': [
'core' : "com.android.support.test.espresso:espresso-core:${versions.espresso}",
'intents': "com.android.support.test.espresso:espresso-intents:${versions.espresso}",
'contrib': "com.android.support.test.espresso:espresso-contrib:${versions.espresso}"
],
],

'wearable': "com.google.android.wearable:wearable:${versions.androidWearable}"
],

'google' : [
'firebase': [
'crash' : "com.google.firebase:firebase-crash:${versions.playServices}",
'invites' : "com.google.firebase:firebase-invites:${versions.playServices}",
'messaging': "com.google.firebase:firebase-messaging:${versions.playServices}"
]
],

'ChrisJenx' : ['calligraphy': "uk.co.chrisjenx:calligraphy:${versions.calligraphy}"],
'DanLew' : ['androidJoda': "net.danlew:android.joda:${versions.androidJoda}"],
'JakeWharton': ['butterKnife': ['core' : "com.jakewharton:butterknife:${versions.butterKnife}",
'compiler': "com.jakewharton:butterknife-compiler:${versions.butterKnife}"]],
'MikePenz' : ['materialDrawer': "com.mikepenz:materialdrawer:${versions.materialDrawer}@aar"],
'PaoloRotolo': ['expandableHeightListView': "com.github.paolorotolo:expandableheightlistview:${versions.expandableHeightListView}"],
'PhilJay' : ['mpAndroidChart': "com.github.PhilJay:MPAndroidChart:${versions.mpAndroidChart}"],


'junit' : 'junit:junit:4.12',
'mockito' : "org.mockito:mockito-core:${versions.mockito}",
'robolectric': [
'core' : "org.robolectric:robolectric:${versions.robolectric}",
'shadows': "org.robolectric:shadows-supportv4:${versions.robolectric}"
],
'square' : ['assertJAndroid': "com.squareup.assertj:assertj-android:${versions.assertJAndroid}"],
]
20 changes: 11 additions & 9 deletions wear/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@
*
*/

apply from: '../dependencies.gradle'
apply plugin: 'com.android.application'


android {
compileSdkVersion 25
buildToolsVersion buildToolsVer
compileSdkVersion buildConfig.compileSdk
buildToolsVersion buildConfig.buildTools

defaultConfig {
applicationId "org.glucosio.android"
minSdkVersion 21
targetSdkVersion 25
versionCode 40
versionName '1.3.2'
applicationId 'org.glucosio.android'
minSdkVersion buildConfig.minSdkWear
targetSdkVersion buildConfig.compileSdk
versionCode buildConfig.versionCode
versionName buildConfig.versionName
}
buildTypes {
debug {
Expand All @@ -51,6 +52,7 @@ android {
}

dependencies {
implementation 'com.google.android.support:wearable:2.0.0'
implementation 'com.google.android.gms:play-services-wearable:11.0.4'
implementation deps.android.support.wearable
implementation deps.android.gms.wearable
compileOnly deps.android.wearable
}

0 comments on commit 1d43c6b

Please sign in to comment.