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