Skip to content

[Tooling] Add google owned cache for dependencies as an option in ci #4567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions GRADLE_STRUCTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Gradle Structure
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok in that case consider the md files content for review and I will remove and update the wiki before merging.


`package/example/android/settings.gradle` imports the flutter tooling and includes the `app` directory and it configures GoogleCloudPlatform/artifact-registry-maven-tools for use in ci.

This repo has a GCP instance that mirrors dependencies available from `google()` and `mavenCentral()` used by ci (or googlers). This gives us redudent uptime for dependency availability.

Using this cache is not intended or avaiable for contributors outside of CI. We protect that execution with an environment variable ARTIFACT_HUB to ensure that by default users do not see rejected cloud credentials or errors in builds.

Googlers can debug locally by setting ARTIFACT_HUB to the valid artifact hub value and authenticating with GCP. To authenticate run `gcloud auth application-default login`. To find artifact hub url use `<url>` section of go/artifact-hub#maven or inspect the value on CI servers. CI uses a service account for billing. That is defined in go/artifact-hub-service-account (googler access only).

## Useful links for debuging
https://github.com/GoogleCloudPlatform/artifact-registry-maven-tools/blob/master/README.md
https://docs.gradle.org/current/userguide/declaring_repositories.html
https://docs.gradle.org/current/userguide/viewing_debugging_dependencies.html

Comamnd to force refresh of dependencies `./gradlew app:dependencies --configuration <SOME_TASK> --refresh-dependencies`
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ buildscript {

allprojects {
repositories {
// See GRADLE_STRUCTURE.md for more info.
if (System.getenv().containsKey('ARTIFACT_HUB')) {
println "Using artifact hub"
maven { url System.getenv('ARTIFACT_HUB') }
}
google()
mavenCentral()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,16 @@ localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"

// See GRADLE_STRUCTURE.md for more info.
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.com.google.cloud.artifactregistry:artifactregistry-gradle-plugin:2.2.1"
}
}
apply plugin: "com.google.cloud.artifactregistry.gradle-plugin"