| # Copyright 2019 The Pigweed Authors |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| # use this file except in compliance with the License. You may obtain a copy of |
| # the License at |
| # |
| # https://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| # License for the specific language governing permissions and limitations under |
| # the License. |
| |
| load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin") |
| load("@bazel_skylib//rules:copy_file.bzl", "copy_file") |
| load("@bazel_skylib//rules:native_binary.bzl", "native_binary") |
| load("@pigweed//pw_build:compatibility.bzl", "incompatible_with_mcu") |
| load("@pigweed//pw_ide/bazel/compile_commands:pw_compile_commands_generator.bzl", "pw_compile_commands_generator") |
| load("@rules_license//rules:license.bzl", "license") |
| load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library") |
| |
| package( |
| default_applicable_licenses = ["//:license"], |
| default_visibility = ["//visibility:public"], |
| ) |
| |
| license( |
| name = "license", |
| package_name = "pigweed", |
| license_kinds = ["@rules_license//licenses/spdx:Apache-2.0"], |
| ) |
| |
| licenses(["notice"]) |
| |
| # Files visible across Pigweed. |
| exports_files( |
| [ |
| "pigweed.json", |
| "tsconfig.json", |
| # Needed for releasing //pw_bluetooth_sapphire/fuchsia/bt_host. |
| "LICENSE", |
| "PIGWEED_MODULES", |
| ], |
| visibility = [":__subpackages__"], |
| ) |
| |
| # Files that are enumerated so they can be referenced by flags. |
| exports_files( |
| ["rustfmt.toml"], |
| visibility = ["//visibility:private"], |
| ) |
| |
| filegroup( |
| name = "pigweed_json", |
| srcs = ["pigweed.json"], |
| visibility = [":__subpackages__"], |
| ) |
| |
| native_binary( |
| name = "pw", |
| src = "//pw_build/py:workflows_launcher", |
| ) |
| |
| alias( |
| name = "change", |
| actual = "//pw_change/py:change", |
| ) |
| |
| alias( |
| name = "watch", |
| actual = "//pw_watch/py:bazel", |
| ) |
| |
| alias( |
| name = "format", |
| actual = "//pw_presubmit/py:format", |
| ) |
| |
| alias( |
| name = "push", |
| actual = "//pw_change/py:push", |
| ) |
| |
| alias( |
| name = "review", |
| actual = "//pw_change/py:review", |
| ) |
| |
| alias( |
| name = "presubmit", |
| actual = "//pw_presubmit/py:local_presubmit", |
| ) |
| |
| # Symlink to clangd, for user convenience. |
| copy_file( |
| name = "copy_clangd", |
| src = "@llvm_toolchain//:bin/clangd", |
| out = "clangd", |
| allow_symlink = True, |
| ) |
| |
| pw_compile_commands_generator( |
| name = "update_host_kernel_compile_commands", |
| config = "k_host", |
| display_name = "Host Kernel", |
| rust_target_patterns = [ |
| "//pw_kernel/...", |
| ], |
| ) |
| |
| pw_compile_commands_generator( |
| name = "update_rp2350_kernel_compile_commands", |
| config = "k_rp2350", |
| display_name = "RP2350 Kernel", |
| rust_target_patterns = [ |
| "//pw_kernel/...", |
| ], |
| ) |
| |
| pw_compile_commands_generator( |
| name = "update_qemu_mps2_an505_kernel_compile_commands", |
| config = "k_qemu_mps2_an505", |
| display_name = "QEMU MPS2 AN505 Kernel", |
| rust_target_patterns = [ |
| "//pw_kernel/...", |
| ], |
| ) |
| |
| pw_compile_commands_generator( |
| name = "update_qemu_virt_riscv32_kernel_compile_commands", |
| config = "k_qemu_virt_riscv32", |
| display_name = "QEMU Virt RISCV32 Kernel", |
| rust_target_patterns = [ |
| "//pw_kernel/...", |
| ], |
| ) |
| |
| pw_compile_commands_generator( |
| name = "update_host_compile_commands", |
| display_name = "Host", |
| platform = "@bazel_tools//tools:host_platform", |
| target_patterns = [ |
| "//...", |
| # Exclude build_origin because it depends on a custom workspace status script |
| # that is not set up in standard builds, which causes wildcard //... builds to fail. |
| "-//pw_build_info:build_origin", |
| ], |
| ) |
| |
| pw_compile_commands_generator( |
| name = "update_host_googletest_compile_commands", |
| display_name = "Host (GoogleTest)", |
| platform = "//targets/host:host_googletest", |
| target_patterns = [ |
| "//...", |
| # Exclude build_origin because it depends on a custom workspace status script |
| # that is not set up in standard builds, which causes wildcard //... builds to fail. |
| "-//pw_build_info:build_origin", |
| ], |
| ) |
| |
| pw_compile_commands_generator( |
| name = "update_pw_rp2350_freertos_compile_commands", |
| display_name = "PW RP2350 FreeRTOS", |
| platform = "//targets/pw_rp2350/freertos:pw_rp2350", |
| target_patterns = [ |
| "//...", |
| # Exclude build_origin because it depends on a custom workspace status script |
| # that is not set up in standard builds, which causes wildcard //... builds to fail. |
| "-//pw_build_info:build_origin", |
| ], |
| ) |
| |
| pw_compile_commands_generator( |
| name = "update_rp2040_compile_commands", |
| display_name = "RP2040", |
| platform = "//targets/rp2040", |
| target_patterns = [ |
| "//...", |
| # Exclude build_origin because it depends on a custom workspace status script |
| # that is not set up in standard builds, which causes wildcard //... builds to fail. |
| "-//pw_build_info:build_origin", |
| ], |
| ) |
| |
| pw_compile_commands_generator( |
| name = "update_rp2350_compile_commands", |
| display_name = "RP2350", |
| platform = "//targets/rp2040:rp2350", |
| target_patterns = [ |
| "//...", |
| # Exclude build_origin because it depends on a custom workspace status script |
| # that is not set up in standard builds, which causes wildcard //... builds to fail. |
| "-//pw_build_info:build_origin", |
| ], |
| ) |
| |
| pw_compile_commands_generator( |
| name = "refresh_compile_commands_for_fuchsia_sdk", |
| display_name = "Fuchsia SDK", |
| platform = "//targets/fuchsia:fuchsia_host", |
| target_compatible_with = select({ |
| "@platforms//os:linux": [], |
| "//conditions:default": ["@platforms//:incompatible"], |
| }), |
| target_patterns = [ |
| "//pw_bluetooth_sapphire/fuchsia/bt_host:test_pkg", |
| "//pw_bluetooth_sapphire/fuchsia/host/att:test_pkg", |
| "//pw_bluetooth_sapphire/fuchsia/host/common:test_pkg", |
| "//pw_bluetooth_sapphire/fuchsia/host/controllers:test_pkg", |
| "//pw_bluetooth_sapphire/fuchsia/host/fidl:test_pkg", |
| "//pw_bluetooth_sapphire/fuchsia/host/gap:test_pkg", |
| "//pw_bluetooth_sapphire/fuchsia/host/gatt:test_pkg", |
| "//pw_bluetooth_sapphire/fuchsia/host/hci:test_pkg", |
| "//pw_bluetooth_sapphire/fuchsia/host/hci-spec:test_pkg", |
| "//pw_bluetooth_sapphire/fuchsia/host/iso:test_pkg", |
| "//pw_bluetooth_sapphire/fuchsia/host/l2cap:test_pkg", |
| "//pw_bluetooth_sapphire/fuchsia/host/sco:test_pkg", |
| "//pw_bluetooth_sapphire/fuchsia/host/sdp:test_pkg", |
| "//pw_bluetooth_sapphire/fuchsia/host/sm:test_pkg", |
| "//pw_bluetooth_sapphire/fuchsia/host/socket:test_pkg", |
| "//pw_bluetooth_sapphire/fuchsia/host/testing:test_pkg", |
| "//pw_bluetooth_sapphire/fuchsia/host/transport:test_pkg", |
| ], |
| ) |
| |
| sphinx_docs_library( |
| name = "extra_docs_inputs", |
| srcs = [ |
| ".bazelversion", |
| ".clang-tidy", |
| "Kconfig.zephyr", |
| "PIGWEED_MODULES", |
| ], |
| target_compatible_with = incompatible_with_mcu(), |
| visibility = [":__subpackages__"], |
| ) |
| |
| filegroup( |
| name = "clang_tidy_config", |
| srcs = [".clang-tidy"], |
| visibility = ["//visibility:public"], |
| ) |
| |
| filegroup( |
| name = "pylintrc", |
| srcs = [".pylintrc"], |
| ) |
| |
| copy_to_bin( |
| name = "tsconfig", |
| srcs = ["tsconfig.json"], |
| visibility = ["//pw_web:__subpackages__"], |
| ) |