Merge changes I403ffbf7,I62891082,Iac185d3a,I2b78a7b8
* changes:
cronet import: add test dependencies that were imported in aosp/2399270
cronet import: use folder.origin instead of git.origin
cronet import: use public chromium repository as a source
cronet import: add --git-origin-checkout-hook to run gclient
diff --git a/Cronet/tools/import/copy.bara.sky b/Cronet/tools/import/copy.bara.sky
index 2acf8cd..c066fc0 100644
--- a/Cronet/tools/import/copy.bara.sky
+++ b/Cronet/tools/import/copy.bara.sky
@@ -19,6 +19,7 @@
# Exclude existing *OWNERS files
"**/*OWNERS",
+ "**/.git/**",
]
cronet_origin_files = glob(
@@ -35,6 +36,8 @@
"crypto/**",
"ipc/**",
"net/**",
+ # Note: Only used for tests.
+ "testing/**",
"url/**",
"LICENSE",
],
@@ -48,6 +51,8 @@
"components/cronet/ios/**",
"components/cronet/native/**",
+ # Per aosp/2399270
+ "testing/buildbot/**",
# Exclude all third-party directories. Those are specified explicitly
# below, so no dependency can accidentally creep in.
@@ -69,10 +74,10 @@
"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/**",
+ # Note: Only used for tests.
+ "net/third_party/nist-pkits/**",
"net/third_party/quiche/**",
"net/third_party/uri_template/**",
"third_party/abseil-cpp/**",
@@ -80,12 +85,21 @@
"third_party/ashmem/**",
"third_party/boringssl/**",
"third_party/brotli/**",
- # Not present in source repo; requires gclient sync.
+ # Note: Only used for tests.
+ "third_party/ced/**",
+ # Note: Only used for tests.
+ "third_party/googletest/**",
"third_party/icu/**",
"third_party/libevent/**",
+ # Note: Only used for tests.
+ "third_party/libxml/**",
+ # Note: Only used for tests.
+ "third_party/lss/**",
"third_party/metrics_proto/**",
"third_party/modp_b64/**",
"third_party/protobuf/**",
+ # Note: Only used for tests.
+ "third_party/quic_trace/**",
"third_party/zlib/**",
],
exclude = common_excludes,
@@ -94,12 +108,8 @@
core.workflow(
name = "import_cronet",
authoring = authoring.overwrite("Cronet Mainline Eng <cronet-mainline-eng+copybara@google.com>"),
- origin = git.origin(
- url = "rpc://chromium/chromium/src",
- # Source ref is set by the invoking script.
- ref = "overwritten-by-script",
- partial_fetch = True,
- ),
+ # Origin folder is specified via source_ref argument, see import_cronet.sh
+ origin = folder.origin(),
origin_files = cronet_origin_files,
destination = git.destination(
# The destination URL is set by the invoking script.
diff --git a/Cronet/tools/import/import_cronet.sh b/Cronet/tools/import/import_cronet.sh
index eb82551..d0c8deb 100755
--- a/Cronet/tools/import/import_cronet.sh
+++ b/Cronet/tools/import/import_cronet.sh
@@ -33,6 +33,8 @@
exit 1
}
+COPYBARA_FOLDER_ORIGIN="/tmp/copybara-origin"
+
#######################################
# Create upstream-import branch in external/cronet.
# Globals:
@@ -49,22 +51,59 @@
}
#######################################
+# Setup folder.origin for copybara inside /tmp
+# Globals:
+# COPYBARA_FOLDER_ORIGIN
+# Arguments:
+# new_rev, string
+#######################################
+setup_folder_origin() {
+ local _new_rev=$1
+ mkdir -p "${COPYBARA_FOLDER_ORIGIN}"
+ cd "${COPYBARA_FOLDER_ORIGIN}"
+
+ # For this to work _new_rev must be a branch or a tag.
+ git clone --depth=1 --branch "${_new_rev}" https://chromium.googlesource.com/chromium/src.git
+
+ cat <<EOF >.gclient
+solutions = [
+ {
+ "name": "src",
+ "url": "https://chromium.googlesource.com/chromium/src.git",
+ "managed": False,
+ "custom_deps": {},
+ "custom_vars": {},
+ },
+]
+target_os = ["android"]
+EOF
+ cd src
+ # Set appropriate gclient flags to speed up syncing.
+ gclient sync \
+ --no-history
+ --shallow
+}
+
+#######################################
# Runs the copybara import of Chromium
# Globals:
# ANDROID_BUILD_TOP
+# COPYBARA_FOLDER_ORIGIN
# Arguments:
-# new_rev, string
# last_rev, string or empty
# force, string or empty
#######################################
do_run_copybara() {
- local _new_rev=$1
- local _last_rev=$2
- local _force=$3
+ local _last_rev=$1
+ local _force=$2
local -a flags
flags+=(--git-destination-url="file://${ANDROID_BUILD_TOP}/external/cronet")
- flags+=(--repo-timeout 3h)
+ flags+=(--repo-timeout 3m)
+
+ # buildtools/third_party/libc++ contains an invalid symlink
+ flags+=(--folder-origin-ignore-invalid-symlinks)
+ flags+=(--git-no-verify)
if [ ! -z "${_force}" ]; then
flags+=(--force)
@@ -77,7 +116,7 @@
/google/bin/releases/copybara/public/copybara/copybara \
"${flags[@]}" \
"${ANDROID_BUILD_TOP}/packages/modules/Connectivity/Cronet/tools/import/copy.bara.sky" \
- import_cronet "${_new_rev}"
+ import_cronet "${COPYBARA_FOLDER_ORIGIN}/src"
}
while getopts $OPTSTRING opt; do
@@ -96,5 +135,6 @@
fi
setup_upstream_import_branch
-do_run_copybara "${new_rev}" "${last_rev}" "${force}"
+setup_folder_origin "${new_rev}"
+do_run_copybara "${last_rev}" "${force}"