Skip to content

Commit

Permalink
Revert "Restructure to avoid WORKSPACE loads"
Browse files Browse the repository at this point in the history
This reverts commit bb07c3e.
  • Loading branch information
fmeum committed Feb 6, 2025
1 parent 1cd4544 commit 4cc0de2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ bazel_dep(name = "bazel_skylib", version = "1.6.1")
bazel_dep(name = "platforms", version = "0.0.9")
bazel_dep(name = "rules_cc", version = "0.0.8")

apple_cc_configure = use_extension("//crosstool:apple_cc_configure_extension.bzl", "apple_cc_configure_extension")
apple_cc_configure = use_extension("//crosstool:setup.bzl", "apple_cc_configure_extension")
use_repo(apple_cc_configure, "local_config_apple_cc", "local_config_apple_cc_toolchains")

register_toolchains("@local_config_apple_cc_toolchains//:all")
Expand Down
10 changes: 0 additions & 10 deletions crosstool/apple_cc_configure_extension.bzl

This file was deleted.

15 changes: 11 additions & 4 deletions crosstool/setup.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Configure the Apple CC toolchain"""

load("@bazel_skylib//lib:modules.bzl", "modules")
load("//crosstool:osx_cc_configure.bzl", "configure_osx_toolchain")

_DISABLE_ENV_VAR = "BAZEL_NO_APPLE_CPP_TOOLCHAIN"
Expand Down Expand Up @@ -29,7 +30,7 @@ def _apple_cc_autoconf_toolchains_impl(repository_ctx):
else:
repository_ctx.file("BUILD", "# Apple CC toolchain autoconfiguration was disabled because you're not running on macOS")

apple_cc_autoconf_toolchains = repository_rule(
_apple_cc_autoconf_toolchains = repository_rule(
environ = [
_DISABLE_ENV_VAR,
_OLD_DISABLE_ENV_VAR,
Expand All @@ -54,7 +55,7 @@ def _apple_cc_autoconf_impl(repository_ctx):
else:
repository_ctx.file("BUILD", "# Apple CC autoconfiguration was disabled because you're not on macOS")

apple_cc_autoconf = repository_rule(
_apple_cc_autoconf = repository_rule(
environ = [
_DISABLE_ENV_VAR,
_OLD_DISABLE_ENV_VAR,
Expand All @@ -72,9 +73,15 @@ apple_cc_autoconf = repository_rule(

# buildifier: disable=unnamed-macro
def apple_cc_configure():
apple_cc_autoconf_toolchains(name = "local_config_apple_cc_toolchains")
apple_cc_autoconf(name = "local_config_apple_cc")
_apple_cc_autoconf_toolchains(name = "local_config_apple_cc_toolchains")
_apple_cc_autoconf(name = "local_config_apple_cc")
native.register_toolchains(
# Use register_toolchain's target pattern expansion to register all toolchains in the package.
"@local_config_apple_cc_toolchains//:all",
)

def _apple_cc_configure_extension_impl():
_apple_cc_autoconf_toolchains(name = "local_config_apple_cc_toolchains")
_apple_cc_autoconf(name = "local_config_apple_cc")

apple_cc_configure_extension = modules.as_extension(_apple_cc_configure_extension_impl)

0 comments on commit 4cc0de2

Please sign in to comment.