diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 00c225f..743d556 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - java_version: [11] + java_version: [17] steps: - name: Checkout diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 86faf80..b19e042 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -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 diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml index 63deca4..900eb8f 100644 --- a/.github/workflows/publish-snapshot.yml +++ b/.github/workflows/publish-snapshot.yml @@ -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 diff --git a/build.gradle b/build.gradle index 3a4bc3d..7b09cf3 100644 --- a/build.gradle +++ b/build.gradle @@ -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' } @@ -58,7 +58,7 @@ subprojects { } ext { - minSdkVersion = 15 + minSdkVersion = 21 compileSdkVersion = 33 targetSdkVersion = 33 } diff --git a/espresso-core-utils/build.gradle b/espresso-core-utils/build.gradle index 4fdaebc..ed8b818 100644 --- a/espresso-core-utils/build.gradle +++ b/espresso-core-utils/build.gradle @@ -1,9 +1,8 @@ plugins { id("app.cash.licensee") + id("com.android.library") } -apply plugin: 'com.android.library' - licensee { allow("Apache-2.0") allow("EPL-1.0") @@ -11,14 +10,21 @@ licensee { } 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 { diff --git a/espresso-core-utils/src/androidTest/java/com/vanniktech/espresso/core/utils/DrawableMatcherTest.java b/espresso-core-utils/src/androidTest/java/com/vanniktech/espresso/core/utils/DrawableMatcherTest.java index 19ab380..891bf28 100644 --- a/espresso-core-utils/src/androidTest/java/com/vanniktech/espresso/core/utils/DrawableMatcherTest.java +++ b/espresso-core-utils/src/androidTest/java/com/vanniktech/espresso/core/utils/DrawableMatcherTest.java @@ -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() { diff --git a/espresso-core-utils/src/androidTest/java/com/vanniktech/espresso/core/utils/TextViewDrawableMatcherTest.java b/espresso-core-utils/src/androidTest/java/com/vanniktech/espresso/core/utils/TextViewDrawableMatcherTest.java index c88f9e7..948590e 100644 --- a/espresso-core-utils/src/androidTest/java/com/vanniktech/espresso/core/utils/TextViewDrawableMatcherTest.java +++ b/espresso-core-utils/src/androidTest/java/com/vanniktech/espresso/core/utils/TextViewDrawableMatcherTest.java @@ -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; @@ -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; @@ -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 activityTestRule = new ActivityTestRule<>(TextViewDrawableMatcherActivity.class); diff --git a/espresso-core-utils/src/main/AndroidManifest.xml b/espresso-core-utils/src/main/AndroidManifest.xml deleted file mode 100644 index c88ac24..0000000 --- a/espresso-core-utils/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/AttributeMatcher.java b/espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/AttributeMatcher.java index d629c97..8d9a749 100644 --- a/espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/AttributeMatcher.java +++ b/espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/AttributeMatcher.java @@ -51,7 +51,7 @@ public final class AttributeMatcher extends BoundedMatcher { * onView(withId(R.id.view)).check(matches(withColorAccentRes(R.color.green))); */ @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)); } /** @@ -61,7 +61,7 @@ public final class AttributeMatcher extends BoundedMatcher { * onView(withId(R.id.view)).check(matches(withColorAccent(GREEN))); */ @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)); } /** @@ -81,7 +81,7 @@ public final class AttributeMatcher extends BoundedMatcher { * onView(withId(R.id.view)).check(matches(withColorButtonNormalRes(R.color.red))); */ @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)); } /** @@ -91,7 +91,7 @@ public final class AttributeMatcher extends BoundedMatcher { * onView(withId(R.id.view)).check(matches(withColorButtonNormal(RED))); */ @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)); } /** diff --git a/espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/TextViewDrawableMatcher.java b/espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/TextViewDrawableMatcher.java index 8a93d9a..1269717 100644 --- a/espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/TextViewDrawableMatcher.java +++ b/espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/TextViewDrawableMatcher.java @@ -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; @@ -53,7 +51,7 @@ public final class TextViewDrawableMatcher extends BoundedMatcherExample usage:

* onView(withId(R.id.view)).check(matches(withTextViewDrawableRelativeLeft(R.color.blue))); */ - @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); } @@ -63,7 +61,7 @@ public final class TextViewDrawableMatcher extends BoundedMatcherExample usage:

* onView(withId(R.id.view)).check(matches(withNoTextViewDrawableRelativeLeft())); */ - @CheckResult @TargetApi(JELLY_BEAN_MR1) public static TextViewDrawableMatcher withNoTextViewDrawableRelativeLeft() { + @CheckResult public static TextViewDrawableMatcher withNoTextViewDrawableRelativeLeft() { return new TextViewDrawableMatcher(NO_DRAWABLE, DRAWABLE_RELATIVE_LEFT); } @@ -93,7 +91,7 @@ public final class TextViewDrawableMatcher extends BoundedMatcherExample usage:

* onView(withId(R.id.view)).check(matches(withTextViewDrawableRelativeTop(R.color.blue))); */ - @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); } @@ -103,7 +101,7 @@ public final class TextViewDrawableMatcher extends BoundedMatcherExample usage:

* onView(withId(R.id.view)).check(matches(withNoTextViewDrawableRelativeTop())); */ - @CheckResult @TargetApi(JELLY_BEAN_MR1) public static TextViewDrawableMatcher withNoTextViewDrawableRelativeTop() { + @CheckResult public static TextViewDrawableMatcher withNoTextViewDrawableRelativeTop() { return new TextViewDrawableMatcher(NO_DRAWABLE, DRAWABLE_RELATIVE_TOP); } @@ -133,7 +131,7 @@ public final class TextViewDrawableMatcher extends BoundedMatcherExample usage:

* onView(withId(R.id.view)).check(matches(withTextViewDrawableRelativeRight(R.color.blue))); */ - @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); } @@ -143,7 +141,7 @@ public final class TextViewDrawableMatcher extends BoundedMatcherExample usage:

* onView(withId(R.id.view)).check(matches(withNoTextViewDrawableRelativeRight())); */ - @CheckResult @TargetApi(JELLY_BEAN_MR1) public static TextViewDrawableMatcher withNoTextViewDrawableRelativeRight() { + @CheckResult public static TextViewDrawableMatcher withNoTextViewDrawableRelativeRight() { return new TextViewDrawableMatcher(NO_DRAWABLE, DRAWABLE_RELATIVE_RIGHT); } @@ -173,7 +171,7 @@ public final class TextViewDrawableMatcher extends BoundedMatcherExample usage:

* onView(withId(R.id.view)).check(matches(withTextViewDrawableRelativeBottom(R.color.blue))); */ - @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); } @@ -183,7 +181,7 @@ public final class TextViewDrawableMatcher extends BoundedMatcherExample usage:

* onView(withId(R.id.view)).check(matches(withNoTextViewDrawableRelativeBottom())); */ - @CheckResult @TargetApi(JELLY_BEAN_MR1) public static TextViewDrawableMatcher withNoTextViewDrawableRelativeBottom() { + @CheckResult public static TextViewDrawableMatcher withNoTextViewDrawableRelativeBottom() { return new TextViewDrawableMatcher(NO_DRAWABLE, DRAWABLE_RELATIVE_BOTTOM); }