[GH] Limit usage of gradlePluginPortal

gradlePluginPortal() has mirrors of various libraries, often in an
unsigned form compared to mavenCentral. Avoid using it where we can.

Test: ./gradlew tasks -> in room/

This is an imported pull request from https://github.com/androidx/androidx/pull/376.

Resolves #376
Github-Pr-Head-Sha: 055d6303ae8aac63fed0b9e71fdceb38adf638c8
GitOrigin-RevId: ecdfef7996024c3f28d5663d27350df0e6ffb686
Change-Id: Id6426c199149483930fe1c6d57581e19646d4c55
diff --git a/playground-common/playground-build.gradle b/playground-common/playground-build.gradle
index b01e5cb..85b411e 100644
--- a/playground-common/playground-build.gradle
+++ b/playground-common/playground-build.gradle
@@ -32,9 +32,6 @@
     def metalavaRepo = "https://androidx.dev/metalava/builds/${metalavaBuildId}/artifacts/repo/m2repository"
     def dokkaRepo = "https://androidx.dev/dokka/builds/${dokkaBuildId}/artifacts/repository"
     repositories {
-        maven {
-            url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev/"
-        }
         google()
         mavenCentral()
         maven {
@@ -51,7 +48,10 @@
                 artifact()
             }
         }
-        gradlePluginPortal()
+        gradlePluginPortal().content {
+            it.includeModule("gradle.plugin.com.github.johnrengelman", "shadow")
+            it.includeModule("me.champeau.gradle", "japicmp-gradle-plugin")
+        }
     }
 
     ext.repos = [:]
diff --git a/playground-common/playground-plugin/settings.gradle b/playground-common/playground-plugin/settings.gradle
index 52efe3b..3fe85ca 100644
--- a/playground-common/playground-plugin/settings.gradle
+++ b/playground-common/playground-plugin/settings.gradle
@@ -17,14 +17,19 @@
 pluginManagement {
     repositories {
         mavenCentral()
-        gradlePluginPortal()
+        gradlePluginPortal().content {
+            it.includeModule("org.jetbrains.kotlin.jvm", "org.jetbrains.kotlin.jvm.gradle.plugin")
+        }
     }
 }
 
 dependencyResolutionManagement {
     repositories {
         mavenCentral()
-        gradlePluginPortal()
+        gradlePluginPortal().content {
+            it.includeModule("com.gradle", "gradle-enterprise-gradle-plugin")
+            it.includeModule("com.gradle", "common-custom-user-data-gradle-plugin")
+        }
     }
 }
 
diff --git a/playground-common/playground-plugin/src/main/kotlin/androidx/playground/PlaygroundExtension.kt b/playground-common/playground-plugin/src/main/kotlin/androidx/playground/PlaygroundExtension.kt
index 1c6e86f..ea0f050 100644
--- a/playground-common/playground-plugin/src/main/kotlin/androidx/playground/PlaygroundExtension.kt
+++ b/playground-common/playground-plugin/src/main/kotlin/androidx/playground/PlaygroundExtension.kt
@@ -88,10 +88,9 @@
      */
     fun setupPlayground(relativePathToRoot: String) {
         // gradlePluginPortal has a variety of unsigned binaries that have proper signatures
-        // in mavenCentral, so prefer that over gradlePluginPortal.
+        // in mavenCentral, so don't use gradlePluginPortal()
         settings.pluginManagement.repositories {
             it.mavenCentral()
-            it.gradlePluginPortal()
         }
         val projectDir = settings.rootProject.projectDir
         val supportRoot = File(projectDir, relativePathToRoot).canonicalFile