bazel icon indicating copy to clipboard operation
bazel copied to clipboard

package_group.packages does not accept packages in external repositories

Open aj-michael opened this issue 8 years ago • 4 comments

bazel 0.6.0 linux

package_group.package does not allow labels in other packages. repro:

$ cat WORKSPACE
workspace(name = "main")
local_repository(
    name = "foo",
    path = "foo",
)

$ cat foo/BUILD
filegroup(
    name = "foo",
    visibility = [":my_package_group"],
)
package_group(
    name = "my_package_group",
    packages = ["@main//..."],
)

$ bazel build @foo//:foo
ERROR: /usr/local/google/home/ajmichael/.cache/bazel/_bazel_ajmichael/cb85aea2fd8fffc63d6f3e90b5e08db1/external/foo/BUILD:5:1: invalid package name '@main//...': must start with '//'.
ERROR: error loading package '@foo//': Package '' contains errors.
INFO: Elapsed time: 0.089s

aj-michael avatar Oct 05 '17 15:10 aj-michael

I ran into this issue indirectly, where I want to add default lint rules for java. I'm not allowed to use //... because that will match external rules as well, and I find no way to exclude external packages (which presumably this issue would fix).

So I need to do something like:

package_group(
    name = "javalint",
    packages = [
        "//every/...",
        "//dir/...",
        "//with/...",
        "//java/...",
        "//must/...",
        "//be/...",
        "//manually/...",
        "//added/...",
    ],
)

when this should have been all that's needed:

package_group(
    name = "javalint",
    packages = [
        "//...",
    ],
)

//... should not really match external rules at all, but as of 0.14 it does.

gorset avatar Jun 20 '18 18:06 gorset

Any progress on this? Bazel 0.24 still doesn't allow external packages in package_groups.

chsigg avatar Jun 07 '19 14:06 chsigg

Hi there! We're doing a clean up of old issues and will be closing this one. Please reopen (or ping me to reopen) if you’d like to discuss anything further. We’ll respond as soon as we have the bandwidth/resources to do so.

sgowroji avatar Feb 17 '23 08:02 sgowroji

Hi there, I just happened across this issue after attempting to make such a package group. It would be great if this feature could be added! 😃

ed-irl avatar May 21 '24 17:05 ed-irl