Skip to content

Commit

Permalink
Merge pull request #98 from abdallaadelessa/abdullaessa/bump-versions
Browse files Browse the repository at this point in the history
Bump AGP 8.0.2, Gradle 8.3, Kotlin 1.8.21, Prod & Test Libs to latest
  • Loading branch information
martinpdd8 authored Sep 13, 2023
2 parents 6a4b165 + ea8563a commit abaf9db
Show file tree
Hide file tree
Showing 18 changed files with 116 additions and 57 deletions.
29 changes: 25 additions & 4 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ jobs:
runs-on: [ubuntu-latest]
name: Run checks
steps:
- name: Install Java 17
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Cache Gradle Folders
uses: actions/cache@v2
with:
Expand All @@ -24,14 +29,21 @@ jobs:
key: cache-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
cache-gradle-
- name: Delete Maven Settings file
run: rm ~/.m2/settings.xml
- name: Run check
run: ./gradlew check
assemble:
runs-on: [ubuntu-latest]
name: Assemble the project
steps:
- name: Install Java 17
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Cache Gradle Folders
uses: actions/cache@v2
with:
Expand All @@ -41,14 +53,21 @@ jobs:
key: cache-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
cache-gradle-
- name: Delete Maven Settings file
run: rm ~/.m2/settings.xml
- name: Run assembleDebug
run: ./gradlew assembleDebug
run: ./gradlew assembleDebug --stacktrace --scan
publishToMavenLocal:
runs-on: [ubuntu-latest]
name: Publish to Maven local
steps:
- name: Install Java 17
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Cache Gradle Folders
uses: actions/cache@v2
with:
Expand All @@ -58,5 +77,7 @@ jobs:
key: cache-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
cache-gradle-
- name: Delete Maven Settings file
run: rm ~/.m2/settings.xml
- name: Run publishToMavenLocal
run: ./gradlew publishToMavenLocal
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ import com.yelp.android.bentosampleapp.databinding.ActivityToggleScrollInRecycle

class ToggleScrollInRecyclerViewActivity : AppCompatActivity() {
private lateinit var binding: ActivityToggleScrollInRecyclerViewBinding

private val componentController by lazy {
RecyclerViewComponentController(binding.recyclerView)
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_toggle_scroll_in_recycler_view)
binding = ActivityToggleScrollInRecyclerViewBinding.inflate(layoutInflater)
.apply { setContentView(root) }

componentController.addComponent(CarouselComponent().apply {
(1..40).forEach {
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
Loading

0 comments on commit abaf9db

Please sign in to comment.