@@ -3,6 +3,7 @@ load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile
33load ("@platforms//host:constraints.bzl" , "HOST_CONSTRAINTS" )
44load ("@rules_multirun//:defs.bzl" , "multirun" )
55load ("@rules_shell//shell:sh_binary.bzl" , "sh_binary" )
6+ load ("@bazel_skylib//rules:diff_test.bzl" , "diff_test" )
67
78buildifier (
89 name = "buildifier.check" ,
@@ -20,7 +21,7 @@ genrule(
2021 name = "gen-clang-format" ,
2122 outs = ["clang-format.bash" ],
2223 cmd = """
23- echo "#!/bin/bash" > $@
24+ echo "#!/usr/ bin/env bash" > $@
2425echo "cd \\ $$BUILD_WORKSPACE_DIRECTORY" >> $@
2526echo "exec bazelisk build \\ $$@ //..." >> $@
2627""" ,
@@ -67,7 +68,7 @@ genrule(
6768 name = "gen-clang-tidy" ,
6869 outs = ["clang-tidy.bash" ],
6970 cmd = """
70- echo "#!/bin/bash" > $@
71+ echo "#!/usr/ bin/env bash" > $@
7172echo "cd \\ $$BUILD_WORKSPACE_DIRECTORY" >> $@
7273echo "exec bazelisk build {options} \\ $${{@:-//...}}" >> $@
7374""" .format (
@@ -106,3 +107,24 @@ refresh_compile_commands(
106107 "//..." : "--extra_toolchains=@llvm_toolchain//:all" ,
107108 },
108109)
110+
111+ genrule (
112+ name = "actual_bazelrc" ,
113+ outs = ["actual.bazelrc" ],
114+ srcs = [
115+ "bazel-wrapper/flake.nix" ,
116+ "bazel-wrapper/flake.lock" ,
117+ ],
118+ cmd = """
119+ mkdir nix
120+ cp -L ./tools/bazel-wrapper/flake.nix ./tools/bazel-wrapper/flake.lock ./nix
121+ file=$$(nix build ./nix#shellExecutable --print-out-paths)
122+ cp "$$file" $@
123+ """ ,
124+ )
125+
126+ diff_test (
127+ name = "shell_executable.bazelrc_diff_test" ,
128+ file1 = "shell_executable.bazelrc" ,
129+ file2 = ":actual_bazelrc" ,
130+ )
0 commit comments