Prechádzať zdrojové kódy

Remove zlib/zstd version dependence in check_deps (#3530)

Jon Ross-Perkins 2 rokov pred
rodič
commit
39bc76595b
1 zmenil súbory, kde vykonal 21 pridanie a 17 odobranie
  1. 21 17
      bazel/check_deps/check_non_test_cc_deps.py

+ 21 - 17
bazel/check_deps/check_non_test_cc_deps.py

@@ -37,13 +37,6 @@ for dep in deps:
     print("Checking dependency: " + dep)
     repo, _, rule = dep.partition("//")
 
-    # These are stubs wrapping system libraries for LLVM. They aren't
-    # distributed and so should be fine.
-    if repo in (
-        "@@zlib~1.3",
-        "@@zstd~1.5.5",
-    ):
-        continue
     if repo == "@@_main~llvm_project~llvm-project":
         package, _, rule = rule.partition(":")
 
@@ -65,23 +58,34 @@ for dep in deps:
         continue
 
     # Ignore the version, just use the repo name.
-    repo = repo.split("~")[0]
-    if repo == "" and not rule.startswith("third_party"):
-        # Carbon code is always allowed.
+    repo_base = repo.split("~")[0]
+
+    # Carbon code is always allowed.
+    if repo_base == "" and not rule.startswith("third_party"):
+        continue
+
+    # An empty stub library added by rules_cc:
+    # https://github.com/bazelbuild/rules_cc/blob/main/BUILD
+    if repo_base == "@@rules_cc" and rule == ":link_extra_lib":
         continue
-    if repo == "@@rules_cc" and rule == ":link_extra_lib":
-        # An empty stub library added by rules_cc:
-        # https://github.com/bazelbuild/rules_cc/blob/main/BUILD
+
+    # These are stubs wrapping system libraries for LLVM. They aren't
+    # distributed and so should be fine.
+    if repo_base in (
+        "@@zlib",
+        "@@zstd",
+    ):
         continue
-    if repo in (
+
+    # This should never be reached from non-test code, but these targets do
+    # exist. Specially diagnose them to try to provide a more helpful
+    # message.
+    if repo_base in (
         "@com_github_google_benchmark",
         "@com_github_protocolbuffers_protobuf",
         "@com_google_absl",
         "@com_google_googletest",
     ):
-        # This should never be reached from non-test code, but these targets do
-        # exist. Specially diagnose them to try to provide a more helpful
-        # message.
         sys.exit("ERROR: dependency only allowed in test code: %s" % dep)
 
     # Conservatively fail if a dependency isn't explicitly allowed above.