xref: /aosp_15_r20/external/cronet/android/tools/import/copy.bara.sky (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1# Copyright 2023 Google Inc. All rights reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15common_excludes = [
16    # Exclude all Android build files
17    "**/Android.bp",
18    "**/Android.mk",
19    # Remove Bazel BUILD files as they are recognized in AOSP (roboleaf).
20    "**/BUILD",
21
22    # Exclude existing *OWNERS files
23    "**/*OWNERS",
24    "**/.git/**",
25    "**/.gitignore",
26    "**/.gitmodules",
27    "**/.github/**",
28    "**/MODULE.bazel.lock",
29]
30
31cronet_origin_files = glob(
32    include = [
33        "base/**",
34        "build/**",
35        "build/buildflag.h",
36        "chrome/VERSION",
37        "components/cronet/**",
38        "components/metrics/**",
39        # See https://chromium-review.googlesource.com/c/chromium/src/+/4896104
40        "components/miracle_parameter/**",
41        "components/nacl/**",
42        "components/prefs/**",
43        "crypto/**",
44        "ipc/**",
45        "net/**",
46        # Note: Only used for tests.
47        "testing/**",
48        "url/**",
49        "LICENSE",
50    ],
51    exclude = common_excludes + [
52        # Per aosp/2367109
53        "build/android/CheckInstallApk-debug.apk",
54        "build/android/unused_resources/**",
55        "build/linux/**",
56
57        # Per aosp/2374766
58        "components/cronet/ios/**",
59        "components/cronet/native/**",
60
61        # Per aosp/2399270
62        "testing/buildbot/**",
63
64        # Exclude all third-party directories. Those are specified explicitly
65        # below, so no dependency can accidentally creep in.
66        "**/third_party/**",
67    ],
68) + glob(
69    # Explicitly include third-party dependencies.
70    # Note: some third-party dependencies include a third_party folder within
71    # them. So far, this has not become a problem.
72    include = [
73        "base/third_party/cityhash/**",
74        "base/third_party/cityhash_v103/**",
75        "base/third_party/double_conversion/**",
76        "base/third_party/dynamic_annotations/**",
77        "base/third_party/icu/**",
78        "base/third_party/nspr/**",
79        "base/third_party/superfasthash/**",
80        "base/third_party/valgrind/**",
81        # Those are temporarily needed until Chromium finish the migration
82        # of libc++[abi]
83        "buildtools/third_party/libc++/**",
84        "buildtools/third_party/libc++abi/**",
85        "net/third_party/quiche/**",
86        "net/third_party/uri_template/**",
87        "third_party/abseil-cpp/**",
88        "third_party/android_ndk/sources/android/cpufeatures/**",
89        # See https://chromium-review.googlesource.com/c/chromium/src/+/4885470
90        # Note: Only used for tests.
91        "third_party/anonymous_tokens/**",
92        "third_party/ashmem/**",
93        # Note: Only used for tests.
94        "third_party/apache-portable-runtime/**",
95        "third_party/boringssl/**",
96        "third_party/brotli/**",
97        # Note: Only used for tests.
98        "third_party/ced/**",
99        "third_party/cpu_features/**",
100        # Note: Only used for tests.
101        "third_party/google_benchmark/**",
102        # Note: Only used for tests.
103        "third_party/googletest/**",
104        "third_party/icu/**",
105        "third_party/jni_zero/**",
106        "third_party/libc++/**",
107        "third_party/libc++abi/**",
108        "third_party/libevent/**",
109        # Note: Only used for tests.
110        "third_party/libxml/**",
111        # Note: Only used for tests.
112        "third_party/lss/**",
113        "third_party/metrics_proto/**",
114        "third_party/modp_b64/**",
115        # Note: Only used for tests.
116        "third_party/netty4/**",
117        # Note: Only used for tests.
118        "third_party/netty-tcnative/**",
119        "third_party/protobuf/**",
120        # Note: Only used for tests.
121        "third_party/quic_trace/**",
122        # Note: Only used for tests.
123        "third_party/re2/**",
124        "third_party/rust/**",
125        # Note: Cronet currently uses Android's zlib
126        # "third_party/zlib/**",
127        "url/third_party/mozilla/**",
128    ],
129    exclude = common_excludes + [
130        # Those crates are missing README.chromium and LICENSE files.
131        # See b/369505588 and b/369075726
132        "third_party/rust/chromium_crates_io/vendor/cc-*/**",
133        "third_party/rust/cc/**",
134        "third_party/rust/chromium_crates_io/vendor/codespan-reporting-*/**",
135        "third_party/rust/codespan_reporting/**",
136        "third_party/rust/chromium_crates_io/vendor/link-cplusplus-*/**",
137        "third_party/rust/chromium_crates_io/vendor/minimal-lexical-*/**",
138        "third_party/rust/chromium_crates_io/vendor/rstest_macros-*/**",
139        "third_party/rust/rstest_macros/**",
140        "third_party/rust/chromium_crates_io/vendor/rstest-*/**",
141        "third_party/rust/rstest/**",
142        "third_party/rust/chromium_crates_io/vendor/rstest_reuse-*/**",
143        "third_party/rust/rstest_reuse/**",
144        "third_party/rust/chromium_crates_io/vendor/rustc-demangle-capi-*/**",
145        "third_party/rust/rustc_demangle_capi/**",
146        "third_party/rust/chromium_crates_io/vendor/wasi-*+wasi-snapshot-preview1/**",
147        "third_party/rust/chromium_crates_io/vendor/winapi-i686-pc-windows-gnu-*/**",
148        "third_party/rust/chromium_crates_io/vendor/winapi-x86_64-pc-windows-gnu-*/**",
149        "third_party/rust/chromium_crates_io/vendor/winapi-0.*/**",
150        "third_party/rust/winapi/**",
151    ],
152)
153
154core.workflow(
155    name = "import_cronet",
156    authoring = authoring.overwrite("Cronet Mainline Eng <[email protected]>"),
157    # Origin folder is specified via source_ref argument, see import_cronet.sh
158    origin = folder.origin(),
159    origin_files = cronet_origin_files,
160    destination = git.destination(
161        # The destination URL is set by the invoking script.
162        url = "overwritten/by/script",
163        push = "upstream-import",
164    ),
165    mode = "SQUASH",
166)
167