Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record warnings from the Xcode rules as structured information in dummy actions so that we can test them #333

Draft
wants to merge 3 commits into
base: bj/fork-the-xcode-rules-from-bazel-built-in-starlark-into-apple_support
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Migrate the rest of the Xcode tests from Bazel core (Java) to Starlar…
…k (except those that can't be migrated because they use experimental flags).

PiperOrigin-RevId: 630133992
(cherry picked from commit d5a60a6)
allevato authored and brentleyjones committed May 17, 2024

Verified

This commit was signed with the committer’s verified signature.
brentleyjones Brentley Jones
commit 454d4d1a33e844d128402c516673f35f99b2cf5b
1 change: 1 addition & 0 deletions test/BUILD
Original file line number Diff line number Diff line change
@@ -62,6 +62,7 @@ bzl_library(
"//lib:xcode_support",
"//xcode:available_xcodes",
"//xcode:xcode_config",
"//xcode:xcode_config_alias",
"//xcode:xcode_version",
"@bazel_skylib//lib:unittest",
],
22 changes: 22 additions & 0 deletions test/test_helpers.bzl
Original file line number Diff line number Diff line change
@@ -14,6 +14,8 @@

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

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

visibility(["//test/..."])

# Common tags used for all test fixtures to ensure that they don't build unless
@@ -22,6 +24,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.
1,761 changes: 1,709 additions & 52 deletions test/xcode_config_test.bzl

Large diffs are not rendered by default.