Compare commits

...

5 Commits

Author SHA1 Message Date
jif-oai
d1eefe81c0 try to fix bazel 5 2026-03-20 16:08:44 +00:00
jif-oai
06417d8020 try to fix bazel 4 2026-03-20 15:49:57 +00:00
jif-oai
56d69b4adf try to fix bazel 3 2026-03-20 15:45:43 +00:00
jif-oai
ad289015ac try to fix bazel 2 2026-03-20 15:38:25 +00:00
jif-oai
e739ac9606 try to fix bazel 2026-03-20 15:17:15 +00:00
4 changed files with 94 additions and 2 deletions

View File

@@ -7,7 +7,10 @@ common --disk_cache=~/.cache/bazel-disk-cache
common --repo_contents_cache=~/.cache/bazel-repo-contents-cache
common --repository_cache=~/.cache/bazel-repo-cache
common --remote_cache_compression
startup --experimental_remote_repo_contents_cache
# Bazel 9 repo contents cache has produced broken external repo materializations
# in CI and locally (missing files under repos like bazel_lib+), so keep it off
# until the upstream behavior is reliable again.
common --experimental_platform_in_output_dir
@@ -59,4 +62,3 @@ common:remote --jobs=800
# TODO(team): Evaluate if this actually helps, zbarsky is not sure, everything seems bottlenecked on `core` either way.
# Enable pipelined compilation since we are not bound by local CPU count.
#common:remote --@rules_rust//rust/settings:pipelined_compilation

View File

@@ -3,6 +3,13 @@ module(name = "codex")
bazel_dep(name = "bazel_skylib", version = "1.8.2")
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "llvm", version = "0.6.7")
single_version_override(
module_name = "llvm",
patch_strip = 1,
patches = [
"//patches:llvm_macos_sdk_local_fallback.patch",
],
)
register_toolchains("@llvm//toolchain:all")

View File

@@ -1,5 +1,6 @@
exports_files([
"aws-lc-sys_memcmp_check.patch",
"llvm_macos_sdk_local_fallback.patch",
"v8_bazel_rules.patch",
"v8_module_deps.patch",
"v8_source_portability.patch",

View File

@@ -0,0 +1,82 @@
diff --git a/http_pkg_archive.bzl b/http_pkg_archive.bzl
--- a/http_pkg_archive.bzl
+++ b/http_pkg_archive.bzl
@@ -2,6 +2,68 @@
load("@bazel_lib//lib:repo_utils.bzl", "repo_utils")
+def _execute_or_fail(rctx, args, error_message):
+ res = rctx.execute(args)
+ if res.return_code != 0:
+ fail("{}: {}".format(error_message, res.stderr))
+
+def _copy_path_if_exists(rctx, cp, src, dst_dir):
+ if not rctx.path(src).exists:
+ return
+
+ _execute_or_fail(
+ rctx,
+ [cp, "-LR", src, dst_dir],
+ "Failed to copy {}".format(src),
+ )
+
def _http_pkg_archive_impl(rctx):
+ if repo_utils.is_darwin(rctx):
+ host_xcrun = rctx.which("xcrun")
+ host_cp = rctx.which("cp")
+ host_mkdir = rctx.which("mkdir")
+ if host_xcrun == None:
+ fail("xcrun is required to locate the local macOS SDK")
+ if host_cp == None:
+ fail("cp is required to materialize the local macOS SDK")
+ if host_mkdir == None:
+ fail("mkdir is required to materialize the local macOS SDK")
+
+ res = rctx.execute([host_xcrun, "--show-sdk-path"])
+ if res.return_code != 0:
+ fail("Failed to locate local macOS SDK: {}".format(res.stderr))
+
+ sdk_path = res.stdout.strip()
+ if not sdk_path:
+ fail("xcrun --show-sdk-path returned an empty SDK path")
+
+ rctx.file(rctx.attr.dst + "/BUILD.bazel", rctx.read(Label("//3rd_party/macos_sdk:CLTools_macOSNMOS_SDK.BUILD.bazel")))
+ _execute_or_fail(
+ rctx,
+ [
+ host_mkdir,
+ "-p",
+ rctx.attr.dst + "/System/Library/Frameworks",
+ rctx.attr.dst + "/System/Library/PrivateFrameworks",
+ rctx.attr.dst + "/usr",
+ ],
+ "Failed to prepare local macOS SDK repo",
+ )
+ rctx.symlink(sdk_path + "/usr/include", rctx.attr.dst + "/usr/include")
+ rctx.symlink(sdk_path + "/usr/lib", rctx.attr.dst + "/usr/lib")
+ rctx.symlink(sdk_path + "/Entitlements.plist", rctx.attr.dst + "/Entitlements.plist")
+ rctx.symlink(sdk_path + "/SDKSettings.json", rctx.attr.dst + "/SDKSettings.json")
+ rctx.symlink(sdk_path + "/SDKSettings.plist", rctx.attr.dst + "/SDKSettings.plist")
+
+ for include in rctx.attr.includes:
+ if include.startswith("System/Library/Frameworks/") and include.endswith("/*"):
+ framework = include.removeprefix("System/Library/Frameworks/").removesuffix("/*")
+ _copy_path_if_exists(
+ rctx,
+ host_cp,
+ sdk_path + "/System/Library/Frameworks/" + framework,
+ rctx.attr.dst + "/System/Library/Frameworks",
+ )
+ if include.startswith("System/Library/PrivateFrameworks/") and include.endswith("/*"):
+ framework = include.removeprefix("System/Library/PrivateFrameworks/").removesuffix("/*")
+ _copy_path_if_exists(
+ rctx,
+ host_cp,
+ sdk_path + "/System/Library/PrivateFrameworks/" + framework,
+ rctx.attr.dst + "/System/Library/PrivateFrameworks",
+ )
+
+ return rctx.repo_metadata(reproducible = False)
+
rctx.download(
url = rctx.attr.urls,
output = ".downloaded.pkg",