Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bring in llvm toolchain so we can update //js/private/test/image snapshots on darwin #1638

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import %workspace%/.aspect/bazelrc/performance.bazelrc
# We have some empty globs in rules_js
common --noincompatible_disallow_empty_glob

# Don't try and auto detect the cc toolchain, as we use our llvm.
build --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
build --incompatible_strict_action_env=true
build --incompatible_enable_cc_toolchain_resolution

# Disable lockfile for now. It is unstable.
# https://github.com/bazelbuild/bazel/issues/19026
# https://github.com/bazelbuild/bazel/issues/19621
Expand Down
33 changes: 33 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,36 @@ load(
fetch_shfmt()

fetch_terraform()

load("@com_grail_bazel_toolchain//toolchain:deps.bzl", "bazel_toolchain_dependencies")

bazel_toolchain_dependencies()

load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain")

llvm_toolchain(
name = "llvm_toolchain",
llvm_version = "14.0.0",
sha256 = {
"darwin-aarch64": "1b8975db6b638b308c1ee437291f44cf8f67a2fb926eb2e6464efd180e843368",
"linux-x86_64": "564fcbd79c991e93fdf75f262fa7ac6553ec1dd04622f5d7db2a764c5dc7fac6",
},
strip_prefix = {
"darwin-aarch64": "clang+llvm-14.0.0-arm64-apple-darwin",
"linux-x86_64": "clang+llvm-14.0.0-x86_64-linux-gnu",
},
sysroot = {
"linux-aarch64": "@org_chromium_sysroot_linux_arm64//:sysroot",
"linux-x86_64": "@org_chromium_sysroot_linux_x86_64//:sysroot",
"darwin-aarch64": "@sysroot_darwin_universal//:sysroot",
"darwin-x86_64": "@sysroot_darwin_universal//:sysroot",
},
urls = {
"darwin-aarch64": ["https://github.com/aspect-forks/llvm-project/releases/download/aspect-release-14.0.0/clang+llvm-14.0.0-arm64-apple-darwin.tar.xz"],
"linux-x86_64": ["https://github.com/aspect-forks/llvm-project/releases/download/aspect-release-14.0.0/clang+llvm-14.0.0-x86_64-linux-gnu.tar.xz"],
},
)

load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains")

llvm_register_toolchains()
83 changes: 83 additions & 0 deletions WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,86 @@ http_archive(
integrity = "sha256-/nD5GSp77HDNFDwIL68S5PbS+8gefWkube2iIr80/x4=",
url = "https://registry.npmjs.org/chalk/-/chalk-5.0.1.tgz",
)

http_archive(
name = "com_grail_bazel_toolchain",
sha256 = "a9fc7cf01d0ea0a935bd9e3674dd3103766db77dfc6aafcb447a7ddd6ca24a78",
strip_prefix = "toolchains_llvm-c65ef7a45907016a754e5bf5bfabac76eb702fd3",
urls = ["https://github.com/bazel-contrib/toolchains_llvm/archive/c65ef7a45907016a754e5bf5bfabac76eb702fd3.tar.gz"],
)

_SYSROOT_LINUX_BUILD_FILE = """
filegroup(
name = "sysroot",
srcs = glob(["*/**"]),
visibility = ["//visibility:public"],
)
"""

_SYSROOT_DARWIN_BUILD_FILE = """
filegroup(
name = "sysroot",
srcs = glob(
include = ["**"],
exclude = ["**/*:*"],
),
visibility = ["//visibility:public"],
)
"""

http_archive(
name = "org_chromium_sysroot_linux_arm64",
build_file_content = _SYSROOT_LINUX_BUILD_FILE,
sha256 = "cf2fefded0449f06d3cf634bfa94ffed60dbe47f2a14d2900b00eb9bcfb104b8",
urls = ["https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/80fc74e431f37f590d0c85f16a9d8709088929e8/debian_bullseye_arm64_sysroot.tar.xz"],
)

http_archive(
name = "org_chromium_sysroot_linux_x86_64",
build_file_content = _SYSROOT_LINUX_BUILD_FILE,
sha256 = "04b94ba1098b71f8543cb0ba6c36a6ea2890d4d417b04a08b907d96b38a48574",
urls = ["https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/f5f68713249b52b35db9e08f67184cac392369ab/debian_bullseye_amd64_sysroot.tar.xz"],
)

http_archive(
name = "sysroot_darwin_universal",
build_file_content = _SYSROOT_DARWIN_BUILD_FILE,
# The ruby header has an infinite symlink that we need to remove.
patch_cmds = ["rm System/Library/Frameworks/Ruby.framework/Versions/Current/Headers/ruby/ruby"],
sha256 = "71ae00a90be7a8c382179014969cec30d50e6e627570af283fbe52132958daaf",
strip_prefix = "MacOSX11.3.sdk",
urls = ["https://s3.us-east-2.amazonaws.com/static.aspect.build/sysroots/MacOSX11.3.sdk.tar.xz"],
)

load("@com_grail_bazel_toolchain//toolchain:deps.bzl", "bazel_toolchain_dependencies")

bazel_toolchain_dependencies()

load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain")

llvm_toolchain(
name = "llvm_toolchain",
llvm_version = "14.0.0",
sha256 = {
"darwin-aarch64": "1b8975db6b638b308c1ee437291f44cf8f67a2fb926eb2e6464efd180e843368",
"linux-x86_64": "564fcbd79c991e93fdf75f262fa7ac6553ec1dd04622f5d7db2a764c5dc7fac6",
},
strip_prefix = {
"darwin-aarch64": "clang+llvm-14.0.0-arm64-apple-darwin",
"linux-x86_64": "clang+llvm-14.0.0-x86_64-linux-gnu",
},
sysroot = {
"linux-aarch64": "@org_chromium_sysroot_linux_arm64//:sysroot",
"linux-x86_64": "@org_chromium_sysroot_linux_x86_64//:sysroot",
"darwin-aarch64": "@sysroot_darwin_universal//:sysroot",
"darwin-x86_64": "@sysroot_darwin_universal//:sysroot",
},
urls = {
"darwin-aarch64": ["https://github.com/aspect-forks/llvm-project/releases/download/aspect-release-14.0.0/clang+llvm-14.0.0-arm64-apple-darwin.tar.xz"],
"linux-x86_64": ["https://github.com/aspect-forks/llvm-project/releases/download/aspect-release-14.0.0/clang+llvm-14.0.0-x86_64-linux-gnu.tar.xz"],
},
)

load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains")

llvm_register_toolchains()
50 changes: 50 additions & 0 deletions js/dev_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,53 @@ def rules_js_dev_dependencies():
url = "https://registry.npmjs.org/chalk/-/chalk-5.0.1.tgz",
build_file = "//npm/private/test:vendored/chalk-5.0.1.BUILD",
)

http_archive(
name = "com_grail_bazel_toolchain",
sha256 = "a9fc7cf01d0ea0a935bd9e3674dd3103766db77dfc6aafcb447a7ddd6ca24a78",
strip_prefix = "toolchains_llvm-c65ef7a45907016a754e5bf5bfabac76eb702fd3",
urls = ["https://github.com/bazel-contrib/toolchains_llvm/archive/c65ef7a45907016a754e5bf5bfabac76eb702fd3.tar.gz"],
)

http_archive(
name = "org_chromium_sysroot_linux_arm64",
build_file_content = _SYSROOT_LINUX_BUILD_FILE,
sha256 = "cf2fefded0449f06d3cf634bfa94ffed60dbe47f2a14d2900b00eb9bcfb104b8",
urls = ["https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/80fc74e431f37f590d0c85f16a9d8709088929e8/debian_bullseye_arm64_sysroot.tar.xz"],
)

http_archive(
name = "org_chromium_sysroot_linux_x86_64",
build_file_content = _SYSROOT_LINUX_BUILD_FILE,
sha256 = "04b94ba1098b71f8543cb0ba6c36a6ea2890d4d417b04a08b907d96b38a48574",
urls = ["https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/f5f68713249b52b35db9e08f67184cac392369ab/debian_bullseye_amd64_sysroot.tar.xz"],
)

http_archive(
name = "sysroot_darwin_universal",
build_file_content = _SYSROOT_DARWIN_BUILD_FILE,
# The ruby header has an infinite symlink that we need to remove.
patch_cmds = ["rm System/Library/Frameworks/Ruby.framework/Versions/Current/Headers/ruby/ruby"],
sha256 = "71ae00a90be7a8c382179014969cec30d50e6e627570af283fbe52132958daaf",
strip_prefix = "MacOSX11.3.sdk",
urls = ["https://s3.us-east-2.amazonaws.com/static.aspect.build/sysroots/MacOSX11.3.sdk.tar.xz"],
)

_SYSROOT_LINUX_BUILD_FILE = """
filegroup(
name = "sysroot",
srcs = glob(["*/**"]),
visibility = ["//visibility:public"],
)
"""

_SYSROOT_DARWIN_BUILD_FILE = """
filegroup(
name = "sysroot",
srcs = glob(
include = ["**"],
exclude = ["**/*:*"],
),
visibility = ["//visibility:public"],
)
"""
Loading