# Copyright 2025 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. # This file makes this directory a Bazel package. load("@rules_python//python:defs.bzl", "py_binary", "py_library") load("//pw_build:pw_py_importable_runfile.bzl", "pw_py_importable_runfile") load("//pw_build:python.bzl", "pw_py_binary", "pw_py_test") package(default_visibility = ["//visibility:public"]) exports_files([ "merger.sh", "merger.py", "cleaner.py", ]) py_library( name = "merger", testonly = True, srcs = ["merger.py"], visibility = ["//visibility:private"], ) py_binary( name = "update_compile_commands", srcs = ["merger.py"], main = "merger.py", ) py_binary( name = "clean_compile_commands", srcs = ["cleaner.py"], main = "cleaner.py", ) pw_py_test( name = "merger_test", srcs = ["merger_test.py"], deps = [ ":merger", "@pigweed_python_packages//pyfakefs", ], ) # For testing, do not increase visibility. pw_py_importable_runfile( name = "clangd_binary", testonly = True, src = "@llvm_toolchain//:bin/clangd", executable = True, import_location = "pw_ide.bazel.compile_commands.clangd_binary", visibility = ["//visibility:private"], ) # For testing, do not increase visibility. pw_py_importable_runfile( name = "update_compile_commands_binary", testonly = True, src = "//pw_ide/bazel:update_compile_commands", executable = True, import_location = "pw_ide.bazel.compile_commands.update_compile_commands_binary", visibility = ["//visibility:private"], ) pw_py_binary( name = "integration_test", testonly = True, srcs = ["integration_test.py"], data = [ # Ensure compile commands are always available. "//pw_ide/bazel/compile_commands/test:test_compile_commands", # Ensure generated files exist. "//pw_ide/bazel/compile_commands/test:test_compile_commands_outputs", ], deps = [ ":clangd_binary", ":update_compile_commands_binary", ], )