diff --git a/Cronet/tools/import/copy.bara.sky b/Cronet/tools/import/copy.bara.sky new file mode 100644 index 0000000000..64256a0be1 --- /dev/null +++ b/Cronet/tools/import/copy.bara.sky @@ -0,0 +1,110 @@ +# Copyright 2023 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +common_excludes = [ + # Exclude all Android build files + "**/Android.bp", + "**/Android.mk", + + # Exclude existing OWNERS files + "**/OWNERS", +] + +cronet_origin_files = glob( + include = [ + "base/**", + "build/**", + "build/buildflag.h", + "chrome/VERSION", + "components/cronet/**", + "components/grpc_suport/**", + "components/metrics/**", + "components/nacl/**", + "components/prefs/**", + "crypto/**", + "ipc/**", + "net/**", + "url/**", + "LICENSE", + ], + exclude = common_excludes + [ + # Per aosp/2367109 + "build/android/CheckInstallApk-debug.apk", + "build/android/unused_resources/**", + "build/linux/**", + + # Per aosp/2374766 + "components/cronet/ios/**", + "components/cronet/native/**", + + + # Exclude all third-party directories. Those are specified explicitly + # below, so no dependency can accidentally creep in. + "**/third_party/**", + ], +) + glob( + # Explicitly include third-party dependencies. + # Note: some third-party dependencies include a third_party folder within + # them. So far, this has not become a problem. + include = [ + "base/third_party/cityhash/**", + "base/third_party/cityhash_v103/**", + "base/third_party/double_conversion/**", + "base/third_party/dynamic_annotations/**", + "base/third_party/icu/**", + "base/third_party/nspr/**", + "base/third_party/superfasthash/**", + # TODO: we should be able to remove this dependency. + "base/third_party/symbolize/**", + "base/third_party/valgrind/**", + "base/third_party/xdg_user_dirs/**", + # Not present in source repo; requires gclient sync. + "buildtools/third_party/libc++/**", + # Not present in source repo; requires gclient sync. + "buildtools/third_party/libc++abi/**", + "net/third_party/quiche/**", + "net/third_party/uri_template/**", + "third_party/abseil-cpp/**", + "third_party/android_ndk/sources/android/cpufeatures/**", + "third_party/ashmem/**", + "third_party/boringssl/**", + "third_party/brotli/**", + # Not present in source repo; requires gclient sync. + "third_party/icu/**", + "third_party/libevent/**", + "third_party/metrics_proto/**", + "third_party/modp_b64/**", + "third_party/protobuf/**", + "third_party/zlib/**", + ], + exclude = common_excludes, +) + +core.workflow( + name = "import_cronet", + authoring = authoring.overwrite("Cronet Mainline Eng "), + origin = git.origin( + url = "rpc://chromium/chromium/src", + # Source ref is set by the invoking script. + ref = "overwritten-by-script", + partial_fetch = True, + ), + origin_files = cronet_origin_files, + destination = git.destination( + # The destination URL is set by the invoking script. + url = "overwritten/by/script", + push = "upstream-import", + ), + mode = "SQUASH", +) diff --git a/Cronet/tools/import/import_cronet.sh b/Cronet/tools/import/import_cronet.sh new file mode 100755 index 0000000000..76429147d2 --- /dev/null +++ b/Cronet/tools/import/import_cronet.sh @@ -0,0 +1,76 @@ +#!/bin/bash + +# Copyright 2023 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Script to invoke copybara locally to import Cronet into Android. +# Inputs: +# Environment: +# ANDROID_BUILD_TOP: path the root of the current Android directory. +# Arguments: +# -l: The last revision that was imported. +# -n: The new revision to import. + +OPTSTRING=l:n: + +usage() { + cat <