From 434fc34f129797f2a026906a4b01ecb91bee6c56 Mon Sep 17 00:00:00 2001 From: Simona Stojanovic Date: Fri, 22 Sep 2023 19:33:38 +0100 Subject: [PATCH] Fix deps resolution --- AdaptiveUICodelab/build.gradle | 20 ++++++++++++------ BasicLayoutsCodelab/build.gradle | 10 +++++---- BasicStateCodelab/build.gradle | 15 ++++++++++--- BasicStateCodelab/build.gradle.kts | 21 ------------------- BasicsCodelab/settings.gradle | 14 +++++++++++++ .../apps/sunflower/data/GardenPlantingDao.kt | 4 ++-- .../samples/apps/sunflower/data/PlantDao.kt | 2 +- 7 files changed, 49 insertions(+), 37 deletions(-) delete mode 100644 BasicStateCodelab/build.gradle.kts diff --git a/AdaptiveUICodelab/build.gradle b/AdaptiveUICodelab/build.gradle index 4936a46b3..890deeb73 100644 --- a/AdaptiveUICodelab/build.gradle +++ b/AdaptiveUICodelab/build.gradle @@ -13,12 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -plugins { - id 'com.android.application' version "8.1.1" apply false - id 'com.android.library' version "8.1.1" apply false - id 'org.jetbrains.kotlin.android' version "1.9.10" apply false +buildscript { + repositories { + google() + mavenCentral() + } + dependencies { + classpath "com.android.tools.build:gradle:8.1.1" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.10" + } } -task clean(type: Delete) { - delete rootProject.buildDir +subprojects { + repositories { + google() + mavenCentral() + } } diff --git a/BasicLayoutsCodelab/build.gradle b/BasicLayoutsCodelab/build.gradle index 335bb90c3..0c01ef331 100644 --- a/BasicLayoutsCodelab/build.gradle +++ b/BasicLayoutsCodelab/build.gradle @@ -19,11 +19,13 @@ buildscript { google() mavenCentral() } -}// Top-level build file where you can add configuration options common to all sub-projects/modules. + dependencies { + classpath "com.android.tools.build:gradle:8.1.1" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.10" + } +} + plugins { - id 'com.android.application' version '8.1.1' apply false - id 'com.android.library' version '8.1.1' apply false - id 'org.jetbrains.kotlin.android' version '1.9.10' apply false id 'com.diffplug.spotless' version '6.21.0' } diff --git a/BasicStateCodelab/build.gradle b/BasicStateCodelab/build.gradle index 19f8a4c48..9955678e7 100644 --- a/BasicStateCodelab/build.gradle +++ b/BasicStateCodelab/build.gradle @@ -13,10 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +buildscript { + repositories { + google() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:8.1.1' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.10" + } +} + plugins { - id 'com.android.application' version '8.1.1' apply false - id 'com.android.library' version '8.1.1' apply false - id 'org.jetbrains.kotlin.android' version '1.9.10' apply false id 'com.diffplug.spotless' version '6.21.0' } diff --git a/BasicStateCodelab/build.gradle.kts b/BasicStateCodelab/build.gradle.kts deleted file mode 100644 index 44d459cbf..000000000 --- a/BasicStateCodelab/build.gradle.kts +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2023 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Top-level build file where you can add configuration options common to all sub-projects/modules. -plugins { - id("com.android.application") version "8.1.1" apply false - id("org.jetbrains.kotlin.android") version "1.9.10" apply false -} diff --git a/BasicsCodelab/settings.gradle b/BasicsCodelab/settings.gradle index 6d8438118..faf350ad5 100644 --- a/BasicsCodelab/settings.gradle +++ b/BasicsCodelab/settings.gradle @@ -13,6 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} rootProject.name = "BasicsCodelab" include ':app' diff --git a/MigrationCodelab/app/src/main/java/com/google/samples/apps/sunflower/data/GardenPlantingDao.kt b/MigrationCodelab/app/src/main/java/com/google/samples/apps/sunflower/data/GardenPlantingDao.kt index c9f5fecfb..de873f228 100644 --- a/MigrationCodelab/app/src/main/java/com/google/samples/apps/sunflower/data/GardenPlantingDao.kt +++ b/MigrationCodelab/app/src/main/java/com/google/samples/apps/sunflower/data/GardenPlantingDao.kt @@ -43,8 +43,8 @@ interface GardenPlantingDao { fun getPlantedGardens(): LiveData> @Insert - suspend fun insertGardenPlanting(gardenPlanting: GardenPlanting): Long + fun insertGardenPlanting(gardenPlanting: GardenPlanting): Long @Delete - suspend fun deleteGardenPlanting(gardenPlanting: GardenPlanting) + fun deleteGardenPlanting(gardenPlanting: GardenPlanting) } diff --git a/MigrationCodelab/app/src/main/java/com/google/samples/apps/sunflower/data/PlantDao.kt b/MigrationCodelab/app/src/main/java/com/google/samples/apps/sunflower/data/PlantDao.kt index 1d72b4478..fba4e5334 100644 --- a/MigrationCodelab/app/src/main/java/com/google/samples/apps/sunflower/data/PlantDao.kt +++ b/MigrationCodelab/app/src/main/java/com/google/samples/apps/sunflower/data/PlantDao.kt @@ -37,5 +37,5 @@ interface PlantDao { fun getPlant(plantId: String): LiveData @Insert(onConflict = OnConflictStrategy.REPLACE) - suspend fun insertAll(plants: List) + fun insertAll(plants: List) }