Add a property to use gn_artifacts.

This property will be used to set an alternative location for the
flutter artifacts.

Bug: https://github.com/flutter/flutter/issues/81855
Change-Id: I3c717ad09ca15ead8edcac0477d260e958f4de77
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/31300
Reviewed-by: Xilai Zhang <xilaizhang@google.com>
Commit-Queue: Godofredo Contreras <godofredoc@google.com>
diff --git a/recipe_modules/repo_util/api.py b/recipe_modules/repo_util/api.py
index b3b883b..d1d2870 100644
--- a/recipe_modules/repo_util/api.py
+++ b/recipe_modules/repo_util/api.py
@@ -242,6 +242,8 @@
             ('darwin' if self.m.platform.name == 'mac' else 'win'),
         'REVISION': self.get_commit(checkout_path)
     }
+    if self.m.properties.get('gn_artifacts', '') == 'true':
+      env['FLUTTER_STORAGE_BASE_URL'] = 'https://storage.googleapis.com/flutter_archives_v2'
     env_prefixes = {'PATH': ['%s' % str(flutter_bin), '%s' % str(dart_bin)]}
     return env, env_prefixes
 
diff --git a/recipe_modules/repo_util/examples/full.py b/recipe_modules/repo_util/examples/full.py
index a1f3b70..ffcc66a 100644
--- a/recipe_modules/repo_util/examples/full.py
+++ b/recipe_modules/repo_util/examples/full.py
@@ -35,7 +35,7 @@
   yield (
       api.test(
           'basic',
-          api.properties(git_branch='beta'),
+          api.properties(git_branch='beta', gn_artifacts='true'),
           api.repo_util.flutter_environment_data(),
           api.step_data('Identify branches.git rev-parse', stdout=api.raw_io.output_text('abchash')),
           api.step_data('Identify branches.git branch', stdout=api.raw_io.output_text('branch1\nbranch2')),
@@ -66,4 +66,4 @@
       api.expect_exception('ValueError') +
       api.step_data("Checkout source code.bot_update", retcode=1) +
       api.repo_util.flutter_environment_data()
-  )
\ No newline at end of file
+  )