Skip to content

Commit

Permalink
Migrate the rest of the Xcode tests from Bazel core (Java) to Starlar…
Browse files Browse the repository at this point in the history
…k (except those that can't be migrated because they use experimental flags).

PiperOrigin-RevId: 630133992
  • Loading branch information
allevato authored and swiple-rules-gardener committed May 2, 2024
1 parent 99ffc6a commit d5a60a6
Show file tree
Hide file tree
Showing 3 changed files with 1,665 additions and 52 deletions.
1 change: 1 addition & 0 deletions test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ bzl_library(
"//lib:xcode_support",
"//xcode:available_xcodes",
"//xcode:xcode_config",
"//xcode:xcode_config_alias",
"//xcode:xcode_version",
"@bazel_skylib//lib:unittest",
],
Expand Down
22 changes: 22 additions & 0 deletions test/test_helpers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

"""Common Starlark helpers used by apple_support tests."""

load("@bazel_skylib//lib:unittest.bzl", "analysistest")

visibility([
"@build_bazel_apple_support//test/...",
])
Expand All @@ -24,6 +26,26 @@ FIXTURE_TAGS = [
"manual",
]

def find_action(env, mnemonic):
"""Finds the first action with the given mnemonic in the target under test.
This generates an analysis test failure if no action was found.
Args:
env: The analysis test environment.
mnemonic: The mnemonic to find.
Returns:
The first action matching the mnemonic, or `None` if none was found.
"""
actions = analysistest.target_actions(env)
for action in actions:
if action.mnemonic == mnemonic:
return action

analysistest.fail(env, "No '{}' action found".format(mnemonic))
return None

def make_unique_namer(*, prefix, index):
"""Returns a function used to generate unique names in a package.
Expand Down
Loading

1 comment on commit d5a60a6

@brentleyjones
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.