Skip to content

Commit

Permalink
Merge pull request #29 from tiembo/update_dependencies
Browse files Browse the repository at this point in the history
Update dependencies and Gradle version
  • Loading branch information
JoseAlcerreca authored Jan 9, 2018
2 parents 617197f + 65678d6 commit 992848e
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 39 deletions.
4 changes: 2 additions & 2 deletions AndroidTestingBlueprint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ A collection of Google's Android testing tools and frameworks, all integrated in
- `app/test/` - Unit tests
- `app/androidTest/` - Instrumentation tests
- `app/androidTestFlavor2/` - Additional Instrumentation tests for Flavor2.
- `module-flavor1-androidTest-only/` - Test-only module with Instrumentation tests for Flavor1
- `module-android-library/` - An Android module (typically a library)
- `module-android-library/androidTest` - Android Tests for the module-android-library
- `module-flavor1-androidTest-only/` - Test-only module with Instrumentation tests for Flavor1
- `module-plain-java/` - A Java module for non-Android code (business logic, utils classes, etc.)
- `module-plain-java/test` - Unit tests for module-plain-java

Expand Down Expand Up @@ -226,7 +226,7 @@ See [AndroidJUnitRunner](http://developer.android.com/reference/android/support/
- Stack Overflow: http://stackoverflow.com/questions/tagged/android-testing

If you've found an error in this sample, please file an issue:
https://github.com/googlesamples/android-testing-blueprint
https://github.com/googlesamples/android-testing-templates/issues

## Contributions
Patches are encouraged, and may be submitted by forking this project and
Expand Down
38 changes: 16 additions & 22 deletions AndroidTestingBlueprint/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

/*
Test only modules require other artifacts like the classes.jar to be published, so the test can
reference the tested java sources and compile them correctly. In order to get all these
artifacts published from the tested module publishNonDefault needs to be set to true.
*/
publishNonDefault true

defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
Expand Down Expand Up @@ -54,6 +46,8 @@ android {
}
}

flavorDimensions "defaultDimension"

productFlavors {
flavor1 {
applicationId 'com.example.android.testing.blueprint.flavor1'
Expand All @@ -74,34 +68,34 @@ android {

dependencies {
// App's dependencies, including test
compile 'com.android.support:appcompat-v7:' + rootProject.ext.supportLibVersion
implementation 'com.android.support:appcompat-v7:' + rootProject.ext.supportLibVersion

compile project(':module-plain-java') // Optional module for non-Android code
compile project(':module-android-library') // Optional module for additional Android code
implementation project(':module-plain-java') // Optional module for non-Android code
implementation project(':module-android-library') // Optional module for additional Android code

// Dependencies for local unit tests
testCompile 'junit:junit:' + rootProject.ext.junitVersion
testCompile 'org.mockito:mockito-all:' + rootProject.ext.mockitoVersion
testCompile 'org.hamcrest:hamcrest-all:' + rootProject.ext.hamcrestVersion
testImplementation 'junit:junit:' + rootProject.ext.junitVersion
testImplementation 'org.mockito:mockito-all:' + rootProject.ext.mockitoVersion
testImplementation 'org.hamcrest:hamcrest-all:' + rootProject.ext.hamcrestVersion

// Android Testing Support Library's runner and rules
androidTestCompile 'com.android.support.test:runner:' + rootProject.ext.runnerVersion
androidTestCompile 'com.android.support.test:rules:' + rootProject.ext.rulesVersion
androidTestImplementation 'com.android.support.test:runner:' + rootProject.ext.runnerVersion
androidTestImplementation 'com.android.support.test:rules:' + rootProject.ext.rulesVersion

// Espresso UI Testing
androidTestCompile 'com.android.support.test.espresso:espresso-core:' + rootProject.ext.espressoVersion
androidTestImplementation 'com.android.support.test.espresso:espresso-core:' + rootProject.ext.espressoVersion

// Espresso-Contrib, Intents and Web dependencies are not used in this project.
/*
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:' + rootProject.ext.espressoVersion
androidTestCompile 'com.android.support.test.espresso:espresso-intents:' + rootProject.ext.espressoVersion
androidTestCompile 'com.android.support.test.espresso:espresso-web:' + rootProject.ext.espressoVersion
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:' + rootProject.ext.espressoVersion
androidTestImplementation 'com.android.support.test.espresso:espresso-intents:' + rootProject.ext.espressoVersion
androidTestImplementation 'com.android.support.test.espresso:espresso-web:' + rootProject.ext.espressoVersion
*/

// UIAutomator Testing. Learn about this dependency in this projects README file.
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:' + rootProject.ext.uiautomatorVersion
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:' + rootProject.ext.uiautomatorVersion

// Resolve conflicts between main and test APK:
androidTestCompile "com.android.support:support-annotations:$rootProject.supportLibVersion"
androidTestImplementation "com.android.support:support-annotations:$rootProject.supportLibVersion"

}
13 changes: 7 additions & 6 deletions AndroidTestingBlueprint/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
classpath 'com.android.tools.build:gradle:3.0.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -15,16 +16,16 @@ buildscript {
allprojects {
repositories {
jcenter()
google()
}
}

ext {
minSdkVersion = 10
targetSdkVersion = 25
compileSdkVersion = 25
buildToolsVersion = "25.0.1"
minSdkVersion = 14
targetSdkVersion = 27
compileSdkVersion = 27

supportLibVersion = "25.0.1"
supportLibVersion = "27.0.1"
junitVersion = "4.12"
mockitoVersion = "1.10.19"
hamcrestVersion = "1.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-all.zip
5 changes: 2 additions & 3 deletions AndroidTestingBlueprint/module-android-library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apply plugin: 'com.android.library'

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
Expand All @@ -21,6 +20,6 @@ android {

dependencies {
// Android Testing Support Library's runner and rules
androidTestCompile 'com.android.support.test:runner:' + rootProject.ext.runnerVersion
androidTestCompile 'com.android.support.test:rules:' + rootProject.ext.rulesVersion
androidTestImplementation 'com.android.support.test:runner:' + rootProject.ext.runnerVersion
androidTestImplementation 'com.android.support.test:rules:' + rootProject.ext.rulesVersion
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ apply plugin: 'com.android.test' // A plugin used for test-only-modules

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion

// Only include the 'flavor1' product flavor from the 'defaultDimension' flavor dimension
missingDimensionStrategy 'defaultDimension', 'flavor1'

// The package name of the test app
testApplicationId 'com.example.android.testing.blueprint.test'
// The Instrumentation test runner used to run tests.
Expand All @@ -17,12 +19,11 @@ android {
// Set the target app project. The module specified here should contain the production code
// test should run against.
targetProjectPath ':app'
targetVariant 'flavor1Debug'
}

dependencies {
// Android Testing Support Library's runner and rules and hamcrest matchers
compile 'com.android.support.test:runner:' + rootProject.ext.runnerVersion
compile 'com.android.support.test:rules:' + rootProject.ext.rulesVersion
compile 'org.hamcrest:hamcrest-core:' + rootProject.ext.hamcrestVersion
implementation 'com.android.support.test:runner:' + rootProject.ext.runnerVersion
implementation 'com.android.support.test:rules:' + rootProject.ext.rulesVersion
implementation 'org.hamcrest:hamcrest-core:' + rootProject.ext.hamcrestVersion
}

0 comments on commit 992848e

Please sign in to comment.