Skip to content

Commit

Permalink
test clean up transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Karim Alweheshy committed Mar 3, 2024
1 parent 78cd104 commit 2c90bd4
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 93 deletions.
6 changes: 0 additions & 6 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@ use_repo(
"tart",
)

rules_ios_bazel_version_deps = use_extension("//rules:module_extensions.bzl", "rules_ios_bazel_version_deps")
use_repo(
rules_ios_bazel_version_deps,
"rules_ios_bazel_version",
)

non_module_dev_deps = use_extension(
"//rules:module_extensions.bzl",
"non_module_dev_deps",
Expand Down
2 changes: 0 additions & 2 deletions rules/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ bzl_library(
srcs = ["transition_support.bzl"],
visibility = ["//visibility:public"],
deps = [
"//rules/internal:bazel_version",
"@build_bazel_apple_support//configs:platforms",
"@rules_ios_bazel_version//:api",
],
)

Expand Down
6 changes: 0 additions & 6 deletions rules/internal/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

bzl_library(
name = "bazel_version",
srcs = ["bazel_version.bzl"],
visibility = ["//rules:__pkg__"],
)

bzl_library(
name = "objc_provider_utils",
srcs = ["objc_provider_utils.bzl"],
Expand Down
25 changes: 0 additions & 25 deletions rules/internal/bazel_version.bzl

This file was deleted.

8 changes: 0 additions & 8 deletions rules/module_extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

load(
"//rules:repositories.bzl",
"rules_ios_bazel_version",
"rules_ios_dependencies",
"rules_ios_dev_dependencies",
)
Expand All @@ -23,13 +22,6 @@ def _non_module_dev_deps_impl(_):

non_module_dev_deps = module_extension(implementation = _non_module_dev_deps_impl)

def _rules_ios_bazel_version(_):
rules_ios_bazel_version(
name = "rules_ios_bazel_version",
)

rules_ios_bazel_version_deps = module_extension(implementation = _rules_ios_bazel_version)

def _xcode_configure_impl(module_ctx):
for mod in module_ctx.modules:
for xcode_configure_attr in mod.tags.configure:
Expand Down
28 changes: 0 additions & 28 deletions rules/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -118,41 +118,13 @@ def _rules_ios_bzlmod_dependencies():
sha256 = "8f9ee2dc10c1ae514ee599a8b42ed99fa262b757058f65ad3c384289ff70c4b8",
)

def _rules_ios_bazel_version_impl(ctx):
ctx.file("BUILD.bazel", content = """
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
bzl_library(
name = "api",
srcs = [
"version.bzl",
],
visibility = ["//visibility:public"],
)
""")

# Write Bazel version to a file
ctx.file("version.bzl", content = "bazel_version = \"{}\"".format(ctx.attr._bazel_version))

rules_ios_bazel_version = repository_rule(
implementation = _rules_ios_bazel_version_impl,
attrs = {
"_bazel_version": attr.string(default = getattr(native, "bazel_version", "")),
},
local = True,
)

def _rules_ios_bzlmod_dev_dependencies():
"""
Fetches repositories that are development dependencies of `rules_ios` and available via bzlmod.
These are only included when using WORKSPACE, when using bzlmod they're loaded in MODULE.bazel
"""

_maybe(
rules_ios_bazel_version,
name = "rules_ios_bazel_version",
)

_maybe(
http_archive,
name = "buildifier_prebuilt",
Expand Down
18 changes: 0 additions & 18 deletions rules/transition_support.bzl
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
"""Starlark transition support for Apple rules."""

load("@rules_ios_bazel_version//:version.bzl", "bazel_version")
load(
"//rules/internal:bazel_version.bzl",
"get_bazel_version",
)
load(
"@build_bazel_apple_support//configs:platforms.bzl",
"CPU_TO_DEFAULT_PLATFORM_NAME",
Expand All @@ -25,9 +20,6 @@ _CPU_TO_DEFAULT_PLATFORM_FLAG = {
for cpu, platform_name in CPU_TO_DEFAULT_PLATFORM_NAME.items()
}

_bazel_version = get_bazel_version(bazel_version)
_bazel_major_version = int(_bazel_version.major)

def _current_apple_platform(apple_fragment, xcode_config):
"""Returns a struct containing the platform and target os version"""
platform = apple_fragment.single_arch_platform
Expand Down Expand Up @@ -167,12 +159,6 @@ def _apple_rule_transition_impl(settings, attr):

_supports_visionos = hasattr(apple_common.platform_type, "visionos")

# `--apple_compiler` was removed in https://github.com/bazelbuild/bazel/commit/1acdfc422e724b4fe12c7bf5248086ab514ec4be
_supports_clo_apple_compiler = _bazel_major_version < 7

# `--apple_grte_top` was removed in https://github.com/bazelbuild/bazel/commit/fb4106bdbd23c365337ea99704921ada7b86c2df
_supports_clo_apple_grte_top = _bazel_major_version < 7

# These flags are a mix of options defined in native Bazel from the following fragments:
# - https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/analysis/config/CoreOptions.java
# - https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java
Expand All @@ -192,10 +178,6 @@ _apple_rule_transition = transition(
"//command_line_option:apple_platforms",
] + (
["//command_line_option:visionos_cpus"] if _supports_visionos else []
) + (
["//command_line_option:apple_compiler"] if _supports_clo_apple_compiler else []
) + (
["//command_line_option:apple_grte_top"] if _supports_clo_apple_grte_top else []
) + _CPU_TO_DEFAULT_PLATFORM_FLAG.values(),
outputs = [
"//command_line_option:apple configuration distinguisher",
Expand Down

0 comments on commit 2c90bd4

Please sign in to comment.