1// Copyright (C) 2018 The Android Open Source Project 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 15package { 16 default_team: "trendy_team_native_tools_libraries", 17 default_applicable_licenses: ["Android-Apache-2.0"], 18} 19 20python_binary_host { 21 name: "external_updater", 22 main: "external_updater.py", 23 srcs: ["external_updater.py"], 24 libs: ["external_updater_lib"], 25 required: ["cargo_embargo"], 26 data: [":bpfmt"], 27 version: { 28 py3: { 29 embedded_launcher: false, 30 }, 31 }, 32} 33 34python_binary_host { 35 name: "external_updater_notifier", 36 main: "notifier.py", 37 srcs: ["notifier.py"], 38} 39 40python_library_host { 41 name: "external_updater_lib", 42 srcs: [ 43 "archive_utils.py", 44 "base_updater.py", 45 "crates_updater.py", 46 "fileutils.py", 47 "git_updater.py", 48 "git_utils.py", 49 "github_archive_updater.py", 50 "hashtags.py", 51 "manifest.py", 52 "metadata.proto", 53 "reviewers.py", 54 "updater_utils.py", 55 ], 56 libs: [ 57 "libprotobuf-python", 58 ], 59 proto: { 60 canonical_path_from_root: false, 61 }, 62 data: [ 63 "update_package.sh", 64 "regen_bp.sh", 65 ], 66} 67 68python_defaults { 69 name: "external_updater_test_defaults", 70 version: { 71 py3: { 72 embedded_launcher: true, 73 }, 74 }, 75} 76 77python_library_host { 78 name: "external_updater_test_lib", 79 srcs: [ 80 "tests/gitrepo.py", 81 ], 82 proto: { 83 canonical_path_from_root: false, 84 }, 85} 86 87python_test_host { 88 name: "external_updater_fileutils_test", 89 defaults: ["external_updater_test_defaults"], 90 main: "test_fileutils.py", 91 srcs: ["test_fileutils.py"], 92 libs: ["external_updater_lib"], 93 test_options: { 94 unit_test: true, 95 }, 96} 97 98python_test_host { 99 name: "external_updater_github_archive_updater_test", 100 defaults: ["external_updater_test_defaults"], 101 main: "test_github_archive_updater.py", 102 srcs: ["test_github_archive_updater.py"], 103 libs: ["external_updater_lib"], 104 test_options: { 105 unit_test: true, 106 }, 107} 108 109python_test_host { 110 name: "external_updater_reviewers_test", 111 defaults: ["external_updater_test_defaults"], 112 main: "external_updater_reviewers_test.py", 113 srcs: ["external_updater_reviewers_test.py"], 114 libs: ["external_updater_lib"], 115 test_options: { 116 unit_test: true, 117 }, 118} 119 120python_test_host { 121 name: "external_updater_git_utils_test", 122 defaults: ["external_updater_test_defaults"], 123 main: "tests/test_git_utils.py", 124 srcs: ["tests/test_git_utils.py"], 125 libs: [ 126 "external_updater_lib", 127 "external_updater_test_lib", 128 ], 129 test_options: { 130 unit_test: true, 131 }, 132} 133 134python_test_host { 135 name: "external_updater_gitrepo_test", 136 defaults: ["external_updater_test_defaults"], 137 main: "tests/test_gitrepo.py", 138 srcs: ["tests/test_gitrepo.py"], 139 libs: [ 140 "external_updater_test_lib", 141 ], 142 test_options: { 143 unit_test: true, 144 }, 145} 146 147// This test is intentionally not in the tests/ directory. Everything in the 148// tests/ directory should be runnable with pytest, and this file is not because 149// it depends on the generated protobuf modules. 150python_test_host { 151 name: "external_updater_base_updater_test", 152 defaults: ["external_updater_test_defaults"], 153 main: "test_base_updater.py", 154 srcs: ["test_base_updater.py"], 155 libs: [ 156 "external_updater_lib", 157 "external_updater_test_lib", 158 ], 159 test_options: { 160 unit_test: true, 161 }, 162} 163 164// Same as above. Needs protobuf. 165python_test_host { 166 name: "external_updater_updater_utils_test", 167 defaults: ["external_updater_test_defaults"], 168 main: "test_updater_utils.py", 169 srcs: ["test_updater_utils.py"], 170 libs: [ 171 "external_updater_lib", 172 "external_updater_test_lib", 173 ], 174 test_options: { 175 unit_test: true, 176 }, 177} 178 179// The tests in tests/endtoend are not built as a Soong module because we can't 180// run those tests via python_test_host. It's an end-to-end test so it needs to 181// run `repo`, but `repo init` will try to clone the real repo source (the thing 182// in PATH is just a launcher), which our Python can't do (the SSL module's 183// certificate validation is not configured for that). Run those tests with 184// `pytest tests/endtoend`. 185