Jelajahi Sumber

Remove glob_sh_run (#4041)

file_test's --dump_output flag has essentially supplanted this
functionality, and is necessary for execution on multi-file tests.
Jon Ross-Perkins 1 tahun lalu
induk
melakukan
60db3df24b

+ 0 - 5
bazel/sh_run/BUILD

@@ -1,5 +0,0 @@
-# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
-# Exceptions. See /LICENSE for license information.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-exports_files(["exec.sh"])

+ 0 - 16
bazel/sh_run/exec.sh

@@ -1,16 +0,0 @@
-#!/usr/bin/env bash
-#
-# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
-# Exceptions. See /LICENSE for license information.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-# Turn any pwd-relative files into absolute paths. Other args may be
-# BUILD_WORKING_DIRECTORY-relative, which will be handled by the executed
-# binary.
-ARGS=("$@")
-for i in "${!ARGS[@]}"; do
-  if [[ -e "${ARGS[$i]}" ]]; then
-    ARGS[$i]="$(realpath ${ARGS[$i]})"
-  fi
-done
-exec "${ARGS[@]}"

+ 0 - 35
bazel/sh_run/rules.bzl

@@ -1,35 +0,0 @@
-# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
-# Exceptions. See /LICENSE for license information.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-"""Rules for building fuzz tests."""
-
-load("//bazel/cc_toolchains:defs.bzl", "cc_env")
-
-def sh_run(name, args, **kwargs):
-    """Produces a target which can run with the given args."""
-
-    native.sh_binary(
-        name = name,
-        srcs = ["//bazel/sh_run:exec.sh"],
-        tags = ["manual"],
-        args = args,
-        **kwargs
-    )
-
-def glob_sh_run(file_exts, args, data, run_ext = "run", **kwargs):
-    """Produces a per-file sh_run."""
-    files = native.glob(
-        ["**"],
-        exclude_directories = 1,
-    )
-    for f in files:
-        if f.split(".")[-1] not in file_exts:
-            continue
-        sh_run(
-            name = "%s.%s" % (f, run_ext),
-            args = args + ["$(location %s)" % f],
-            data = data + [f],
-            env = cc_env(),
-            **kwargs
-        )

+ 0 - 18
explorer/BUILD

@@ -4,7 +4,6 @@
 
 load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 load("//bazel/cc_toolchains:defs.bzl", "cc_env")
-load("//bazel/sh_run:rules.bzl", "glob_sh_run")
 load("//testing/file_test:rules.bzl", "file_test")
 
 package(default_visibility = [
@@ -95,23 +94,6 @@ file_test(
     ),
 )
 
-glob_sh_run(
-    args = ["$(location //explorer)"],
-    data = ["//explorer"],
-    file_exts = ["carbon"],
-)
-
-glob_sh_run(
-    args = [
-        "$(location //explorer)",
-        "--parser_debug",
-        "--trace_file=-",
-    ],
-    data = ["//explorer"],
-    file_exts = ["carbon"],
-    run_ext = "verbose",
-)
-
 filegroup(
     name = "carbon_files",
     srcs = glob(["testdata/**/*.carbon"]),

+ 0 - 25
toolchain/check/BUILD

@@ -3,7 +3,6 @@
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
 load("@rules_cc//cc:defs.bzl", "cc_library")
-load("//bazel/sh_run:rules.bzl", "glob_sh_run")
 load("//testing/fuzzing:rules.bzl", "cc_fuzz_test")
 
 package(default_visibility = ["//visibility:public"])
@@ -284,27 +283,3 @@ cc_library(
         "@llvm-project//llvm:Support",
     ],
 )
-
-glob_sh_run(
-    args = [
-        "$(location //toolchain/driver:carbon)",
-        "compile",
-        "--phase=check",
-        "--dump-sem-ir",
-        "--dump-raw-sem-ir",
-    ],
-    data = ["//toolchain/driver:carbon"],
-    file_exts = ["carbon"],
-)
-
-glob_sh_run(
-    args = [
-        "$(location //toolchain/driver:carbon)",
-        "-v",
-        "compile",
-        "--phase=check",
-    ],
-    data = ["//toolchain/driver:carbon"],
-    file_exts = ["carbon"],
-    run_ext = "verbose",
-)

+ 0 - 24
toolchain/lex/BUILD

@@ -3,7 +3,6 @@
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
 load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
-load("//bazel/sh_run:rules.bzl", "glob_sh_run")
 load("//testing/fuzzing:rules.bzl", "cc_fuzz_test")
 
 package(default_visibility = ["//visibility:public"])
@@ -297,26 +296,3 @@ cc_binary(
         "@llvm-project//llvm:Support",
     ],
 )
-
-glob_sh_run(
-    args = [
-        "$(location //toolchain/driver:carbon)",
-        "compile",
-        "--phase=lex",
-        "--dump-tokens",
-    ],
-    data = ["//toolchain/driver:carbon"],
-    file_exts = ["carbon"],
-)
-
-glob_sh_run(
-    args = [
-        "$(location //toolchain/driver:carbon)",
-        "-v",
-        "compile",
-        "--phase=lex",
-    ],
-    data = ["//toolchain/driver:carbon"],
-    file_exts = ["carbon"],
-    run_ext = "verbose",
-)

+ 0 - 24
toolchain/lower/BUILD

@@ -3,7 +3,6 @@
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
 load("@rules_cc//cc:defs.bzl", "cc_library")
-load("//bazel/sh_run:rules.bzl", "glob_sh_run")
 
 package(default_visibility = ["//visibility:public"])
 
@@ -54,26 +53,3 @@ cc_library(
         "@llvm-project//llvm:Support",
     ],
 )
-
-glob_sh_run(
-    args = [
-        "$(location //toolchain/driver:carbon)",
-        "compile",
-        "--phase=lower",
-        "--dump-llvm-ir",
-    ],
-    data = ["//toolchain/driver:carbon"],
-    file_exts = ["carbon"],
-)
-
-glob_sh_run(
-    args = [
-        "$(location //toolchain/driver:carbon)",
-        "-v",
-        "compile",
-        "--phase=lower",
-    ],
-    data = ["//toolchain/driver:carbon"],
-    file_exts = ["carbon"],
-    run_ext = "verbose",
-)

+ 0 - 24
toolchain/parse/BUILD

@@ -3,7 +3,6 @@
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
 load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
-load("//bazel/sh_run:rules.bzl", "glob_sh_run")
 load("//testing/fuzzing:rules.bzl", "cc_fuzz_test")
 
 package(default_visibility = ["//visibility:public"])
@@ -191,26 +190,3 @@ cc_test(
         "@googletest//:gtest",
     ],
 )
-
-glob_sh_run(
-    args = [
-        "$(location //toolchain/driver:carbon)",
-        "compile",
-        "--phase=parse",
-        "--dump-parse-tree",
-    ],
-    data = ["//toolchain/driver:carbon"],
-    file_exts = ["carbon"],
-)
-
-glob_sh_run(
-    args = [
-        "$(location //toolchain/driver:carbon)",
-        "-v",
-        "compile",
-        "--phase=parse",
-    ],
-    data = ["//toolchain/driver:carbon"],
-    file_exts = ["carbon"],
-    run_ext = "verbose",
-)