From d15cadff8a4575f25a1a4bdd353713e76cf9d0a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernat=20Borr=C3=A1s=20Paronella?= Date: Sun, 4 Dec 2022 12:30:33 +0100 Subject: [PATCH] Update SDK versions && move dependencies (#474) * Move classpath plugins to toml * Add settings.gradle.kts * Update gradle * Fix settings.gradle.kts * Make build.gradle compose compile * Move espresso dependencies * Update test dependencies * Update barista dependencies * Update barista test dependencies * Update barista sample dependencies * Update barista-compose dependencies * Update android SDK versions * Update kotlin * Update manifest --- barista-compose/build.gradle.kts | 31 ++++++----- barista/build.gradle.kts | 42 +++++++------- build.gradle | 13 ++--- gradle/libs.versions.toml | 71 ++++++++++++++++++++++++ gradle/wrapper/gradle-wrapper.properties | 5 +- sample/build.gradle.kts | 34 ++++++------ sample/src/main/AndroidManifest.xml | 2 +- settings.gradle | 12 ---- settings.gradle.kts | 13 +++++ 9 files changed, 148 insertions(+), 75 deletions(-) create mode 100644 gradle/libs.versions.toml delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts diff --git a/barista-compose/build.gradle.kts b/barista-compose/build.gradle.kts index 5a90d721..7b2c3ca3 100644 --- a/barista-compose/build.gradle.kts +++ b/barista-compose/build.gradle.kts @@ -10,21 +10,22 @@ ext["PUBLISH_ARTIFACT_ID"] = "barista-compose" apply(from = "${rootProject.projectDir}/scripts/publish-module.gradle") android { - compileSdk = 31 + compileSdk = 33 defaultConfig { minSdk = 21 - targetSdk = 31 + targetSdk = 33 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunnerArguments["clearPackageData"] = "true" } - + buildFeatures { compose = true } + composeOptions { - kotlinCompilerExtensionVersion = rootProject.extra["compose_version"] as String + kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() } packagingOptions { @@ -35,16 +36,16 @@ android { } dependencies { - api("androidx.test.ext:junit:1.1.3") - api("androidx.compose.ui:ui-test-junit4:1.0.2") - - debugImplementation("androidx.compose.ui:ui:${rootProject.extra["compose_version"]}") - debugImplementation("androidx.compose.material:material:${rootProject.extra["compose_version"]}") - debugImplementation("androidx.compose.ui:ui-tooling-preview:${rootProject.extra["compose_version"]}") - debugImplementation("androidx.lifecycle:lifecycle-runtime-ktx:2.3.1") - debugImplementation("androidx.activity:activity-compose:1.3.1") - debugImplementation("androidx.compose.ui:ui-test-junit4:${rootProject.extra["compose_version"]}") - debugImplementation("androidx.compose.ui:ui-test-manifest:${rootProject.extra["compose_version"]}") - debugImplementation("androidx.compose.ui:ui-tooling:${rootProject.extra["compose_version"]}") + api(libs.androidX.test.junit) + api(libs.androidX.compose.test.ui.junit4) + + debugImplementation(libs.androidX.compose.ui.ui) + debugImplementation(libs.androidX.compose.material) + debugImplementation(libs.androidX.compose.ui.tooling.preview) + debugImplementation(libs.androidX.compose.ui.tooling.core) + debugImplementation(libs.androidX.compose.test.ui.manifest) + + debugImplementation(libs.androidX.lifecycle) + debugImplementation(libs.androidX.activity.compose) } \ No newline at end of file diff --git a/barista/build.gradle.kts b/barista/build.gradle.kts index 147d1f07..59d3e72e 100644 --- a/barista/build.gradle.kts +++ b/barista/build.gradle.kts @@ -10,11 +10,11 @@ ext["PUBLISH_ARTIFACT_ID"] = "barista" apply(from = "${rootProject.projectDir}/scripts/publish-module.gradle") android { - compileSdk = 30 + compileSdk = 33 defaultConfig { - minSdk = 19 - targetSdk = 30 + minSdk = 21 + targetSdk = 33 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } @@ -24,22 +24,22 @@ android { } dependencies { - api("androidx.test.espresso:espresso-core:3.4.0") - api("androidx.test.espresso:espresso-contrib:3.4.0") - api("androidx.test.uiautomator:uiautomator:2.2.0") - api("androidx.test.espresso:espresso-intents:3.4.0") - - - implementation("androidx.annotation:annotation:1.0.2") - implementation("androidx.legacy:legacy-support-core-ui:1.0.0") - implementation("androidx.vectordrawable:vectordrawable-animated:1.0.0") - implementation("androidx.recyclerview:recyclerview:1.0.0") - api("androidx.viewpager2:viewpager2:1.0.0") - - implementation("com.google.android.material:material:1.2.0") - - testImplementation("junit:junit:4.12") - testImplementation("pl.pragmatists:JUnitParams:1.1.0") - testImplementation("org.assertj:assertj-core:1.7.0") - testImplementation("org.mockito:mockito-core:2.28.2") + api(libs.androidX.test.espresso.core) + api(libs.androidX.test.espresso.contrib) + api(libs.androidX.test.uiAutomator) + api(libs.androidX.test.espresso.intents) + + implementation(libs.androidX.annotation) + implementation(libs.androidX.legacy.support) + implementation(libs.androidX.vectorDrawable.animated) + implementation(libs.androidX.recyclerView) + api(libs.androidX.viewPager2) + + implementation(libs.androidX.material) + + testImplementation(libs.testing.jUnit) + testImplementation(libs.testing.jUnitParams) + testImplementation(libs.testing.assertJ) + + testImplementation(libs.testing.mockito.core) } diff --git a/build.gradle b/build.gradle index 879877af..31cdedaf 100644 --- a/build.gradle +++ b/build.gradle @@ -1,17 +1,14 @@ buildscript { - ext { - compose_version = '1.0.2' - } repositories { maven { url "https://plugins.gradle.org/m2/" } google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.0.2' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21" - classpath "io.github.gradle-nexus:publish-plugin:1.1.0" - classpath("io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.22.0") + classpath libs.android.gradlePlugin + classpath libs.kotlin.gradlePlugin + classpath libs.nexus.publish + classpath libs.nexus.staging } } apply plugin: 'io.github.gradle-nexus.publish-plugin' @@ -27,4 +24,4 @@ task clean(type: Delete) { delete rootProject.buildDir } -apply from: "${rootDir}/scripts/publish-root.gradle" \ No newline at end of file +apply from: "${rootDir}/scripts/publish-root.gradle" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..f8247d92 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,71 @@ +[versions] +gradlePlugin = "7.3.1" +kotlin = "1.7.20" +nexusPublish = "1.1.0" +nexusStaging = "0.22.0" +compose = "1.3.1" +composeCompiler = "1.3.2" +androidXAppCompat = "1.0.2" +androidXAnnotation = "1.0.2" +androidXCore = "1.0.1" +androidXEspresso = "3.4.0" +androidXJUnit = "1.1.3" +androidXLegacy = "1.0.0" +androidXLifecycle = "2.3.1" +androidXMaterial = "1.2.0" +androidXOrchestrator = "1.4.1" +androidXRecyclerView = "1.0.0" +androidXVectorDrawable = "1.0.0" +androidXViewPager2 = "1.0.0" +uiAutomator = "2.2.0" + +glide = "4.10.0" + +assertJ = "2.9.1" +jUnit = "4.12" +jUnitParams = "1.1.0" +mockito = "2.28.2" +mockitoKotlin = "1.5.0" + +[libraries] + +android-gradlePlugin = { module = "com.android.tools.build:gradle", version.ref = "gradlePlugin" } +kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } +nexus-publish = { module = "io.github.gradle-nexus:publish-plugin", version.ref = "nexusPublish" } +nexus-staging = { module = "io.codearte.gradle.nexus:gradle-nexus-staging-plugin", version.ref = "nexusStaging" } + +androidX-test-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "androidXEspresso" } +androidX-test-espresso-contrib = { module = "androidx.test.espresso:espresso-contrib", version.ref = "androidXEspresso" } +androidX-test-espresso-intents = { module = "androidx.test.espresso:espresso-intents", version.ref = "androidXEspresso" } +androidX-test-junit = { module = "androidx.test.ext:junit", version.ref = "androidXJUnit" } +androidX-test-orchestrator = { module = "androidx.test:orchestrator", version.ref = "androidXOrchestrator" } +androidX-test-uiAutomator = { module = "androidx.test.uiautomator:uiautomator", version.ref = "uiAutomator" } + +androidX-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "compose" } +androidX-annotation = { module = "androidx.annotation:annotation", version.ref = "androidXAnnotation" } +androidX-appCompat = { module = "androidx.appcompat:appcompat", version.ref = "androidXAppCompat" } +androidX-core = { module = "androidx.core:core-ktx", version.ref = "androidXCore" } +androidX-legacy-support = { module = "androidx.legacy:legacy-support-core-ui", version.ref = "androidXLegacy" } +androidX-legacy-supportV4 = { module = "androidx.legacy:legacy-support-v4", version.ref = "androidXLegacy" } +androidX-lifecycle = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "androidXLifecycle" } +androidX-material = { module = "com.google.android.material:material", version.ref = "androidXMaterial" } +androidX-recyclerView = { module = "androidx.recyclerview:recyclerview", version.ref = "androidXRecyclerView" } +androidX-vectorDrawable-animated = { module = "androidx.vectordrawable:vectordrawable-animated", version.ref = "androidXVectorDrawable" } +androidX-viewPager2 = { module = "androidx.viewpager2:viewpager2", version.ref = "androidXViewPager2" } + +androidX-compose-ui-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" } +androidX-compose-ui-tooling-core = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" } +androidX-compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" } +androidX-compose-material = { module = "androidx.compose.material:material", version.ref = "compose" } + +androidX-compose-test-ui-junit4 = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "compose" } +androidX-compose-test-ui-manifest = { module = "androidx.compose.ui:ui-test-manifest", version.ref = "compose" } + +glide = { module = "com.github.bumptech.glide:glide", version.ref = "glide" } + +testing-assertJ = { module = "org.assertj:assertj-core", version.ref = "assertJ" } +testing-jUnit = { module = "junit:junit", version.ref = "jUnit" } +testing-jUnitParams = { module = "pl.pragmatists:JUnitParams", version.ref = "jUnitParams" } +testing-mockito-android = { module = "org.mockito:mockito-android", version.ref = "mockito" } +testing-mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" } +testing-mockito-kotlin = { module = "com.nhaarman:mockito-kotlin", version.ref = "mockitoKotlin" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0f80bbf5..8c035d09 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Sat Dec 03 13:54:10 CET 2022 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts index 1e306bfa..ec3fba66 100644 --- a/sample/build.gradle.kts +++ b/sample/build.gradle.kts @@ -7,11 +7,11 @@ plugins { apply(from = "../config/android-quality.gradle") android { - compileSdk = 30 + compileSdk = 33 defaultConfig { minSdk = 21 - targetSdk = 30 + targetSdk = 33 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunnerArguments["clearPackageData"] = "true" @@ -30,22 +30,24 @@ android { } dependencies { - implementation("androidx.legacy:legacy-support-v4:1.0.0") - implementation("androidx.appcompat:appcompat:1.0.2") - implementation("androidx.recyclerview:recyclerview:1.0.0") - implementation("com.google.android.material:material:1.2.0") - implementation("androidx.annotation:annotation:1.0.2") - implementation("com.github.bumptech.glide:glide:4.10.0") - implementation("com.google.android.material:material:1.2.0") - implementation("androidx.core:core-ktx:1.0.1") - - androidTestUtil("androidx.test:orchestrator:1.4.1") + implementation(libs.androidX.legacy.supportV4) + + implementation(libs.androidX.appCompat) + implementation(libs.androidX.recyclerView) + implementation(libs.androidX.material) + implementation(libs.androidX.annotation) + + implementation(libs.glide) + implementation(libs.androidX.material) + implementation(libs.androidX.core) + + androidTestUtil(libs.androidX.test.orchestrator) androidTestImplementation(project(":barista")) - androidTestImplementation("org.assertj:assertj-core:2.9.1") - androidTestImplementation("com.nhaarman:mockito-kotlin:1.5.0") - androidTestImplementation("org.mockito:mockito-android:2.28.2") + androidTestImplementation(libs.testing.assertJ) + androidTestImplementation(libs.testing.mockito.kotlin) + androidTestImplementation(libs.testing.mockito.android) - testImplementation("junit:junit:4.12") + testImplementation(libs.testing.jUnit) } \ No newline at end of file diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index 54c04898..56a82883 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -51,7 +51,7 @@ - + diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 51fbdcd4..00000000 --- a/settings.gradle +++ /dev/null @@ -1,12 +0,0 @@ -plugins { - id "com.gradle.enterprise" version "3.4.1" -} -gradleEnterprise { - buildScan { - termsOfServiceUrl = "https://gradle.com/terms-of-service" - termsOfServiceAgree = "yes" - publishAlways() - } -} -include ':sample', ':barista' -include ':barista-compose' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000..7c523eda --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,13 @@ +enableFeaturePreview("VERSION_CATALOGS") + +pluginManagement { + repositories { + google() + mavenCentral() + } +} + +include(":sample") + +include(":barista") +include(":barista-compose")