Skip to content

Commit 11b79b5

Browse files
authored
[Tooling] Add google owned cache for dependencies as an option in ci (#4567)
Proof of concept of a package using artifact hub. Artifact hub is a google owned and managed cache of google/maven dependencies. Using this cache should decrease the number of flakes related to downloading dependencies along with future benefits of licence analysis and security alerts. Read more at go/artifact-hub#maven flutter/flutter/issues/120119 Nest steps: Enable a new env variable on CI servers. https://flutter-review.googlesource.com/c/recipes/+/48260 cl/551888350 Merge this PR. Apply this change to all packages Add enforcement as part of the gradle check. Developers have a new dependency for buildscript but it is publicly available, so I added a next changelog.
1 parent dc23020 commit 11b79b5

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

packages/camera/camera_android_camerax/example/android/build.gradle

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
buildscript {
2-
// This version should intentionally be a 1.7.* version and lower than the
2+
// This version should intentionally be a 1.7.* version and lower than the
33
// version of kotlin-bom defined in packages/camera/camera_android_camerax/android/build.gradle.
4-
// This tests that the kotlin version resolution continues to work.
4+
// This tests that the kotlin version resolution continues to work.
55
ext.kotlin_version = '1.7.10'
66
repositories {
77
google()
@@ -16,6 +16,12 @@ buildscript {
1616

1717
allprojects {
1818
repositories {
19+
// See https://github.com/flutter/flutter/wiki/Plugins-and-Packages-repository-structure#gradle-structure for more info.
20+
def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY'
21+
if (System.getenv().containsKey(artifactRepoKey)) {
22+
println "Using artifact hub"
23+
maven { url System.getenv(artifactRepoKey) }
24+
}
1925
google()
2026
mavenCentral()
2127
}

packages/camera/camera_android_camerax/example/android/settings.gradle

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,16 @@ localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
99
def flutterSdkPath = properties.getProperty("flutter.sdk")
1010
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
1111
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12+
13+
// See https://github.com/flutter/flutter/wiki/Plugins-and-Packages-repository-structure#gradle-structure for more info.
14+
buildscript {
15+
repositories {
16+
maven {
17+
url "https://plugins.gradle.org/m2/"
18+
}
19+
}
20+
dependencies {
21+
classpath "gradle.plugin.com.google.cloud.artifactregistry:artifactregistry-gradle-plugin:2.2.1"
22+
}
23+
}
24+
apply plugin: "com.google.cloud.artifactregistry.gradle-plugin"

0 commit comments

Comments
 (0)