[build_fuchsia_artifacts] Move license copying into BuildBucket(). (#25815)

Currently, the licenses are copied into the bucket just before
uploading it. Copying the licenses is definitely more about "building"
the bucket than it is about "processing the CIPD package", but
concretely, some tools complain if the license files arent there, and
I'd like to be able to use the cipd tool to upload the bucket
directly.

Co-authored-by: Hunter Freyer <hjfreyer@google.com>
diff --git a/tools/fuchsia/build_fuchsia_artifacts.py b/tools/fuchsia/build_fuchsia_artifacts.py
index 8be1fbf..42bbe26 100755
--- a/tools/fuchsia/build_fuchsia_artifacts.py
+++ b/tools/fuchsia/build_fuchsia_artifacts.py
@@ -176,6 +176,27 @@
   CopyVulkanDepsToBucket(out_dir, deps_dir, arch)
   CopyIcuDepsToBucket(out_dir, deps_dir)
 
+  # Copy the CIPD YAML template from the source directory to be next to the bucket
+  # we are about to package.
+  cipd_yaml = os.path.join(_script_dir, 'fuchsia.cipd.yaml')
+  CopyFiles(cipd_yaml, os.path.join(_bucket_directory, 'fuchsia.cipd.yaml'))
+
+  # Copy the license files from the source directory to be next to the bucket we
+  # are about to package.
+  bucket_root = os.path.join(_bucket_directory, 'flutter')
+  licenses_root = os.path.join(_src_root_dir, 'flutter/ci/licenses_golden')
+  license_files = [
+    'licenses_flutter',
+    'licenses_fuchsia',
+    'licenses_gpu',
+    'licenses_skia',
+    'licenses_third_party'
+  ]
+  for license in license_files:
+    src_path = os.path.join(licenses_root, license)
+    dst_path = os.path.join(bucket_root, license)
+    CopyPath(src_path, dst_path)
+
 def CheckCIPDPackageExists(package_name, tag):
   '''Check to see if the current package/tag combo has been published'''
   command = [
@@ -207,27 +228,6 @@
         raise
 
 def ProcessCIPDPackage(upload, engine_version):
-  # Copy the CIPD YAML template from the source directory to be next to the bucket
-  # we are about to package.
-  cipd_yaml = os.path.join(_script_dir, 'fuchsia.cipd.yaml')
-  CopyFiles(cipd_yaml, os.path.join(_bucket_directory, 'fuchsia.cipd.yaml'))
-
-  # Copy the license files from the source directory to be next to the bucket we
-  # are about to package.
-  bucket_root = os.path.join(_bucket_directory, 'flutter')
-  licenses_root = os.path.join(_src_root_dir, 'flutter/ci/licenses_golden')
-  license_files = [
-    'licenses_flutter',
-    'licenses_fuchsia',
-    'licenses_gpu',
-    'licenses_skia',
-    'licenses_third_party'
-  ]
-  for license in license_files:
-    src_path = os.path.join(licenses_root, license)
-    dst_path = os.path.join(bucket_root, license)
-    CopyPath(src_path, dst_path)
-
   if not upload or not IsLinux():
     RunCIPDCommandWithRetries([
         'cipd', 'pkg-build', '-pkg-def', 'fuchsia.cipd.yaml', '-out',