From 5c249ae6d3f7cb73e08ce2561db2a556d5d53af3 Mon Sep 17 00:00:00 2001 From: Adam Szewera Date: Wed, 3 Jan 2024 09:35:19 +0100 Subject: [PATCH] Update dependency resolution management (#2000) ## Changes * get rid of the JCenter repository * centralize repository declaration for all projects in project settings * refactor `build.gradle` and `settings.gradle` from Groovy syntax to Kotlin DSL (thus replacing those files with `build.gradle.kts` and `settings.gradle.kts` respectively) The remaining `build.gradle` files are refactored in: https://github.com/syncthing/syncthing-android/pull/2022 --- build.gradle => build.gradle.kts | 25 ++++++++++--------------- settings.gradle | 1 - settings.gradle.kts | 21 +++++++++++++++++++++ 3 files changed, 31 insertions(+), 16 deletions(-) rename build.gradle => build.gradle.kts (55%) delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts diff --git a/build.gradle b/build.gradle.kts similarity index 55% rename from build.gradle rename to build.gradle.kts index a67e9cd2..2aa97e95 100644 --- a/build.gradle +++ b/build.gradle.kts @@ -1,32 +1,27 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext { + extra.apply { // Cannot be called "ndkVersion" as that leads to naming collision // Changes to this value must be reflected in `./docker/Dockerfile` - ndkVersionShared = '25.2.9519653' + set("ndkVersionShared", "25.2.9519653") + } + repositories { + gradlePluginPortal() google() - jcenter() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.3.1' - classpath 'com.github.ben-manes:gradle-versions-plugin:0.36.0' + classpath("com.android.tools.build:gradle:7.3.1") + classpath("com.github.ben-manes:gradle-versions-plugin:0.36.0") // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } -allprojects { - repositories { - google() - jcenter() - maven { url = "https://jitpack.io" } - } -} - -task clean(type: Delete) { - delete rootProject.buildDir +tasks.register("clean") { + delete(rootProject.buildDir) } diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index ff55c794..00000000 --- a/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':app', ':syncthing' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000..d25fb71a --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,21 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + maven { url = java.net.URI("https://jitpack.io") } + } +} + +include( + ":app", + ":syncthing" +)