Skip to content

Commit

Permalink
Espresso 3 (#89)
Browse files Browse the repository at this point in the history
* Gradle version updates

* Gradle plugin 3.1.0-alpha06

* Espresso 3

* Static analysis fixes

* Workaround for Travis problems with Android 27

* ProGuard fixes
  • Loading branch information
stoyicker authored Jan 5, 2018
1 parent aa4cac2 commit 5dcf253
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 50 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ android:
components:
- tools
- platform-tools
- android-26
- build-tools-26.0.1
- android-27
- build-tools-27.0.3
- extra-android-m2repository
- extra-google-m2repository
before_install:
- yes | sdkmanager "platforms;android-27"
branches:
except:
- "/^[0-9]/"
Expand Down
18 changes: 9 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android {
buildToolsVersion rootProject.ext.androidBuildToolsVersion
signingConfigs {
release {
storeFile new File("dummy12.keystore")
storeFile new File(rootProject.projectDir.absolutePath + File.separator + "dummy12.keystore")
storePassword "dummy12"
keyAlias "dummy12"
keyPassword "dummy12"
Expand Down Expand Up @@ -63,19 +63,19 @@ repositories {
maven { url "https://maven.google.com" }
}
dependencies {
compile project(':data')
compile project(':domain')
compile project(':util-android')
androidTestCompile project(':util-android-test')
implementation project(':data')
implementation project(':domain')
implementation project(':util-android')
androidTestImplementation project(':util-android-test')
rootProject.ext.androidTestCompileAppDependencies.forEach {
androidTestCompile(it) {
androidTestImplementation(it) {
exclude group: 'com.google.code.findbugs'
exclude module: 'support-annotations'
}
}
kapt rootProject.ext.annotationProcessorAppDependencies
kaptAndroidTest rootProject.ext.annotationProcessorAndroidTestAppDependencies
compile rootProject.ext.compileDependencies
compile rootProject.ext.compileAppDependencies
testCompile rootProject.ext.testCompileDependencies
implementation rootProject.ext.compileDependencies
implementation rootProject.ext.compileAppDependencies
testImplementation rootProject.ext.testCompileDependencies
}
3 changes: 3 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@
-dontwarn com.google.errorprone.annotations.*
-dontwarn com.squareup.okhttp.**
-keep class android.support.v7.widget.SearchView { *; }
-dontnote io.reactivex.**
-dontnote org.reactivestreams.**
-dontwarn io.reactivex.internal.**
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,15 @@ import android.app.Instrumentation
import android.support.test.InstrumentationRegistry
import android.support.test.espresso.Espresso
import android.support.test.espresso.Espresso.onView
import android.support.test.espresso.IdlingRegistry
import android.support.test.espresso.NoActivityResumedException
import android.support.test.espresso.action.ViewActions.click
import android.support.test.espresso.assertion.ViewAssertions.matches
import android.support.test.espresso.intent.Intents
import android.support.test.espresso.intent.Intents.intended
import android.support.test.espresso.intent.Intents.intending
import android.support.test.espresso.intent.matcher.IntentMatchers.anyIntent
import android.support.test.espresso.intent.matcher.IntentMatchers.hasComponent
import android.support.test.espresso.intent.matcher.IntentMatchers.hasExtra
import android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom
import android.support.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed
import android.support.test.espresso.matcher.ViewMatchers.isDisplayed
import android.support.test.espresso.matcher.ViewMatchers.withId
import android.support.test.espresso.matcher.ViewMatchers.withText
import android.support.test.espresso.intent.matcher.IntentMatchers.*
import android.support.test.espresso.matcher.ViewMatchers.*
import android.support.test.rule.ActivityTestRule
import android.support.v7.widget.Toolbar
import android.view.View
Expand Down Expand Up @@ -51,12 +46,12 @@ internal class TopGamingActivityInstrumentation {
TopGamingAllTimePostsActivity::class.java, false, false) {
override fun beforeActivityLaunched() {
IDLING_RESOURCE = BinaryIdlingResource("load")
Espresso.registerIdlingResources(IDLING_RESOURCE)
IdlingRegistry.getInstance().register(IDLING_RESOURCE)
}

override fun afterActivityFinished() {
super.afterActivityFinished()
Espresso.unregisterIdlingResources(IDLING_RESOURCE)
IdlingRegistry.getInstance().unregister(IDLING_RESOURCE)
}
}
@JvmField
Expand Down Expand Up @@ -153,8 +148,8 @@ internal class TopGamingActivityInstrumentation {
/**
* Launches the activity.
*/
private fun launchActivity() = activityTestRule.launchActivity(
TopGamingAllTimePostsActivity.getCallingIntent(InstrumentationRegistry.getContext()))
private fun launchActivity() = activityTestRule.launchActivity(TopGamingAllTimePostsActivity
.getCallingIntent(InstrumentationRegistry.getTargetContext()))

companion object {
private lateinit var IDLING_RESOURCE: BinaryIdlingResource
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/kotlin/app/MainApplication.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package app

import android.annotation.SuppressLint
import android.app.Application
import android.support.v7.widget.RecyclerView
import android.view.View
Expand All @@ -17,6 +18,7 @@ import domain.Domain
/**
* Custom application.
*/
@SuppressLint("Registered") // Registered via buildType-specific manifests
internal open class MainApplication : Application() {
override fun onCreate() {
super.onCreate()
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/kotlin/app/common/OutScalingImageView.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package app.common

import android.content.Context
import android.support.v7.widget.AppCompatImageView
import android.util.AttributeSet
import android.view.View
import android.widget.ImageView


/**
Expand All @@ -12,7 +12,7 @@ import android.widget.ImageView
* ScalingImageView</>
*/
internal class OutScalingImageView(context: Context, attrs: AttributeSet?)
: ImageView(context, attrs) {
: AppCompatImageView(context, attrs) {
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
var localHeightMeasureSpec = heightMeasureSpec
val mDrawable = drawable
Expand Down
9 changes: 5 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ apply from: 'buildsystem/dependencies.gradle'

buildscript {
repositories {
google()
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
}
final def androidPluginVersion = "2.3.2"
final def androidPluginVersion = "3.1.0-alpha06"
final def kotlinPluginVersion = rootProject.ext.kotlinVersion = "1.1.4"
final def dokkaPluginVersion = "0.9.15"
final def ktLintGradlePluginVersion = "1.3.0"
Expand All @@ -27,10 +28,10 @@ final def inducedVersion = System.getenv("ARTIFACT_VERSION")
final def staticAnalysisReportFolderTarget = project.rootDir.absolutePath + "/staticAnalysisReport"

rootProject.ext {
androidCompileSdkVersion = 26
androidCompileSdkVersion = 27
androidMinSdkVersion = 14
androidTargetSdkVersion = 26
androidBuildToolsVersion = '26.0.1'
androidTargetSdkVersion = 27
androidBuildToolsVersion = '27.0.3'
androidVersionCode = inducedVersion != null ? Integer.parseInt(inducedVersion) : 1 // Depending on the git method locally causes IDE issues
androidVersionName = String.valueOf(androidVersionCode)
androidTestInstrumentationRunner = "app.AndroidTestApplicationAndroidJUnitRunner"
Expand Down
4 changes: 2 additions & 2 deletions buildsystem/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
final def daggerVersion = "2.11"
final def espressoVersion = "2.2.2"
final def espressoVersion = "3.0.1"
final def jsr250Version = "1.0"
final def junitPlatformRunnerVersion = "1.0.0-M3"
final def jUnitVersion = "4.12"
Expand All @@ -13,7 +13,7 @@ final def rxAndroidVersion = "2.0.1"
final def rxJavaVersion = "2.1.3"
final def spekVersion = "1.1.0-beta2"
final def storeVersion = "3.0.0-beta"
final def supportVersion = "26.0.1"
final def supportVersion = "27.0.2"

ext {
compileDependencies = [
Expand Down
2 changes: 1 addition & 1 deletion ci/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ uploadReleaseToGitHub() {
# Build the apk
./gradlew assembleRelease
# Copy it out of its cave
cp app/build/outputs/apk/app-release.apk .
cp app/build/outputs/apk/release/app-release.apk .

# Attach the artifact
curl -D - \
Expand Down
12 changes: 6 additions & 6 deletions data/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ repositories {
}

dependencies {
compile project(':domain')
compile project(':util-android')
implementation project(':domain')
implementation project(':util-android')
kapt rootProject.ext.annotationProcessorDataDependencies
kaptTest rootProject.ext.annotationProcessorTestDataDependencies
provided rootProject.ext.providedDataDependencies
compile rootProject.ext.compileDependencies
compileOnly rootProject.ext.providedDataDependencies
implementation rootProject.ext.compileDependencies
rootProject.ext.compileDataDependencies.forEach {
compile(it) {
implementation(it) {
exclude group: 'io.reactivex'
}
}
testCompile rootProject.ext.testCompileDependencies
testImplementation rootProject.ext.testCompileDependencies
}
2 changes: 2 additions & 0 deletions data/src/main/kotlin/data/top/TopRequestSource.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ internal class TopRequestSource {
topRequestParameters)
.onErrorResumeNext { store.get(topRequestParameters) })
} else {
// noinspection CheckResult - False positive
Single.just(TopRequestDataContainer.EMPTY)
}

Expand All @@ -53,6 +54,7 @@ internal class TopRequestSource {
if (pageMap[topRequestParameters.page] != NO_MORE_PAGES) {
updatePageMapAndContinue(topRequestParameters.page, store.get(topRequestParameters))
} else {
// noinspection CheckResult - False positive
Single.just(TopRequestDataContainer.EMPTY)
}

Expand Down
6 changes: 3 additions & 3 deletions domain/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repositories {

dependencies {
compileOnly rootProject.ext.compileOnlyDomainDependencies
compile rootProject.ext.compileDependencies
compile rootProject.ext.compileDomainDependencies
testCompile rootProject.ext.testCompileDependencies
implementation rootProject.ext.compileDependencies
implementation rootProject.ext.compileDomainDependencies
testImplementation rootProject.ext.testCompileDependencies
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip
2 changes: 1 addition & 1 deletion hooks/pre-push
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
./gradlew --refresh-dependencies -x :app:validateSigningRelease -x :app:packageRelease clean check assemble test cAT || { exit 1; }
adb uninstall org.jorge.ms.app.debug
adb install app/build/outputs/apk/app-debug.apk
adb install app/build/outputs/apk/debug/app-debug.apk
adb shell monkey -p org.jorge.ms.app.debug -v 500
adb uninstall org.jorge.ms.app.debug
8 changes: 4 additions & 4 deletions util-android-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ repositories {
}

dependencies {
compile rootProject.ext.compileDependencies
compile rootProject.ext.providedUtilAndroidDependencies
implementation rootProject.ext.compileDependencies
compileOnly rootProject.ext.providedUtilAndroidDependencies
rootProject.ext.compileUtilAndroidTestDependencies.forEach {
compile(it) {
api(it) {
exclude group: 'com.google.code.findbugs'
exclude module: 'support-annotations'
}
}
testCompile rootProject.ext.testCompileDependencies
testImplementation rootProject.ext.testCompileDependencies
}
6 changes: 3 additions & 3 deletions util-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ repositories {
}

dependencies {
compile rootProject.ext.compileDependencies
compile rootProject.ext.providedUtilAndroidDependencies
testCompile rootProject.ext.testCompileDependencies
implementation rootProject.ext.compileDependencies
compileOnly rootProject.ext.providedUtilAndroidDependencies
testImplementation rootProject.ext.testCompileDependencies
}

0 comments on commit 5dcf253

Please sign in to comment.