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

Missing transitive dep with bzlmod #1598

Closed
keith opened this issue Jan 18, 2023 · 8 comments · Fixed by #1599 or #1771
Closed

Missing transitive dep with bzlmod #1598

keith opened this issue Jan 18, 2023 · 8 comments · Fixed by #1599 or #1771
Assignees
Labels
bug Something isn't working bzlmod
Milestone

Comments

@keith
Copy link
Member

keith commented Jan 18, 2023

Describe the bug

ERROR: Internal precondition failure:
Target @SwiftLint//Tests:ExtraRulesTests was not found in the transitive dependencies of @//tools:swiftlint_xcodeproj's `top_level_targets` attribute. Did you reference an alias (only actual target labels are supported in Scheme definitions)? Check that @SwiftLint//Tests:ExtraRulesTests is spelled correctly, and if it is, add it or a target that depends on it to @//tools:swiftlint_xcodeproj's `top_level_targets` attribute.
Please file a bug report at https://github.com/buildbuddy-io/rules_xcodeproj/issues/new?template=bug.md

Reproduction steps

We use SwiftLint's bazel feature to add extra rules and then generate this project for working on those extra rules:

xcodeproj(
    name = "swiftlint_xcodeproj",
    bazel_path = "./bazelw",
    project_name = "SwiftLint",
    schemes = [
        xcode_schemes.scheme(
            name = "SwiftLint",
            build_action = xcode_schemes.build_action(
                targets = [
                    "@SwiftLint//:swiftlint",
                ],
            ),
            launch_action = xcode_schemes.launch_action(
                "@SwiftLint//:swiftlint",
                args = [
                    "--progress",
                ],
            ),
            test_action = xcode_schemes.test_action([
                "@SwiftLint//Tests:ExtraRulesTests",
            ]),
        ),
    ],
    tags = ["manual"],
    top_level_targets = [
        "@SwiftLint//:swiftlint",
        "@SwiftLint//Tests:ExtraRulesTests",
    ],
)

When switching to bzlmod for swiftlint + rules_xcodeproj we hit the error above

Expected behavior

Versions

  • Bazel: 6.0.0
  • rules_xcodeproj: 0.12.0
  • rules_apple: 2.0.0
  • rules_swift: 1.5.1

Additional context

This requires realm/SwiftLint#4704 and some other bzlmod deps right now, might be easier to test later

@keith keith added the bug Something isn't working label Jan 18, 2023
@brentleyjones
Copy link
Contributor

I was able to repro with my own setup. Thank for the report! I'm hoping to get a 0.12.1 release out soon that fixes up bzlmod support.

@brentleyjones brentleyjones self-assigned this Jan 18, 2023
@brentleyjones brentleyjones added this to the 0.12.1: Bzlmod support milestone Jan 18, 2023
brentleyjones added a commit that referenced this issue Jan 18, 2023
Fixes #1598.

Tested:

- Bazel 5.4
- Bazel 6.0 with `--noincompatible_unambiguous_label_stringification`
- Bazel 6.0 with `--noincompatible_unambiguous_label_stringification`
- Bazel 6.0 with `--enable_bzlmod`
@brentleyjones brentleyjones reopened this Jan 18, 2023
@keith
Copy link
Member Author

keith commented Jan 18, 2023

repro.zip

here's a repro case

@brentleyjones
Copy link
Contributor

I think we are currently blocked on bazelbuild/bazel#17260 when the labels reference external repos.

@brentleyjones
Copy link
Contributor

Looks like we might get a fix in 6.1.

@brentleyjones brentleyjones modified the milestones: 0.12.1: Bzlmod support, 1.0 Jan 19, 2023
brentleyjones added a commit that referenced this issue Jan 19, 2023
Part of #1598.

Removes the need for the Bazel 6 check. Also will work better once Bazel
allows caller-relative label creation.
@brentleyjones brentleyjones modified the milestones: 1.0, Post 1.0 Jan 30, 2023
@brentleyjones
Copy link
Contributor

We won't delay the release over this change. We will fix it whenever the change in Bazel lands.

@brentleyjones
Copy link
Contributor

We can fix this with 6.1: bazelbuild/bazel@c540ebf

@keith
Copy link
Member Author

keith commented Feb 17, 2023

is it possible to fix now with that having landed using getattr for backwards compat?

@brentleyjones
Copy link
Contributor

Ahh, yes. I'll get to it early next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bzlmod
Projects
None yet
2 participants