From 1943595f11a1feb02b2bba725931f2e7901e22a5 Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Mon, 27 Mar 2023 13:45:48 +0530 Subject: [PATCH] Migrate to new plugins and dependency management system * Ensure every plugin is present in project's plugin block with version * Switch to full plugin id for jetbrains plugins * Move plugin and dependency repos to settings Signed-off-by: Aayush Gupta --- app/build.gradle | 6 +++--- build.gradle | 27 +++++++++------------------ contactsbackup/build.gradle | 6 ++++-- settings.gradle | 17 ++++++++++++++++- storage/demo/build.gradle | 4 ++-- storage/lib/build.gradle | 8 ++++---- 6 files changed, 38 insertions(+), 30 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index dbcd1ed1..54930f6c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,7 +1,7 @@ plugins { - id "com.android.application" - id "kotlin-android" - id "org.jlleitschuh.gradle.ktlint" version "10.2.0" + id 'com.android.application' + id 'org.jetbrains.kotlin.android' + id 'org.jlleitschuh.gradle.ktlint' } def gitDescribe = { -> diff --git a/build.gradle b/build.gradle index f8d361ff..acad618b 100644 --- a/build.gradle +++ b/build.gradle @@ -7,17 +7,16 @@ buildscript { // https://android.googlesource.com/platform/external/kotlinc/+/refs/tags/android-13.0.0_r32/build.txt ext.aosp_kotlin_version = '1.7.20' // 1.7.20-release-201 in AOSP ext.kotlin_version = '1.7.20' +} - repositories { - mavenCentral() - google() - } - dependencies { - //noinspection DifferentKotlinGradleVersion - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.17" - classpath 'com.android.tools.build:gradle:7.4.2' - } +plugins { + id 'com.android.application' version '7.4.2' apply false + id 'com.android.library' version '7.4.2' apply false + id 'com.google.protobuf' version '0.8.17' apply false + id 'org.jetbrains.kotlin.android' version "$kotlin_version" apply false + id 'org.jetbrains.kotlin.kapt' version "$kotlin_version" apply false + id 'org.jetbrains.dokka' version "$kotlin_version" apply false + id 'org.jlleitschuh.gradle.ktlint' version '10.2.0' apply false } ext { @@ -29,14 +28,6 @@ ext { apply from: 'gradle/dependencies.gradle' -allprojects { - repositories { - mavenCentral() - google() - maven { url 'https://jitpack.io' } - } -} - task clean(type: Delete) { delete rootProject.buildDir } diff --git a/contactsbackup/build.gradle b/contactsbackup/build.gradle index 85bf9bbb..8675a947 100644 --- a/contactsbackup/build.gradle +++ b/contactsbackup/build.gradle @@ -3,8 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' +plugins { + id 'com.android.application' + id 'org.jetbrains.kotlin.android' +} android { compileSdkVersion rootProject.ext.compileSdkVersion diff --git a/settings.gradle b/settings.gradle index 87893e08..a7a9214d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,19 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + maven { url 'https://jitpack.io' } + } +} include ':app' include ':contactsbackup' include ':storage:lib' -include ':storage:demo' \ No newline at end of file +include ':storage:demo' diff --git a/storage/demo/build.gradle b/storage/demo/build.gradle index d8572d93..4fcee90e 100644 --- a/storage/demo/build.gradle +++ b/storage/demo/build.gradle @@ -6,8 +6,8 @@ plugins { id 'com.android.application' id 'com.google.protobuf' - id 'kotlin-android' - id 'kotlin-kapt' + id 'org.jetbrains.kotlin.android' + id 'org.jetbrains.kotlin.kapt' } android { diff --git a/storage/lib/build.gradle b/storage/lib/build.gradle index 3b69f1ea..2e16e9ff 100644 --- a/storage/lib/build.gradle +++ b/storage/lib/build.gradle @@ -6,10 +6,10 @@ plugins { id 'com.android.library' id 'com.google.protobuf' - id 'kotlin-android' - id 'kotlin-kapt' - id "org.jlleitschuh.gradle.ktlint" version "10.2.0" - id 'org.jetbrains.dokka' version "$kotlin_version" + id 'org.jetbrains.kotlin.android' + id 'org.jetbrains.kotlin.kapt' + id 'org.jetbrains.dokka' + id 'org.jlleitschuh.gradle.ktlint' } android {