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

Fix issue referencing the Tests package from another Bazel workspace #5977

Merged
merged 2 commits into from
Jan 22, 2025

Conversation

jszumski
Copy link
Contributor

@jszumski jszumski commented Jan 21, 2025

Allow BuiltInRulesTests data to be empty so a workspace can load the Tests package from a release archive.

Otherwise, Bazel users with --incompatible_disallow_empty_glob enabled will hit this error because the release archive only contains Swift files and not any test fixtures:

Error in glob: glob pattern 'BuiltInRulesTests/Resources/**' didn't match anything, but allow_empty is set to False (the default value of allow_empty can be set with --incompatible_disallow_empty_glob).

Note that --incompatible_disallow_empty_glob is enabled by default in Bazel 8

@SwiftLintBot
Copy link

2 Messages
📖 Building this branch resulted in the same binary size as when built on main.
📖 Skipping OSS check because SwiftLint hasn't changed compared to main.

Generated by 🚫 Danger

Copy link
Collaborator

@SimplyDanny SimplyDanny left a comment

Choose a reason for hiding this comment

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

Thanks!

Is this a regression? BuiltInRulesTests was newly added in 0.58.0. However, the resources were just moved from FrameworkTests and I don't see that allow_empty = True was previously specified there.

CHANGELOG.md Outdated Show resolved Hide resolved
@SimplyDanny SimplyDanny enabled auto-merge (squash) January 22, 2025 18:29
@jszumski
Copy link
Contributor Author

I believe this worked previously because the old glob was:

filegroup(
    name = "SwiftLintFrameworkTestsData",
    srcs = glob(
        ["**/**"],
        # Bazel doesn't support paths with spaces in them
        exclude = ["SwiftLintFrameworkTests/Resources/FileNameNoSpaceRuleFixtures/**"],
    ),
    visibility = ["//visibility:public"],
)

which would end up matching some Swift source files in the release distribution and thus wasn't empty.

@SimplyDanny SimplyDanny merged commit 854d3f2 into realm:main Jan 22, 2025
19 checks passed
@jszumski jszumski deleted the fix-empty-glob branch January 22, 2025 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants