mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 18:50:09 +01:00
Cleanup the new dependencies and our tooling setup. (#943)
I didn't fully configure the new dependencies correctly or fully get them working with our tooling rigging for compilation databases. - I needed to fix the sha256 of the benchmark. I pasted the wrong one, but didn't test it effectively. - Didn't successfully enable the use of Abseil from GoogleTest (including nice things like its symbolization, etc). Doing this is a bit awkward as it needs to go into our `.bazelrc`, but it works. - Didn't add libraries other that GoogleTest to the compile flags. - Didn't teach the compilation database creation step to cause these external repositories to be linked in and populated nicely. All of these are fixed. As I was making changes to the Python script here, I've added a test to at least type check it and fixed the type errors reported.
This commit is contained in:
@@ -45,6 +45,9 @@ build --force_pic
|
||||
# crashes. Optimized builds already avoid using debug information by default.
|
||||
build --strip=never
|
||||
|
||||
# Enable Abseil for GoogleTest.
|
||||
build --define=absl=1
|
||||
|
||||
# Configuration for enabling Address Sanitizer. Note that this is enabled by
|
||||
# default for fastbuild. The config is provided to enable ASan even in
|
||||
# optimized or other build configurations.
|
||||
|
||||
@@ -123,7 +123,7 @@ benchmark_version = "0baacde3618ca617da95375e0af13ce1baadea47"
|
||||
|
||||
http_archive(
|
||||
name = "com_github_google_benchmark",
|
||||
sha256 = "19949c33e795197dbb8610672c18bff447dc31faef3257665d69d1bf0884d67b",
|
||||
sha256 = "62e2f2e6d8a744d67e4bbc212fcfd06647080de4253c97ad5c6749e09faf2cb0",
|
||||
strip_prefix = "benchmark-%s" % benchmark_version,
|
||||
urls = ["https://github.com/google/benchmark/archive/%s.zip" % benchmark_version],
|
||||
)
|
||||
|
||||
+14
-1
@@ -34,7 +34,7 @@
|
||||
-DLLVM_DEFAULT_TARGET_TRIPLE="x86_64-unknown-linux-gnu"
|
||||
-DLLVM_ENABLE_TERMINFO=1
|
||||
-DLLVM_ENABLE_ZLIB=1
|
||||
-DGTEST_HAS_RTTI=0
|
||||
-DGTEST_HAS_ABSL=1
|
||||
-D__STDC_LIMIT_MACROS
|
||||
-D__STDC_CONSTANT_MACROS
|
||||
-iquote
|
||||
@@ -58,9 +58,22 @@ bazel-execroot/external/llvm_zlib
|
||||
-iquote
|
||||
bazel-bin/external/llvm_zlib
|
||||
-iquote
|
||||
bazel-execroot/external/com_github_google_benchmark
|
||||
-iquote
|
||||
bazel-bin/external/com_github_google_benchmark
|
||||
-iquote
|
||||
bazel-execroot/external/com_google_absl
|
||||
-iquote
|
||||
bazel-bin/external/com_google_absl
|
||||
-iquote
|
||||
bazel-execroot/external/com_google_googletest
|
||||
-iquote
|
||||
bazel-bin/external/com_google_googletest
|
||||
-iquote
|
||||
bazel-execroot/external/bazel_tools
|
||||
-iquote
|
||||
bazel-bin/external/bazel_tools
|
||||
-Ibazel-bin/external/com_github_google_benchmark/_virtual_includes/benchmark
|
||||
-isystem
|
||||
bazel-execroot/external/llvm-project/llvm/include
|
||||
-isystem
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# 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
|
||||
|
||||
load("@mypy_integration//:mypy.bzl", "mypy_test")
|
||||
|
||||
# Note that this Python script is intended to be run directly, and not through
|
||||
# Bazel. We have a rule for it so we can type check it.
|
||||
py_binary(
|
||||
name = "create_compdb",
|
||||
srcs = ["create_compdb.py"],
|
||||
)
|
||||
|
||||
mypy_test(
|
||||
name = "create_compdb_mypy_test",
|
||||
include_imports = True,
|
||||
deps = [":create_compdb"],
|
||||
)
|
||||
@@ -129,10 +129,25 @@ print("Found %d generated files..." % (len(generated_file_labels),))
|
||||
print("Building the generated files so that tools can find them...")
|
||||
subprocess.run([bazel, "build", "--keep_going"] + generated_file_labels)
|
||||
|
||||
# Also build some specific targets that depend on external packages so those are
|
||||
# fetched and linked into the Bazel execution root. We try to use cheap files
|
||||
# where possible, but in some cases need to create a virtual include directory.
|
||||
subprocess.run(
|
||||
[
|
||||
bazel,
|
||||
"build",
|
||||
"--keep_going",
|
||||
"@llvm-project//llvm:LICENSE.TXT",
|
||||
"@com_google_absl//:LICENSE",
|
||||
"@com_google_googletest//:LICENSE",
|
||||
"@com_github_google_benchmark//:benchmark",
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
# Manually translate the label to a user friendly path into the Bazel output
|
||||
# symlinks.
|
||||
def _label_to_path(s):
|
||||
def _label_to_path(s: str) -> Path:
|
||||
# Map external repositories to their part of the output tree.
|
||||
s = re.sub(r"^@([^/]+)//", r"bazel-bin/external/\1/", s)
|
||||
# Map this repository to the root of the output tree.
|
||||
|
||||
Reference in New Issue
Block a user