1# Copyright 2021 The Pigweed Authors 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); you may not 4# use this file except in compliance with the License. You may obtain a copy of 5# the License at 6# 7# https://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, WITHOUT 11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12# License for the specific language governing permissions and limitations under 13# the License. 14 15load("@rules_python//python:defs.bzl", "py_library") 16load("//pw_build:python.bzl", "pw_py_binary", "pw_py_test") 17 18package(default_visibility = ["//visibility:public"]) 19 20licenses(["notice"]) 21 22py_library( 23 name = "pw_build", 24 srcs = [ 25 "pw_build/__init__.py", 26 "pw_build/bazel_query.py", 27 "pw_build/bazel_to_gn.py", 28 "pw_build/build_recipe.py", 29 "pw_build/collect_wheels.py", 30 "pw_build/copy_and_patch.py", 31 "pw_build/copy_from_cipd.py", 32 "pw_build/create_gn_venv.py", 33 "pw_build/create_python_tree.py", 34 "pw_build/error.py", 35 "pw_build/exec.py", 36 "pw_build/file_prefix_map.py", 37 "pw_build/generate_cc_blob_library.py", 38 "pw_build/generate_modules_lists.py", 39 "pw_build/generate_python_package.py", 40 "pw_build/generate_python_package_gn.py", 41 "pw_build/generate_python_requirements.py", 42 "pw_build/generate_python_wheel.py", 43 "pw_build/generate_python_wheel_cache.py", 44 "pw_build/generate_report.py", 45 "pw_build/generated_tests.py", 46 "pw_build/gn_resolver.py", 47 "pw_build/gn_target.py", 48 "pw_build/gn_writer.py", 49 "pw_build/host_tool.py", 50 "pw_build/merge_profraws.py", 51 "pw_build/mirror_tree.py", 52 "pw_build/nop.py", 53 "pw_build/pip_install_python_deps.py", 54 "pw_build/python_package.py", 55 "pw_build/python_runner.py", 56 "pw_build/wrap_ninja.py", 57 "pw_build/zip.py", 58 ], 59 imports = ["."], 60 deps = [ 61 "//pw_cli/py:pw_cli", 62 "//pw_config_loader/py:pw_config_loader", 63 "//pw_presubmit/py:pw_presubmit", 64 ], 65) 66 67py_library( 68 name = "pw_project_builder", 69 srcs = [ 70 "pw_build/project_builder.py", 71 "pw_build/project_builder_argparse.py", 72 "pw_build/project_builder_context.py", 73 "pw_build/project_builder_prefs.py", 74 "pw_build/project_builder_presubmit_runner.py", 75 ], 76 imports = ["."], 77 deps = [ 78 ":pw_build", 79 ], 80) 81 82pw_py_binary( 83 name = "generate_cc_blob_library", 84 srcs = [ 85 "pw_build/generate_cc_blob_library.py", 86 ], 87) 88 89pw_py_binary( 90 name = "copy_and_patch", 91 srcs = ["pw_build/copy_and_patch.py"], 92 deps = ["@python_packages//patch"], 93) 94 95pw_py_binary( 96 name = "pigweed_upstream_build", 97 srcs = ["pw_build/pigweed_upstream_build.py"], 98 deps = [ 99 ":pw_project_builder", 100 "//pw_watch/py:pw_watch", 101 ], 102) 103 104pw_py_binary( 105 name = "project_builder", 106 srcs = ["pw_build/project_builder.py"], 107 deps = [ 108 ":pw_project_builder", 109 ], 110) 111 112pw_py_test( 113 name = "bazel_query_test", 114 size = "small", 115 srcs = [ 116 "bazel_query_test.py", 117 ], 118 deps = [ 119 ":pw_build", 120 ], 121) 122 123pw_py_test( 124 name = "bazel_to_gn_test", 125 size = "small", 126 srcs = [ 127 "bazel_to_gn_test.py", 128 ], 129 deps = [ 130 ":pw_build", 131 ], 132) 133 134pw_py_test( 135 name = "create_python_tree_test", 136 size = "small", 137 srcs = [ 138 "create_python_tree_test.py", 139 ], 140 # TODO(b/373956968): Bazel support for generated Python packages. 141 tags = ["manual"], 142 deps = [ 143 ":pw_build", 144 "@python_packages//parameterized", 145 ], 146) 147 148pw_py_test( 149 name = "file_prefix_map_test", 150 size = "small", 151 srcs = [ 152 "file_prefix_map_test.py", 153 ], 154 deps = [ 155 ":pw_build", 156 ], 157) 158 159pw_py_test( 160 name = "generate_cc_blob_library_test", 161 size = "small", 162 srcs = [ 163 "generate_cc_blob_library_test.py", 164 ], 165 deps = [ 166 ":pw_build", 167 ], 168) 169 170pw_py_test( 171 name = "gn_target_test", 172 size = "small", 173 srcs = [ 174 "gn_target_test.py", 175 ], 176 deps = [ 177 ":pw_build", 178 ], 179) 180 181pw_py_test( 182 name = "gn_writer_test", 183 size = "small", 184 srcs = [ 185 "gn_writer_test.py", 186 ], 187 # TODO(b/314139942): Requires GN on the path. 188 tags = ["manual"], 189 deps = [ 190 ":pw_build", 191 ], 192) 193 194pw_py_test( 195 name = "python_runner_test", 196 size = "small", 197 srcs = [ 198 "python_runner_test.py", 199 ], 200 deps = [ 201 ":pw_build", 202 ], 203) 204 205pw_py_test( 206 name = "zip_test", 207 size = "small", 208 srcs = [ 209 "zip_test.py", 210 ], 211 deps = [ 212 ":pw_build", 213 ], 214) 215 216pw_py_test( 217 name = "build_recipe_test", 218 size = "small", 219 srcs = [ 220 "build_recipe_test.py", 221 ], 222 deps = [ 223 ":pw_project_builder", 224 "@python_packages//parameterized", 225 ], 226) 227 228pw_py_test( 229 name = "project_builder_prefs_test", 230 size = "small", 231 srcs = [ 232 "project_builder_prefs_test.py", 233 ], 234 deps = [ 235 ":pw_project_builder", 236 "@python_packages//parameterized", 237 ], 238) 239