Skip to content

Commit 454d4d1

Browse files
allevatobrentleyjones
authored andcommitted
Migrate the rest of the Xcode tests from Bazel core (Java) to Starlark (except those that can't be migrated because they use experimental flags).
PiperOrigin-RevId: 630133992 (cherry picked from commit d5a60a6)
1 parent 85792ef commit 454d4d1

File tree

3 files changed

+1732
-52
lines changed

3 files changed

+1732
-52
lines changed

test/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ bzl_library(
6262
"//lib:xcode_support",
6363
"//xcode:available_xcodes",
6464
"//xcode:xcode_config",
65+
"//xcode:xcode_config_alias",
6566
"//xcode:xcode_version",
6667
"@bazel_skylib//lib:unittest",
6768
],

test/test_helpers.bzl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

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

17+
load("@bazel_skylib//lib:unittest.bzl", "analysistest")
18+
1719
visibility(["//test/..."])
1820

1921
# Common tags used for all test fixtures to ensure that they don't build unless
@@ -22,6 +24,26 @@ FIXTURE_TAGS = [
2224
"manual",
2325
]
2426

27+
def find_action(env, mnemonic):
28+
"""Finds the first action with the given mnemonic in the target under test.
29+
30+
This generates an analysis test failure if no action was found.
31+
32+
Args:
33+
env: The analysis test environment.
34+
mnemonic: The mnemonic to find.
35+
36+
Returns:
37+
The first action matching the mnemonic, or `None` if none was found.
38+
"""
39+
actions = analysistest.target_actions(env)
40+
for action in actions:
41+
if action.mnemonic == mnemonic:
42+
return action
43+
44+
analysistest.fail(env, "No '{}' action found".format(mnemonic))
45+
return None
46+
2547
def make_unique_namer(*, prefix, index):
2648
"""Returns a function used to generate unique names in a package.
2749

0 commit comments

Comments
 (0)