Skip to content

Commit

Permalink
feat!: Bump AGP 8.0.2, Gradle 8.3.0, Kotlin 1.8.21, Prod & Test Libs …
Browse files Browse the repository at this point in the history
…to latest
  • Loading branch information
abdallaadelessa committed Sep 13, 2023
1 parent 5028b14 commit 47adaeb
Show file tree
Hide file tree
Showing 16 changed files with 88 additions and 52 deletions.
7 changes: 5 additions & 2 deletions bento-compose/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ ext.projectDescription = 'A library which provides compatability for Jetpack Com
apply from: "$rootDir/publishing.gradle"

android {
namespace 'com.yelp.android.bento.compose'

compileSdkVersion Versions.COMPILE_SDK

defaultConfig {
Expand All @@ -16,8 +18,9 @@ android {
versionName Publishing.VERSION
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
compileOptions {
sourceCompatibility = Versions.SOURCE_COMPATIBILITY
targetCompatibility = Versions.TARGET_COMPATIBILITY
}

buildTypes {
Expand Down
7 changes: 5 additions & 2 deletions bento-sample-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
namespace 'com.yelp.android.bentosampleapp'

compileSdkVersion Versions.COMPILE_SDK

defaultConfig {
Expand All @@ -14,8 +16,9 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
compileOptions {
sourceCompatibility = Versions.SOURCE_COMPATIBILITY
targetCompatibility = Versions.TARGET_COMPATIBILITY
}

buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,14 @@ class MainActivityTest {
val rule: RuleChain = RuleChain.outerRule(beforeRule).around(intentsTestRule)

@Test
fun onData_atPosition2_clickOpensListViewActivity() {
BentoInteraction.onData(anything()).atPosition(6)
.check(ViewAssertions.matches(ViewMatchers.withText("List View")))
.perform(ViewActions.click())

fun onData_atPosition8_clickOpensListViewActivity() {
BentoInteraction.onData(anything()).atPosition(8).perform(ViewActions.click())
Intents.intended(IntentMatchers.hasComponent(ListViewActivity::class.qualifiedName))
}

@Test
fun onData_atPosition0_clickOpensRecyclerViewActivity() {
BentoInteraction.onData(anything()).atPosition(0).perform(ViewActions.click())

fun onData_atPosition2_clickOpensRecyclerViewActivity() {
BentoInteraction.onData(anything()).atPosition(2).perform(ViewActions.click())
Intents.intended(IntentMatchers.hasComponent(RecyclerViewActivity::class.qualifiedName))
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.yelp.android.bentosampleapp

import androidx.recyclerview.widget.RecyclerView
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions
import androidx.test.espresso.assertion.ViewAssertions
import androidx.test.espresso.contrib.RecyclerViewActions
import androidx.test.espresso.intent.rule.IntentsTestRule
import androidx.test.espresso.matcher.ViewMatchers
import androidx.test.espresso.matcher.ViewMatchers.withId
Expand All @@ -24,7 +26,9 @@ class RecyclerViewActivityTest {

@Test
fun withAsyncInflationEnabled_scrollingDownDoesntCrash_andDisplaysItems() {
onView(withId(R.id.recyclerView)).perform(ViewActions.swipeUp())
onView(withId(R.id.recyclerView)).perform(
RecyclerViewActions.scrollToPosition<RecyclerView.ViewHolder>(40)
)
onView(ViewMatchers.withText("List element 20"))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.viewpager.widget.ViewPager
import com.google.android.material.tabs.TabLayout
import com.yelp.android.bento.R
import com.yelp.android.bento.componentcontrollers.TabViewPagerComponentController
import com.yelp.android.bentosampleapp.components.LabeledComponent

Expand Down
7 changes: 5 additions & 2 deletions bento-testing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ ext.projectDescription = 'A library for testing Android user interfaces created
apply from: "$rootDir/publishing.gradle"

android {
namespace 'com.yelp.android.bento.test'

compileSdkVersion Versions.COMPILE_SDK

defaultConfig {
Expand All @@ -16,8 +18,9 @@ android {
versionName Publishing.VERSION
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
compileOptions {
sourceCompatibility = Versions.SOURCE_COMPATIBILITY
targetCompatibility = Versions.TARGET_COMPATIBILITY
}

buildTypes {
Expand Down
10 changes: 7 additions & 3 deletions bento/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ ext.projectDescription = 'A framework for building modularized Android user inte
apply from: "$rootDir/publishing.gradle"

android {
namespace 'com.yelp.android.bento'

compileSdkVersion Versions.COMPILE_SDK

defaultConfig {
Expand All @@ -18,8 +20,9 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
compileOptions {
sourceCompatibility = Versions.SOURCE_COMPATIBILITY
targetCompatibility = Versions.TARGET_COMPATIBILITY
}

buildTypes {
Expand All @@ -39,7 +42,8 @@ android {
}

task androidSourcesJar(type: Jar) {
classifier = 'sources'
archiveClassifier.convention('sources');
archiveClassifier.set('sources');
from android.sourceSets.main.java.sourceFiles
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.yelp.android.bento.components

import androidx.recyclerview.widget.GridLayoutManager.SpanSizeLookup
import com.nhaarman.mockitokotlin2.never
import com.nhaarman.mockitokotlin2.spy
import com.nhaarman.mockitokotlin2.verify
import org.mockito.kotlin.never
import org.mockito.kotlin.spy
import org.mockito.kotlin.verify
import com.yelp.android.bento.core.TestComponentViewHolder
import org.junit.Assert.assertEquals
import org.junit.Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import android.content.Context
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.test.core.app.ApplicationProvider
import com.nhaarman.mockitokotlin2.doReturn
import com.nhaarman.mockitokotlin2.spy
import com.nhaarman.mockitokotlin2.whenever
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.spy
import org.mockito.kotlin.whenever
import junit.framework.Assert.assertNotNull
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
Expand Down
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
Expand All @@ -19,6 +20,11 @@ subprojects {
google()
mavenCentral()
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
}
}
}

// If you want to update the Gradle version, change this number and then run `./gradlew wrapper`.
Expand Down
40 changes: 22 additions & 18 deletions buildSrc/src/main/java/com/yelp/gradle/bento/GlobalDependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,37 @@ object Publishing {
}

object Versions {
const val COMPILE_SDK = 33
const val COMPILE_SDK = 34
const val TARGET_SDK = 33
const val MIN_SDK = 21

// Java
const val SOURCE_COMPATIBILITY = 11
const val TARGET_COMPATIBILITY = 11

// In alphabetical order.
const val APACHE_COMMONS = "3.4"
const val ANDROID_GRADLE = "7.4.2"
const val ANDROID_X_APP_COMPAT = "1.0.0"
const val ANDROID_X_CONSTRAINT_LAYOUT = "1.1.2"
const val APACHE_COMMONS = "3.7"
const val ANDROID_GRADLE = "8.0.2"
const val ANDROID_X_APP_COMPAT = "1.3.1"
const val ANDROID_X_CONSTRAINT_LAYOUT = "2.0.1"
const val ANDROID_X_CORE_CTX = "1.4.0"
const val ANDROID_X_LIFECYCLE = "2.3.1"
const val ANDROID_X_MATERIAL = "1.0.0"
const val ANDROID_X_LIFECYCLE = "2.6.2"
const val ANDROID_X_MATERIAL = "1.3.0"
const val ANDROID_X_RECYCLER_VIEW = "1.3.0"
const val ANDROID_X_TEST = "1.1.0"
const val ANDROID_X_TEST = "1.4.0"
const val ANDROID_X_VIEW_PAGER2 = "1.0.0"
const val COMPOSE = "1.4.0"
const val COMPOSE_KOTLIN_COMPILER = "1.4.4"
const val COROUTINES = "1.4.0"
const val ESPRESSO = "3.1.0"
const val GRADLE = "7.5.1"
const val COMPOSE = "1.5.0"
const val COMPOSE_KOTLIN_COMPILER = "1.4.7"
const val COROUTINES = "1.5.1"
const val ESPRESSO = "3.5.0"
const val GRADLE = "8.3.0"
const val GUAVA = "28.1-android"
const val JUNIT = "4.12"
const val KOTLIN = "1.8.10"
const val KOTLIN = "1.8.21"
const val MAVEN_SETTINGS = "0.5"
const val MOCKITO = "3.11.2"
const val MOCKITO_KOTLIN = "2.1.0"
const val ROBOLECTRIC = "4.7.3"
const val MOCKITO = "5.1.1"
const val MOCKITO_KOTLIN = "5.0.0"
const val ROBOLECTRIC = "4.9.2"
const val RX_JAVA_3 = "3.0.7"
const val SUPPORT_TEST = "1.0.2"
}
Expand Down Expand Up @@ -80,7 +84,7 @@ object TestLibs {
const val ESPRESSO_INTENTS = "androidx.test.espresso:espresso-intents:${Versions.ESPRESSO}"
const val JUNIT = "junit:junit:${Versions.JUNIT}"
const val MOCKITO = "org.mockito:mockito-core:${Versions.MOCKITO}"
const val MOCKITO_KOTLIN = "com.nhaarman.mockitokotlin2:mockito-kotlin:${Versions.MOCKITO_KOTLIN}"
const val MOCKITO_KOTLIN = "org.mockito.kotlin:mockito-kotlin:${Versions.MOCKITO_KOTLIN}"
const val ROBOLECTRIC = "org.robolectric:robolectric:${Versions.ROBOLECTRIC}"
const val SUPPORT_TEST_RULES = "androidx.test:rules:${Versions.ANDROID_X_TEST}"
const val SUPPORT_TEST_RUNNER = "androidx.test:runner:${Versions.ANDROID_X_TEST}"
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
25 changes: 17 additions & 8 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,11 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,22 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,6 +198,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand Down
2 changes: 1 addition & 1 deletion publishing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ afterEvaluate {
publishing {
publications {
release(MavenPublication) {
from components.release
from components.getByName('release')
groupId = Publishing.GROUP
version = Publishing.VERSION

Expand Down

0 comments on commit 47adaeb

Please sign in to comment.