Skip to content

Commit

Permalink
Gradle: Use Java 11, Android Gradle Plugin 8.0.2 & upgrade minSdk to …
Browse files Browse the repository at this point in the history
…21 (#128)
  • Loading branch information
vanniktech authored Jul 2, 2023
1 parent 901b055 commit 049c2e0
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

strategy:
matrix:
java_version: [11]
java_version: [17]

steps:
- name: Checkout
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Install JDK 11
- name: Install JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
java-version: 17

- name: Setup gradle
uses: gradle/gradle-build-action@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Install JDK 11
- name: Install JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
java-version: 17

- name: Setup gradle
uses: gradle/gradle-build-action@v2
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ buildscript {
dependencies {
classpath 'com.vanniktech:gradle-code-quality-tools-plugin:0.22.0'

classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'com.android.tools.build:gradle:8.0.2'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.25.3'
classpath 'app.cash.licensee:licensee-gradle-plugin:1.7.0'
}
Expand Down Expand Up @@ -58,7 +58,7 @@ subprojects {
}

ext {
minSdkVersion = 15
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
}
16 changes: 11 additions & 5 deletions espresso-core-utils/build.gradle
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
plugins {
id("app.cash.licensee")
id("com.android.library")
}

apply plugin: 'com.android.library'

licensee {
allow("Apache-2.0")
allow("EPL-1.0")
allow("BSD-2-Clause")
}

android {
compileSdkVersion rootProject.ext.compileSdkVersion as int
namespace "com.vanniktech.espresso.core.utils"

compileSdk rootProject.ext.compileSdkVersion as int

defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion as int
targetSdkVersion rootProject.ext.targetSdkVersion // Needed for Integration Tests.
minSdk rootProject.ext.minSdkVersion as int
targetSdk rootProject.ext.targetSdkVersion // Needed for Integration Tests.

testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ private void setDrawable(@DrawableRes final int drawable) throws Throwable {
});
}

// Has to be package private because of https://github.com/pmd/pmd/issues/613.
void setVisibility(final int visibility) throws Throwable {
activityTestRule.runOnUiThread(new Runnable() {
@Override public void run() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.vanniktech.espresso.core.utils;

import android.annotation.TargetApi;
import androidx.annotation.DrawableRes;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.rule.ActivityTestRule;
Expand All @@ -11,7 +10,6 @@
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;

import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
Expand All @@ -33,7 +31,7 @@
import static com.vanniktech.espresso.core.utils.TextViewDrawableMatcher.withTextViewDrawableRight;
import static com.vanniktech.espresso.core.utils.TextViewDrawableMatcher.withTextViewDrawableTop;

@RunWith(AndroidJUnit4.class) @TargetApi(JELLY_BEAN_MR1) @SuppressWarnings("PMD.GodClass") public final class TextViewDrawableMatcherTest {
@RunWith(AndroidJUnit4.class) public final class TextViewDrawableMatcherTest {
@Rule public final ExpectedException expectedException = ExpectedException.none();

@Rule public final ActivityTestRule<TextViewDrawableMatcherActivity> activityTestRule = new ActivityTestRule<>(TextViewDrawableMatcherActivity.class);
Expand Down
2 changes: 0 additions & 2 deletions espresso-core-utils/src/main/AndroidManifest.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public final class AttributeMatcher extends BoundedMatcher<View, TextView> {
* <code>onView(withId(R.id.view)).check(matches(withColorAccentRes(R.color.green)));</code>
*/
@CheckResult public static AttributeMatcher withColorAccentRes(@ColorRes final int colorRes) {
return new AttributeMatcher(R.attr.colorAccent, "colorAccent", ColorChecker.fromRes(colorRes));
return new AttributeMatcher(android.R.attr.colorAccent, "colorAccent", ColorChecker.fromRes(colorRes));
}

/**
Expand All @@ -61,7 +61,7 @@ public final class AttributeMatcher extends BoundedMatcher<View, TextView> {
* <code>onView(withId(R.id.view)).check(matches(withColorAccent(GREEN)));</code>
*/
@CheckResult public static AttributeMatcher withColorAccent(@ColorInt final int color) {
return new AttributeMatcher(R.attr.colorAccent, "colorAccent", ColorChecker.from(color));
return new AttributeMatcher(android.R.attr.colorAccent, "colorAccent", ColorChecker.from(color));
}

/**
Expand All @@ -81,7 +81,7 @@ public final class AttributeMatcher extends BoundedMatcher<View, TextView> {
* <code>onView(withId(R.id.view)).check(matches(withColorButtonNormalRes(R.color.red)));</code>
*/
@CheckResult public static AttributeMatcher withColorButtonNormalRes(@ColorRes final int colorRes) {
return new AttributeMatcher(R.attr.colorButtonNormal, "colorButtonNormal", ColorChecker.fromRes(colorRes));
return new AttributeMatcher(android.R.attr.colorButtonNormal, "colorButtonNormal", ColorChecker.fromRes(colorRes));
}

/**
Expand All @@ -91,7 +91,7 @@ public final class AttributeMatcher extends BoundedMatcher<View, TextView> {
* <code>onView(withId(R.id.view)).check(matches(withColorButtonNormal(RED)));</code>
*/
@CheckResult public static AttributeMatcher withColorButtonNormal(@ColorInt final int color) {
return new AttributeMatcher(R.attr.colorButtonNormal, "colorButtonNormal", ColorChecker.from(color));
return new AttributeMatcher(android.R.attr.colorButtonNormal, "colorButtonNormal", ColorChecker.from(color));
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
package com.vanniktech.espresso.core.utils;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.CheckResult;
import androidx.annotation.DrawableRes;
import androidx.test.espresso.matcher.BoundedMatcher;
import android.view.View;
import android.widget.TextView;
import org.hamcrest.Description;

import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;
import static com.vanniktech.espresso.core.utils.TextViewDrawableMatcher.Type.DRAWABLE_BOTTOM;
import static com.vanniktech.espresso.core.utils.TextViewDrawableMatcher.Type.DRAWABLE_LEFT;
import static com.vanniktech.espresso.core.utils.TextViewDrawableMatcher.Type.DRAWABLE_RELATIVE_BOTTOM;
Expand Down Expand Up @@ -53,7 +51,7 @@ public final class TextViewDrawableMatcher extends BoundedMatcher<View, TextView
* <p>Example usage:</p>
* <code>onView(withId(R.id.view)).check(matches(withTextViewDrawableRelativeLeft(R.color.blue)));</code>
*/
@CheckResult @TargetApi(JELLY_BEAN_MR1) public static TextViewDrawableMatcher withTextViewDrawableRelativeLeft(@DrawableRes final int resourceId) {
@CheckResult public static TextViewDrawableMatcher withTextViewDrawableRelativeLeft(@DrawableRes final int resourceId) {
return new TextViewDrawableMatcher(resourceId, DRAWABLE_RELATIVE_LEFT);
}

Expand All @@ -63,7 +61,7 @@ public final class TextViewDrawableMatcher extends BoundedMatcher<View, TextView
* <p>Example usage:</p>
* <code>onView(withId(R.id.view)).check(matches(withNoTextViewDrawableRelativeLeft()));</code>
*/
@CheckResult @TargetApi(JELLY_BEAN_MR1) public static TextViewDrawableMatcher withNoTextViewDrawableRelativeLeft() {
@CheckResult public static TextViewDrawableMatcher withNoTextViewDrawableRelativeLeft() {
return new TextViewDrawableMatcher(NO_DRAWABLE, DRAWABLE_RELATIVE_LEFT);
}

Expand Down Expand Up @@ -93,7 +91,7 @@ public final class TextViewDrawableMatcher extends BoundedMatcher<View, TextView
* <p>Example usage:</p>
* <code>onView(withId(R.id.view)).check(matches(withTextViewDrawableRelativeTop(R.color.blue)));</code>
*/
@CheckResult @TargetApi(JELLY_BEAN_MR1) public static TextViewDrawableMatcher withTextViewDrawableRelativeTop(@DrawableRes final int resourceId) {
@CheckResult public static TextViewDrawableMatcher withTextViewDrawableRelativeTop(@DrawableRes final int resourceId) {
return new TextViewDrawableMatcher(resourceId, DRAWABLE_RELATIVE_TOP);
}

Expand All @@ -103,7 +101,7 @@ public final class TextViewDrawableMatcher extends BoundedMatcher<View, TextView
* <p>Example usage:</p>
* <code>onView(withId(R.id.view)).check(matches(withNoTextViewDrawableRelativeTop()));</code>
*/
@CheckResult @TargetApi(JELLY_BEAN_MR1) public static TextViewDrawableMatcher withNoTextViewDrawableRelativeTop() {
@CheckResult public static TextViewDrawableMatcher withNoTextViewDrawableRelativeTop() {
return new TextViewDrawableMatcher(NO_DRAWABLE, DRAWABLE_RELATIVE_TOP);
}

Expand Down Expand Up @@ -133,7 +131,7 @@ public final class TextViewDrawableMatcher extends BoundedMatcher<View, TextView
* <p>Example usage:</p>
* <code>onView(withId(R.id.view)).check(matches(withTextViewDrawableRelativeRight(R.color.blue)));</code>
*/
@CheckResult @TargetApi(JELLY_BEAN_MR1) public static TextViewDrawableMatcher withTextViewDrawableRelativeRight(@DrawableRes final int resourceId) {
@CheckResult public static TextViewDrawableMatcher withTextViewDrawableRelativeRight(@DrawableRes final int resourceId) {
return new TextViewDrawableMatcher(resourceId, DRAWABLE_RELATIVE_RIGHT);
}

Expand All @@ -143,7 +141,7 @@ public final class TextViewDrawableMatcher extends BoundedMatcher<View, TextView
* <p>Example usage:</p>
* <code>onView(withId(R.id.view)).check(matches(withNoTextViewDrawableRelativeRight()));</code>
*/
@CheckResult @TargetApi(JELLY_BEAN_MR1) public static TextViewDrawableMatcher withNoTextViewDrawableRelativeRight() {
@CheckResult public static TextViewDrawableMatcher withNoTextViewDrawableRelativeRight() {
return new TextViewDrawableMatcher(NO_DRAWABLE, DRAWABLE_RELATIVE_RIGHT);
}

Expand Down Expand Up @@ -173,7 +171,7 @@ public final class TextViewDrawableMatcher extends BoundedMatcher<View, TextView
* <p>Example usage:</p>
* <code>onView(withId(R.id.view)).check(matches(withTextViewDrawableRelativeBottom(R.color.blue)));</code>
*/
@CheckResult @TargetApi(JELLY_BEAN_MR1) public static TextViewDrawableMatcher withTextViewDrawableRelativeBottom(@DrawableRes final int resourceId) {
@CheckResult public static TextViewDrawableMatcher withTextViewDrawableRelativeBottom(@DrawableRes final int resourceId) {
return new TextViewDrawableMatcher(resourceId, DRAWABLE_RELATIVE_BOTTOM);
}

Expand All @@ -183,7 +181,7 @@ public final class TextViewDrawableMatcher extends BoundedMatcher<View, TextView
* <p>Example usage:</p>
* <code>onView(withId(R.id.view)).check(matches(withNoTextViewDrawableRelativeBottom()));</code>
*/
@CheckResult @TargetApi(JELLY_BEAN_MR1) public static TextViewDrawableMatcher withNoTextViewDrawableRelativeBottom() {
@CheckResult public static TextViewDrawableMatcher withNoTextViewDrawableRelativeBottom() {
return new TextViewDrawableMatcher(NO_DRAWABLE, DRAWABLE_RELATIVE_BOTTOM);
}

Expand Down

0 comments on commit 049c2e0

Please sign in to comment.