Skip to content

Commit

Permalink
Fix gradle connectedCheck by switching to android-unit-test.
Browse files Browse the repository at this point in the history
Per https://github.com/robolectric/deckard-gradle, it is now recommended
to use the `android-unit-test` plugin for Robolectric with `testCompile`
scope instead of `androidTestCompile` to separate integration tests from
robolectric unit tests.

This is necessary to cleanly integrated with Travis-CI.
  • Loading branch information
Josh Guilfoyle authored and longinoa committed Mar 11, 2015
1 parent 02f6715 commit 1ed6348
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 34 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
classpath 'org.robolectric:robolectric-gradle-plugin:0.14.+'
classpath 'com.github.jcandksolutions.gradle:android-unit-test:2.1.1'
}
}

Expand Down
27 changes: 9 additions & 18 deletions stetho-okhttp/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
apply plugin: 'com.android.library'
apply plugin: 'robolectric'

android {
compileSdkVersion 21
Expand All @@ -10,12 +9,7 @@ android {
targetSdkVersion 21
versionCode 1
versionName "1.0"
}

sourceSets {
androidTest {
setRoot('src/test')
}
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

lintOptions {
Expand All @@ -26,30 +20,27 @@ android {
}
}

robolectric {
include '**/*Test.class'
exclude '**/espresso/**/*.class'
}
apply plugin: 'android-unit-test'

dependencies {
compile project(':stetho')
compile 'com.google.code.findbugs:jsr305:2.0.1'
//noinspection GradleDynamicVersion
compile 'com.squareup.okhttp:okhttp:[2,3)'

androidTestCompile 'junit:junit:4.12'
androidTestCompile('org.robolectric:robolectric:2.4') {
testCompile 'junit:junit:4.12'
testCompile('org.robolectric:robolectric:2.4') {
exclude module: 'commons-logging'
exclude module: 'httpclient'
}
androidTestCompile 'org.powermock:powermock-api-mockito:1.6.1'
androidTestCompile 'org.powermock:powermock-module-junit4:1.6.1'
testCompile 'org.powermock:powermock-api-mockito:1.6.1'
testCompile 'org.powermock:powermock-module-junit4:1.6.1'

// Needed for Robolectric and PowerMock to be combined in a single test.
androidTestCompile 'org.powermock:powermock-module-junit4-rule:1.6.1'
androidTestCompile 'org.powermock:powermock-classloading-xstream:1.6.1'
testCompile 'org.powermock:powermock-module-junit4-rule:1.6.1'
testCompile 'org.powermock:powermock-classloading-xstream:1.6.1'

androidTestCompile 'com.squareup.okhttp:mockwebserver:2.2.0'
testCompile 'com.squareup.okhttp:mockwebserver:2.2.0'
}

apply from: rootProject.file('release.gradle')
21 changes: 6 additions & 15 deletions stetho/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
apply plugin: 'com.android.library'
apply plugin: 'robolectric'

android {
compileSdkVersion 21
Expand All @@ -10,31 +9,23 @@ android {
targetSdkVersion 21
versionCode 1
versionName "1.0"
}

sourceSets {
androidTest {
setRoot('src/test')
}
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}

robolectric {
include '**/*Test.class'
exclude '**/espresso/**/*.class'
}
apply plugin: 'android-unit-test'

dependencies {
compile 'commons-cli:commons-cli:1.2'
compile 'com.google.code.findbugs:jsr305:2.0.1'

androidTestCompile 'junit:junit:4.12'
androidTestCompile('org.robolectric:robolectric:2.4') {
testCompile 'junit:junit:4.12'
testCompile('org.robolectric:robolectric:2.4') {
exclude module: 'commons-logging'
exclude module: 'httpclient'
}
androidTestCompile 'org.powermock:powermock-api-mockito:1.6.1'
androidTestCompile 'org.powermock:powermock-module-junit4:1.6.1'
testCompile 'org.powermock:powermock-api-mockito:1.6.1'
testCompile 'org.powermock:powermock-module-junit4:1.6.1'
}

apply from: rootProject.file('release.gradle')
Expand Down

0 comments on commit 1ed6348

Please sign in to comment.