Skip to content

Commit

Permalink
Merge pull request #191 from rubensousa/version_catalog
Browse files Browse the repository at this point in the history
Migrate to version catalog
  • Loading branch information
rubensousa authored Mar 14, 2024
2 parents 6fc5405 + 794163e commit 9fc853f
Show file tree
Hide file tree
Showing 13 changed files with 226 additions and 163 deletions.
23 changes: 18 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/actions/setup-gradle@v3

- name: Install Android SDK
uses: malinskiy/action-android/install-sdk@release/0.1.4
uses: malinskiy/action-android/install-sdk@release/0.1.6

- name: Run quality checks
run: ./gradlew --build-cache check --stacktrace
Expand All @@ -42,7 +42,7 @@ jobs:
run: ./gradlew --build-cache assembleRelease

ui_test:
runs-on: macos-12
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
Expand All @@ -55,13 +55,26 @@ jobs:
- name: checkout
uses: actions/checkout@v3

- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17

- name: Gradle cache
uses: gradle/gradle-build-action@v2
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: false

- name: Compile instrumented tests
run: ./gradlew --build-cache assembleDebugAndroidTest
Expand Down
21 changes: 17 additions & 4 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/actions/setup-gradle@v3

- name: Install Android SDK
uses: malinskiy/action-android/install-sdk@release/0.1.4
uses: malinskiy/action-android/install-sdk@release/0.1.6

- name: Run quality checks
run: ./gradlew --build-cache check --stacktrace
Expand All @@ -56,8 +56,21 @@ jobs:
distribution: 'zulu'
java-version: 17

- name: Gradle cache
uses: gradle/gradle-build-action@v2
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: false

- name: Compile instrumented tests
run: ./gradlew --build-cache assembleDebugAndroidTest
Expand Down
22 changes: 10 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
buildscript {
apply from: 'versions.gradle'

dependencies {
classpath "org.jacoco:org.jacoco.core:$testVersions.jacoco"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$versions.navigation"
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

plugins {
id 'com.android.application' version '8.2.2' apply false
id 'com.android.library' version '8.2.2' apply false
id 'org.jetbrains.kotlin.android' version '1.9.22' apply false
id 'org.jetbrains.kotlinx.binary-compatibility-validator' version '0.13.0'
alias libs.plugins.android.application apply false
alias libs.plugins.android.library apply false
alias libs.plugins.kotlin.android apply false
alias libs.plugins.kotlin.kover apply false
alias libs.plugins.androidx.navigation.safeargs apply false
id 'org.jetbrains.kotlinx.binary-compatibility-validator' version "0.14.0"
}

apiValidation {
ignoredProjects += ["sample", "dpadrecyclerview-test-fixtures"]
ignoredClasses += "com.rubensousa.dpadrecyclerview.BuildConfig"
}

task clean(type: Delete) {
delete rootProject.buildDir
}
40 changes: 17 additions & 23 deletions dpadrecyclerview-compose/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
}

apply from: "$rootProject.projectDir/gradle/publish.gradle"
Expand Down Expand Up @@ -30,10 +30,6 @@ android {
compose true
}

testOptions {
// execution 'ANDROIDX_TEST_ORCHESTRATOR'
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand All @@ -44,7 +40,7 @@ android {
}

composeOptions {
kotlinCompilerExtensionVersion = "$composeVersions.compiler"
kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get()
}

publishing {
Expand All @@ -57,22 +53,20 @@ android {
}

dependencies {
implementation project(':dpadrecyclerview')
implementation "androidx.appcompat:appcompat:$versions.appcompat"
implementation "androidx.recyclerview:recyclerview:$versions.recyclerview"
implementation "androidx.customview:customview-poolingcontainer:$versions.poolingContainer"
implementation "androidx.compose.runtime:runtime:$composeVersions.runtime"
implementation "androidx.compose.ui:ui:$composeVersions.ui"
api project(':dpadrecyclerview')
implementation libs.androidx.appcompat
implementation libs.androidx.recyclerview
implementation libs.androidx.customview.poolingcontainer
implementation libs.androidx.compose.ui

// Test dependencies
debugImplementation("androidx.compose.ui:ui-test-manifest:$composeVersions.ui")
debugImplementation "androidx.compose.ui:ui-tooling:$composeVersions.ui"
debugImplementation "androidx.compose.ui:ui-tooling-preview:$composeVersions.ui"
debugImplementation "androidx.compose.material3:material3:$composeVersions.material3"
debugImplementation 'androidx.customview:customview:1.1.0'

androidTestImplementation project (':dpadrecyclerview-testing')
androidTestImplementation project (':dpadrecyclerview-test-fixtures')
androidTestImplementation("androidx.compose.ui:ui-test-junit4:$composeVersions.ui")
androidTestUtil "androidx.test.services:test-services:$testVersions.services"
debugImplementation libs.androidx.test.compose.ui.manifest
debugImplementation libs.androidx.compose.ui.tooling
debugImplementation libs.androidx.compose.ui.tooling.preview
debugImplementation libs.androidx.compose.material3
debugImplementation libs.androidx.customview
androidTestImplementation project(':dpadrecyclerview-testing')
androidTestImplementation project(':dpadrecyclerview-test-fixtures')
androidTestImplementation libs.androidx.test.compose.ui.junit4
androidTestUtil libs.androidx.test.services
}
24 changes: 9 additions & 15 deletions dpadrecyclerview-test-fixtures/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
}

apply from: "$rootProject.projectDir/gradle/coverage.gradle"
Expand All @@ -10,17 +10,12 @@ android {
compileSdk versions.compileSdkVersion

defaultConfig {
minSdk 19
minSdk versions.minSdkVersion
targetSdk versions.targetSdkVersion

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}

buildTypes {
release {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand All @@ -32,11 +27,10 @@ android {

dependencies {
implementation project (':dpadrecyclerview')
implementation "androidx.recyclerview:recyclerview:$versions.recyclerview"
implementation "androidx.collection:collection-ktx:1.2.0"
implementation "junit:junit:$testVersions.junit"
implementation "com.google.truth:truth:$testVersions.truth"
api "androidx.test.uiautomator:uiautomator:$testVersions.uiautomator"
api "androidx.test:runner:$testVersions.runner"
testImplementation "com.google.truth:truth:$testVersions.truth"
implementation libs.androidx.recyclerview
implementation libs.androidx.collection
implementation libs.junit
implementation libs.truth
implementation libs.androidx.test.uiautomator
implementation libs.androidx.test.runner
}
38 changes: 16 additions & 22 deletions dpadrecyclerview-testing/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
}

apply from: "$rootProject.projectDir/gradle/publish.gradle"
Expand All @@ -11,7 +11,7 @@ android {
compileSdk versions.compileSdkVersion

defaultConfig {
minSdk 19
minSdk versions.minSdkVersion
targetSdk versions.targetSdkVersion
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments useTestStorageService: 'true'
Expand All @@ -31,10 +31,6 @@ android {
buildConfig false
}

testOptions {
// execution 'ANDROIDX_TEST_ORCHESTRATOR'
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand All @@ -55,20 +51,18 @@ android {

dependencies {
implementation project (':dpadrecyclerview')
debugImplementation "androidx.fragment:fragment-testing-manifest:$versions.fragment"
api "androidx.recyclerview:recyclerview:$versions.recyclerview"
api "androidx.test:runner:$testVersions.runner"
api "androidx.test:core-ktx:$testVersions.core"
api "androidx.test:rules:$testVersions.rules"
api "androidx.test.ext:truth:$testVersions.espressoTruth"
api "androidx.test.ext:junit-ktx:$testVersions.espressoJunit"
api "androidx.test.espresso:espresso-idling-resource:$testVersions.espresso"
api "androidx.test.espresso:espresso-core:$testVersions.espresso"
api "androidx.test.espresso:espresso-contrib:$testVersions.espresso"
api "androidx.test.uiautomator:uiautomator:$testVersions.uiautomator"

//noinspection FragmentGradleConfiguration
androidTestImplementation "androidx.fragment:fragment-testing:$versions.fragment"
debugImplementation libs.androidx.fragment.testing.manifest
api libs.androidx.test.runner
api libs.androidx.test.core.ktx
api libs.androidx.test.rules
api libs.androidx.test.rules
api libs.androidx.test.truth
api libs.androidx.test.junit
api libs.androidx.test.espresso.core
api libs.androidx.test.espresso.idling
api libs.androidx.test.espresso.contrib
api libs.androidx.test.uiautomator
androidTestImplementation libs.androidx.fragment.testing
androidTestImplementation project (':dpadrecyclerview-test-fixtures')
androidTestUtil "androidx.test.services:test-services:$testVersions.services"
androidTestUtil libs.androidx.test.services
}
29 changes: 15 additions & 14 deletions dpadrecyclerview/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
}

apply from: "$rootProject.projectDir/gradle/publish.gradle"
Expand All @@ -11,12 +11,11 @@ android {
compileSdk versions.compileSdkVersion

defaultConfig {
minSdk 19
minSdk versions.minSdkVersion
targetSdk versions.targetSdkVersion
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments useTestStorageService: 'true'
testInstrumentationRunnerArguments listener: 'com.rubensousa.dpadrecyclerview.testfixtures.recording.TestRecordingListener'
multiDexEnabled true
}

buildTypes {
Expand All @@ -34,7 +33,6 @@ android {

testOptions {
unitTests.returnDefaultValues = true
// execution 'ANDROIDX_TEST_ORCHESTRATOR'
}

compileOptions {
Expand All @@ -55,16 +53,19 @@ android {
}

dependencies {
api "androidx.recyclerview:recyclerview:$versions.recyclerview"
implementation "androidx.collection:collection-ktx:$versions.collection"
testImplementation "junit:junit:$testVersions.junit"
testImplementation "com.google.truth:truth:$testVersions.truth"
testImplementation "io.mockk:mockk:$testVersions.mockk"
api libs.androidx.recyclerview
implementation libs.androidx.collection

// Required for dependency resolution
debugImplementation libs.guava
debugImplementation libs.androidx.fragment.testing.manifest
testImplementation libs.junit
testImplementation libs.truth
testImplementation libs.mockk
testImplementation project (':dpadrecyclerview-test-fixtures')
debugImplementation "androidx.fragment:fragment-testing-manifest:$versions.fragment"
//noinspection FragmentGradleConfiguration
androidTestImplementation "androidx.fragment:fragment-testing:$versions.fragment"

androidTestImplementation libs.androidx.fragment.testing
androidTestImplementation project (':dpadrecyclerview-testing')
androidTestImplementation project (':dpadrecyclerview-test-fixtures')
androidTestUtil "androidx.test.services:test-services:$testVersions.services"
androidTestUtil libs.androidx.test.services
}
3 changes: 2 additions & 1 deletion gradle/coverage.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
apply plugin: 'jacoco'
apply plugin: 'org.jetbrains.kotlinx.kover'

jacoco {
toolVersion = testVersions.jacoco
toolVersion = libs.versions.jacoco.get()
}

tasks.withType(Test).configureEach {
Expand Down
Loading

0 comments on commit 9fc853f

Please sign in to comment.