From 5728845d3088d252b7a5ec951b7a75940611fb48 Mon Sep 17 00:00:00 2001 From: Ralf Wondratschek Date: Fri, 13 Nov 2026 19:58:59 -0800 Subject: [PATCH] Filter Gradle dependency repositories Skip repository requests for artifacts outside the groups each repository serves. Resolve AndroidX, Android build tools, and Android test infrastructure through Google Maven, and keep the Gradle Plugin Portal available for Develocity, the KMP hierarchy plugin, and Foojay. Restrict the Sonatype snapshot repository to App Platform snapshots. Apply the same policy to the included builds, standalone blueprints, compiler test fixture, and snapshot setup examples so they retain access to their existing dependencies. --- CHANGELOG.md | 2 ++ .../list-detail/buildSrc/settings.gradle | 11 +++++---- blueprints/list-detail/settings.gradle | 16 ++++++++++--- blueprints/starter/settings.gradle.kts | 17 +++++++++++--- buildSrc/settings.gradle | 20 ++++++++++++++-- docs/setup.md | 6 ++++- gradle-plugin/settings.gradle | 21 +++++++++++++---- .../compiler/IncrementalCompilationTest.kt | 4 ++-- settings.gradle | 23 +++++++++++++++++-- 9 files changed, 99 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f94855f2..3023ed15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ ### Changed +- Filter Gradle repositories in the blueprints to skip unrelated artifact lookups. + ### Deprecated ### Removed diff --git a/blueprints/list-detail/buildSrc/settings.gradle b/blueprints/list-detail/buildSrc/settings.gradle index 2f68411d..505b7a94 100644 --- a/blueprints/list-detail/buildSrc/settings.gradle +++ b/blueprints/list-detail/buildSrc/settings.gradle @@ -1,16 +1,19 @@ pluginManagement { repositories { - google() mavenCentral() - gradlePluginPortal() } } dependencyResolutionManagement { repositories { - google() + google { + content { + includeGroupAndSubgroups('androidx') + includeGroupAndSubgroups('com.android') + includeGroup('com.google.testing.platform') + } + } mavenCentral() - gradlePluginPortal() } versionCatalogs { diff --git a/blueprints/list-detail/settings.gradle b/blueprints/list-detail/settings.gradle index 2d9ae77e..859a4ee8 100644 --- a/blueprints/list-detail/settings.gradle +++ b/blueprints/list-detail/settings.gradle @@ -1,8 +1,12 @@ pluginManagement { repositories { - google() mavenCentral() - gradlePluginPortal() + gradlePluginPortal { + content { + includeGroup('org.gradle.toolchains.foojay-resolver-convention') + includeModule('org.gradle.toolchains', 'foojay-resolver') + } + } } } @@ -12,7 +16,13 @@ plugins { dependencyResolutionManagement { repositories { - google() + google { + content { + includeGroupAndSubgroups('androidx') + includeGroupAndSubgroups('com.android') + includeGroup('com.google.testing.platform') + } + } mavenCentral() } } diff --git a/blueprints/starter/settings.gradle.kts b/blueprints/starter/settings.gradle.kts index 83f65e0f..ee19d3ae 100644 --- a/blueprints/starter/settings.gradle.kts +++ b/blueprints/starter/settings.gradle.kts @@ -1,14 +1,25 @@ pluginManagement { repositories { - google() + google { + content { + includeGroupAndSubgroups("androidx") + includeGroupAndSubgroups("com.android") + includeGroup("com.google.testing.platform") + } + } mavenCentral() - gradlePluginPortal() } } dependencyResolutionManagement { repositories { - google() + google { + content { + includeGroupAndSubgroups("androidx") + includeGroupAndSubgroups("com.android") + includeGroup("com.google.testing.platform") + } + } mavenCentral() } } diff --git a/buildSrc/settings.gradle b/buildSrc/settings.gradle index 8d2e9ad9..bda45ee0 100644 --- a/buildSrc/settings.gradle +++ b/buildSrc/settings.gradle @@ -1,3 +1,9 @@ +pluginManagement { + repositories { + mavenCentral() + } +} + includeBuild('../gradle-plugin') { dependencySubstitution { substitute module("$GROUP:gradle-plugin") using project(':plugin') @@ -7,11 +13,21 @@ includeBuild('../gradle-plugin') { dependencyResolutionManagement { repositories { mavenCentral() - google() - gradlePluginPortal() + google { + content { + includeGroupAndSubgroups("androidx") + includeGroupAndSubgroups("com.android") + includeGroup("com.google.testing.platform") + } + } + gradlePluginPortal { + content { includeModule("io.github.terrakok", "kmp-hierarchy") } + } maven { url = "https://central.sonatype.com/repository/maven-snapshots/" + content { includeGroup("software.ralf.app.platform") } + mavenContent { snapshotsOnly() } } } diff --git a/docs/setup.md b/docs/setup.md index 41b643de..0de87933 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -95,13 +95,15 @@ This repository includes project-neutral skills for coding agents working on app ## Snapshot -To import snapshot builds use following repository: +Add this repository to use App Platform snapshots. === "build.gradle" ```groovy maven { url = 'https://central.sonatype.com/repository/maven-snapshots/' + content { includeGroup('software.ralf.app.platform') } + mavenContent { snapshotsOnly() } } ``` @@ -110,5 +112,7 @@ To import snapshot builds use following repository: ```kotlin maven { url = uri("https://central.sonatype.com/repository/maven-snapshots/") + content { includeGroup("software.ralf.app.platform") } + mavenContent { snapshotsOnly() } } ``` diff --git a/gradle-plugin/settings.gradle b/gradle-plugin/settings.gradle index 44432766..282e783c 100644 --- a/gradle-plugin/settings.gradle +++ b/gradle-plugin/settings.gradle @@ -1,18 +1,31 @@ pluginManagement { repositories { - gradlePluginPortal() - google() + mavenCentral() + google { + content { + includeGroupAndSubgroups("androidx") + includeGroupAndSubgroups("com.android") + includeGroup("com.google.testing.platform") + } + } } } dependencyResolutionManagement { repositories { mavenCentral() - google() - gradlePluginPortal() + google { + content { + includeGroupAndSubgroups("androidx") + includeGroupAndSubgroups("com.android") + includeGroup("com.google.testing.platform") + } + } maven { url = "https://central.sonatype.com/repository/maven-snapshots/" + content { includeGroup("software.ralf.app.platform") } + mavenContent { snapshotsOnly() } } } diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/kotlin/software/ralf/app/platform/metro/compiler/IncrementalCompilationTest.kt b/metro-extensions/contribute/impl-compiler-plugin/src/test/kotlin/software/ralf/app/platform/metro/compiler/IncrementalCompilationTest.kt index 3093a7aa..c741bafa 100644 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/kotlin/software/ralf/app/platform/metro/compiler/IncrementalCompilationTest.kt +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/kotlin/software/ralf/app/platform/metro/compiler/IncrementalCompilationTest.kt @@ -87,8 +87,8 @@ class IncrementalCompilationTest { File(projectDir, "settings.gradle") .writeText( """ - pluginManagement { repositories { mavenCentral(); gradlePluginPortal() } } - dependencyResolutionManagement { repositories { mavenCentral(); google() } } + pluginManagement { repositories { mavenCentral() } } + dependencyResolutionManagement { repositories { mavenCentral() } } rootProject.name = 'incremental-contributions' include ${modules.joinToString { "':$it'" }} """ diff --git a/settings.gradle b/settings.gradle index 8e5e6935..d160a666 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,15 @@ +pluginManagement { + repositories { + mavenCentral() + gradlePluginPortal { + content { + includeGroup("com.gradle.develocity") + includeModule("com.gradle", "develocity-gradle-plugin") + } + } + } +} + plugins { id "com.gradle.develocity" version "4.5.1" } @@ -11,11 +23,18 @@ includeBuild('gradle-plugin') { dependencyResolutionManagement { repositories { mavenCentral() - google() - gradlePluginPortal() + google { + content { + includeGroupAndSubgroups("androidx") + includeGroupAndSubgroups("com.android") + includeGroup("com.google.testing.platform") + } + } maven { url = "https://central.sonatype.com/repository/maven-snapshots/" + content { includeGroup("software.ralf.app.platform") } + mavenContent { snapshotsOnly() } } } }