diff --git a/MODULE.bazel b/MODULE.bazel index 68987f8faf..db2b49731d 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -65,3 +65,5 @@ python.toolchain( ignore_root_user_error = True, python_version = "3.12", ) + +bazel_dep(name = "depend_on_what_you_use", version = "0.3.0") diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index f8314c3902..01586865a7 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -1,6 +1,6 @@ { "lockFileVersion": 6, - "moduleFileHash": "c0f931ecae0b815ed976e8c95097e2eeba00ce73692d8903070f8cd278d12adb", + "moduleFileHash": "f2941b361c133af4499cbada61770bce66b72aeb65fbc3092352cfbff603578b", "flags": { "cmdRegistries": [ "https://bcr.bazel.build/" @@ -113,6 +113,7 @@ "boringssl": "boringssl@0.0.0-20240530-2db0eb3", "zlib": "zlib@1.3.1.bcr.1", "rules_proto": "rules_proto@6.0.0", + "depend_on_what_you_use": "depend_on_what_you_use@0.3.0", "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_" } @@ -1194,6 +1195,54 @@ } } }, + "depend_on_what_you_use@0.3.0": { + "name": "depend_on_what_you_use", + "version": "0.3.0", + "key": "depend_on_what_you_use@0.3.0", + "repoName": "depend_on_what_you_use", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [], + "extensionUsages": [ + { + "extensionBzlFile": "@depend_on_what_you_use//third_party:extensions.bzl", + "extensionName": "non_module_dependencies", + "usingModule": "depend_on_what_you_use@0.3.0", + "location": { + "file": "https://bcr.bazel.build/modules/depend_on_what_you_use/0.3.0/MODULE.bazel", + "line": 11, + "column": 40 + }, + "imports": { + "dwyu_pcpp": "dwyu_pcpp" + }, + "devImports": [], + "tags": [], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + } + ], + "deps": { + "rules_cc": "rules_cc@0.0.9", + "rules_python": "rules_python@0.32.2", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/martis42/depend_on_what_you_use/releases/download/0.3.0/depend_on_what_you_use-0.3.0.tar.gz" + ], + "integrity": "sha256-tWzfrtDXSWf++1S90/Bb0WfExOuqKmevli2WnmpRlis=", + "strip_prefix": "depend_on_what_you_use-0.3.0", + "remote_patches": { + "https://bcr.bazel.build/modules/depend_on_what_you_use/0.3.0/patches/module_dot_bazel.patch": "sha256-boHUzmbHnNuCsnGTahBX3s2YraKDchMGZwyZZzj2e6g=" + }, + "remote_patch_strip": 0 + } + } + }, "bazel_tools@_": { "name": "bazel_tools", "version": "", @@ -3952,6 +4001,35 @@ "recordedRepoMappingEntries": [] } }, + "@@depend_on_what_you_use~//third_party:extensions.bzl%non_module_dependencies": { + "general": { + "bzlTransitiveDigest": "igEo8WJHXHMfsPz44updOcUpw+mKEyzQ+JEoxs5e/QU=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "dwyu_pcpp": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5af9fbce55f136d7931ae915fae03c34030a3b36c496e72d9636cedc8e2543a1", + "strip_prefix": "pcpp-1.30", + "build_file": "@@depend_on_what_you_use~//third_party/pcpp:pcpp.BUILD", + "urls": [ + "https://files.pythonhosted.org/packages/41/07/876153f611f2c610bdb8f706a5ab560d888c938ea9ea65ed18c374a9014a/pcpp-1.30.tar.gz" + ] + } + } + }, + "recordedRepoMappingEntries": [ + [ + "depend_on_what_you_use~", + "bazel_tools", + "bazel_tools" + ] + ] + } + }, "@@googleapis~//:extensions.bzl%switched_rules": { "general": { "bzlTransitiveDigest": "vG6fuTzXD8MMvHWZEQud0MMH7eoC4GXY0va7VrFFh04=", diff --git a/bazel/dwyu.bzl b/bazel/dwyu.bzl new file mode 100644 index 0000000000..43580be2b9 --- /dev/null +++ b/bazel/dwyu.bzl @@ -0,0 +1,8 @@ +load("@depend_on_what_you_use//:defs.bzl", "dwyu_aspect_factory") + +# https://github.com/martis42/depend_on_what_you_use?tab=readme-ov-file#use-dwyu +# bazel build ... --aspects=//bazel:dwyu.bzl%aspect --output_groups=dwyu + +# Provide no arguments for the default behavior +# Or set a custom value for the various attributes +aspect = dwyu_aspect_factory()