From a38111d95ad723a547820cca7aa9c6ad87ab91d1 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Tue, 25 Jul 2023 18:16:22 -0400 Subject: [PATCH 01/12] Proof of concepts of a package using artifact hub. Requried to be an authenticated googler `gcloud auth application-default login` Useful links https://g3doc.corp.google.com/company/teams/artifact-hub/index.md?cl=head#maven https://github.com/GoogleCloudPlatform/artifact-registry-maven-tools/blob/master/README.md Useful command ``` gcloud artifacts print-settings mvn \ --project=artifact-foundry-prod \ --repository=maven-3p \ --location=us ``` --- .../camera_android_camerax/example/android/build.gradle | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/camera/camera_android_camerax/example/android/build.gradle b/packages/camera/camera_android_camerax/example/android/build.gradle index 702f1d28064..5ca7ef8885f 100644 --- a/packages/camera/camera_android_camerax/example/android/build.gradle +++ b/packages/camera/camera_android_camerax/example/android/build.gradle @@ -14,10 +14,14 @@ buildscript { } } +plugins { + id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" +} + allprojects { + apply plugin: 'com.google.cloud.artifactregistry.gradle-plugin' repositories { - google() - mavenCentral() + maven { url 'artifactregistry://us-maven.pkg.dev/artifact-foundry-prod/maven-3p' } } } From befa25499e19d6ea448f9318dae9dfb676883d3b Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Wed, 26 Jul 2023 11:37:34 -0400 Subject: [PATCH 02/12] Update documentation, split out plugin apply into setting, simplify repository addition --- GRADLE_STRUCTURE.md | 16 ++++++++++++++++ .../example/android/build.gradle | 13 +++++++------ .../example/android/settings.gradle | 13 +++++++++++++ 3 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 GRADLE_STRUCTURE.md diff --git a/GRADLE_STRUCTURE.md b/GRADLE_STRUCTURE.md new file mode 100644 index 00000000000..65d86bfa52c --- /dev/null +++ b/GRADLE_STRUCTURE.md @@ -0,0 +1,16 @@ +# Gradle Structure + +`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 `` 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 --refresh-dependencies` \ No newline at end of file diff --git a/packages/camera/camera_android_camerax/example/android/build.gradle b/packages/camera/camera_android_camerax/example/android/build.gradle index 5ca7ef8885f..793047aa970 100644 --- a/packages/camera/camera_android_camerax/example/android/build.gradle +++ b/packages/camera/camera_android_camerax/example/android/build.gradle @@ -14,14 +14,15 @@ buildscript { } } -plugins { - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - allprojects { - apply plugin: 'com.google.cloud.artifactregistry.gradle-plugin' repositories { - maven { url 'artifactregistry://us-maven.pkg.dev/artifact-foundry-prod/maven-3p' } + // 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() } } diff --git a/packages/camera/camera_android_camerax/example/android/settings.gradle b/packages/camera/camera_android_camerax/example/android/settings.gradle index 44e62bcf06a..1511b13bdbd 100644 --- a/packages/camera/camera_android_camerax/example/android/settings.gradle +++ b/packages/camera/camera_android_camerax/example/android/settings.gradle @@ -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" From 73aea86b6e3cbe1995ab958dd6d482b4d6c25be4 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Wed, 26 Jul 2023 12:04:14 -0400 Subject: [PATCH 03/12] Update the env variable to be more specific --- GRADLE_STRUCTURE.md | 4 ++-- .../camera_android_camerax/example/android/build.gradle | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/GRADLE_STRUCTURE.md b/GRADLE_STRUCTURE.md index 65d86bfa52c..fb85c2e2d97 100644 --- a/GRADLE_STRUCTURE.md +++ b/GRADLE_STRUCTURE.md @@ -4,9 +4,9 @@ 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. +Using this cache is not intended or avaiable for contributors outside of CI. We protect that execution with an environment variable `ARTIFACT_HUB_REPOSITORY` 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 `` 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). +Googlers can debug locally by setting `ARTIFACT_HUB_REPOSITORY` to the valid artifact hub value and authenticating with GCP. To authenticate run `gcloud auth application-default login`. To find artifact hub url use `` 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 diff --git a/packages/camera/camera_android_camerax/example/android/build.gradle b/packages/camera/camera_android_camerax/example/android/build.gradle index 793047aa970..2f15c6c3415 100644 --- a/packages/camera/camera_android_camerax/example/android/build.gradle +++ b/packages/camera/camera_android_camerax/example/android/build.gradle @@ -17,9 +17,9 @@ buildscript { allprojects { repositories { // See GRADLE_STRUCTURE.md for more info. - if (System.getenv().containsKey('ARTIFACT_HUB')) { + if (System.getenv().containsKey('ARTIFACT_HUB_REPOSITORY')) { println "Using artifact hub" - maven { url System.getenv('ARTIFACT_HUB') } + maven { url System.getenv('ARTIFACT_HUB_REPOSITORY') } } google() mavenCentral() From a2e87fb973bcc4a1076316ae703ac9b5639c7f1b Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Wed, 26 Jul 2023 12:13:54 -0400 Subject: [PATCH 04/12] Speling and phrasing updates, make key a variable --- GRADLE_STRUCTURE.md | 4 ++-- .../camera_android_camerax/example/android/build.gradle | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/GRADLE_STRUCTURE.md b/GRADLE_STRUCTURE.md index fb85c2e2d97..e24321b554a 100644 --- a/GRADLE_STRUCTURE.md +++ b/GRADLE_STRUCTURE.md @@ -1,8 +1,8 @@ # Gradle Structure -`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. +package/example/android/settings.gradle imports the flutter tooling, includes the app directory, and 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. +This repo has a GCP instance that mirrors dependencies available from `google()` and `mavenCentral()` used by ci (or googlers). This gives us redundant 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_REPOSITORY` to ensure that by default users do not see rejected cloud credentials or errors in builds. diff --git a/packages/camera/camera_android_camerax/example/android/build.gradle b/packages/camera/camera_android_camerax/example/android/build.gradle index 2f15c6c3415..31ef684a9b0 100644 --- a/packages/camera/camera_android_camerax/example/android/build.gradle +++ b/packages/camera/camera_android_camerax/example/android/build.gradle @@ -1,7 +1,7 @@ buildscript { - // This version should intentionally be a 1.7.* version and lower than the + // This version should intentionally be a 1.7.* version and lower than the // version of kotlin-bom defined in packages/camera/camera_android_camerax/android/build.gradle. - // This tests that the kotlin version resolution continues to work. + // This tests that the kotlin version resolution continues to work. ext.kotlin_version = '1.7.10' repositories { google() @@ -17,9 +17,10 @@ buildscript { allprojects { repositories { // See GRADLE_STRUCTURE.md for more info. - if (System.getenv().containsKey('ARTIFACT_HUB_REPOSITORY')) { + def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' + if (System.getenv().containsKey(artifactRepoKey)) { println "Using artifact hub" - maven { url System.getenv('ARTIFACT_HUB_REPOSITORY') } + maven { url System.getenv(artifactRepoKey) } } google() mavenCentral() From 474f547accb2615b15eab50f86079bbfdfccb23b Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Wed, 26 Jul 2023 16:02:23 -0400 Subject: [PATCH 05/12] formatting --- GRADLE_STRUCTURE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GRADLE_STRUCTURE.md b/GRADLE_STRUCTURE.md index e24321b554a..2f75e09a6b0 100644 --- a/GRADLE_STRUCTURE.md +++ b/GRADLE_STRUCTURE.md @@ -1,6 +1,6 @@ # Gradle Structure -package/example/android/settings.gradle imports the flutter tooling, includes the app directory, and configures GoogleCloudPlatform/artifact-registry-maven-tools for use in ci. +`package/example/android/settings.gradle` imports the flutter tooling, includes the app directory, and 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 redundant uptime for dependency availability. From 797e066f6c507ac886842eb291cc318ad67f9377 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Thu, 27 Jul 2023 16:56:15 -0400 Subject: [PATCH 06/12] Update changelog --- packages/camera/camera_android_camerax/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/camera/camera_android_camerax/CHANGELOG.md b/packages/camera/camera_android_camerax/CHANGELOG.md index ab60e8aba87..7e512e34b2e 100644 --- a/packages/camera/camera_android_camerax/CHANGELOG.md +++ b/packages/camera/camera_android_camerax/CHANGELOG.md @@ -1,3 +1,7 @@ +## NEXT + +* Updates android example to be able to use custom use artifactregistery. + ## 0.5.0+11 * Fixes issue with image data not being emitted after relistening to stream returned by `onStreamedFrameAvailable`. From 81b040602b75d8588e3d4730358ceaaf7270c256 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Fri, 28 Jul 2023 10:58:53 -0400 Subject: [PATCH 07/12] Update GRADLE_STRUCTURE.md to use CI instead of ci --- GRADLE_STRUCTURE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GRADLE_STRUCTURE.md b/GRADLE_STRUCTURE.md index 2f75e09a6b0..03c2abe8168 100644 --- a/GRADLE_STRUCTURE.md +++ b/GRADLE_STRUCTURE.md @@ -1,6 +1,6 @@ # Gradle Structure -`package/example/android/settings.gradle` imports the flutter tooling, includes the app directory, and configures GoogleCloudPlatform/artifact-registry-maven-tools for use in ci. +`package/example/android/settings.gradle` imports the flutter tooling, includes the app directory, and 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 redundant uptime for dependency availability. @@ -13,4 +13,4 @@ https://github.com/GoogleCloudPlatform/artifact-registry-maven-tools/blob/master 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 --refresh-dependencies` \ No newline at end of file +Comamnd to force refresh of dependencies `./gradlew app:dependencies --configuration --refresh-dependencies` From a996c0674f764c31dbe96163778a0e059f39c9d9 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Fri, 28 Jul 2023 11:03:31 -0400 Subject: [PATCH 08/12] Update GRADLE_STRUCTURE.md --- GRADLE_STRUCTURE.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GRADLE_STRUCTURE.md b/GRADLE_STRUCTURE.md index 03c2abe8168..2b8f1b351ce 100644 --- a/GRADLE_STRUCTURE.md +++ b/GRADLE_STRUCTURE.md @@ -2,11 +2,11 @@ `package/example/android/settings.gradle` imports the flutter tooling, includes the app directory, and 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 redundant uptime for dependency availability. +This repo has a GCP instance that mirrors dependencies available from `google()` and `mavenCentral()` used by CI (or Googlers). This gives us redundant 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_REPOSITORY` to ensure that by default users do not see rejected cloud credentials or errors in builds. +Using the specific google hosted cache is not intended or avaiable for contributors outside of CI. We protect that execution with an environment variable `ARTIFACT_HUB_REPOSITORY` to ensure that by default users do not see rejected cloud credentials or errors in builds. Contributors could setup an aritfact repository and set the environment variable to point to a hosted repository but that is practically not worth it for almost all contributors. -Googlers can debug locally by setting `ARTIFACT_HUB_REPOSITORY` to the valid artifact hub value and authenticating with GCP. To authenticate run `gcloud auth application-default login`. To find artifact hub url use `` 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). +Googlers can debug locally by setting `ARTIFACT_HUB_REPOSITORY` to the valid artifact hub value and authenticating with GCP. To authenticate run `gcloud auth application-default login`. To find artifact hub url use `` 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 From 3ce0495fa8a5124b220bc52fe31fa9013b6b69e6 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Fri, 28 Jul 2023 11:05:39 -0400 Subject: [PATCH 09/12] Update CHANGELOG.md to not have comment --- packages/camera/camera_android_camerax/CHANGELOG.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/camera/camera_android_camerax/CHANGELOG.md b/packages/camera/camera_android_camerax/CHANGELOG.md index d10e263694a..1cddca1cbbc 100644 --- a/packages/camera/camera_android_camerax/CHANGELOG.md +++ b/packages/camera/camera_android_camerax/CHANGELOG.md @@ -1,7 +1,3 @@ -## NEXT - -* Updates android example to be able to use custom use artifactregistery. - ## 0.5.0+12 * Wraps classes needed to implement resolution configuration for image capture, image analysis, and preview. From 6fc575396c044fd90b5a599e0448688d36554b6a Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Fri, 28 Jul 2023 12:36:06 -0400 Subject: [PATCH 10/12] Delete GRADLE_STRUCTURE.md Replaced with https://github.com/flutter/flutter/wiki/Plugins-and-Packages-repository-structure#gradle-structure --- GRADLE_STRUCTURE.md | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 GRADLE_STRUCTURE.md diff --git a/GRADLE_STRUCTURE.md b/GRADLE_STRUCTURE.md deleted file mode 100644 index 2b8f1b351ce..00000000000 --- a/GRADLE_STRUCTURE.md +++ /dev/null @@ -1,16 +0,0 @@ -# Gradle Structure - -`package/example/android/settings.gradle` imports the flutter tooling, includes the app directory, and 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 redundant uptime for dependency availability. - -Using the specific google hosted cache is not intended or avaiable for contributors outside of CI. We protect that execution with an environment variable `ARTIFACT_HUB_REPOSITORY` to ensure that by default users do not see rejected cloud credentials or errors in builds. Contributors could setup an aritfact repository and set the environment variable to point to a hosted repository but that is practically not worth it for almost all contributors. - -Googlers can debug locally by setting `ARTIFACT_HUB_REPOSITORY` to the valid artifact hub value and authenticating with GCP. To authenticate run `gcloud auth application-default login`. To find artifact hub url use `` 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 --refresh-dependencies` From 384541e4f529cc5f2540bd74c54820ab7d533fc2 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Fri, 28 Jul 2023 12:36:35 -0400 Subject: [PATCH 11/12] Update build.gradle https://github.com/flutter/flutter/wiki/Plugins-and-Packages-repository-structure#gradle-structure --- .../camera/camera_android_camerax/example/android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/camera/camera_android_camerax/example/android/build.gradle b/packages/camera/camera_android_camerax/example/android/build.gradle index 31ef684a9b0..601db113a9e 100644 --- a/packages/camera/camera_android_camerax/example/android/build.gradle +++ b/packages/camera/camera_android_camerax/example/android/build.gradle @@ -16,7 +16,7 @@ buildscript { allprojects { repositories { - // See GRADLE_STRUCTURE.md for more info. + // See https://github.com/flutter/flutter/wiki/Plugins-and-Packages-repository-structure#gradle-structure for more info. def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' if (System.getenv().containsKey(artifactRepoKey)) { println "Using artifact hub" From 621aee2d64d3c6eeb2b0c400eec14056c7ae18b2 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Fri, 28 Jul 2023 12:36:50 -0400 Subject: [PATCH 12/12] Update settings.gradle --- .../camera_android_camerax/example/android/settings.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/camera/camera_android_camerax/example/android/settings.gradle b/packages/camera/camera_android_camerax/example/android/settings.gradle index 1511b13bdbd..3a97314b38c 100644 --- a/packages/camera/camera_android_camerax/example/android/settings.gradle +++ b/packages/camera/camera_android_camerax/example/android/settings.gradle @@ -10,7 +10,7 @@ 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. +// See https://github.com/flutter/flutter/wiki/Plugins-and-Packages-repository-structure#gradle-structure for more info. buildscript { repositories { maven {