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