bazelbuild / rules_cc

C++ Rules for Bazel
https://bazel.build
Apache License 2.0
182 stars 90 forks source link

Trying to modify immutable set #39

Closed ozio85 closed 4 years ago

ozio85 commented 4 years ago

Description of the problem / feature request:

Problem occurs if a tag is already used in a rule: File "D:/build/j4jghgxg/external/rules_cc/cc/defs.bzl", line 21, in _add_tags attrs["tags"] += [_MIGRATION_TAG] trying to mutate a frozen object

I guess it is not ready to use yet, but this seems like a bug anyway

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Use rules_cc with a rule with existing "tags"

What operating system are you running Bazel on?

0.29.1

What version of rules_cc do you use? Can you paste the workspace rule used to fetch rules_cc? What other relevant dependencies does your project have?

0d5f3f2768c6ca2faca0079a997a97ce22997a0c

Have you found anything relevant by searching the web?

Nope :)

onet-git commented 4 years ago

I have tested this on 0.26 and 1.2.0 and both fail when using rules_cc instead of built in native rules if your project also uses tags. I thought perhaps mutability had changed over time, but I don't think this line ever worked. @oquenchil @hlopko?

oquenchil commented 4 years ago

Fixed here: https://github.com/bazelbuild/rules_cc/commit/cfe68f6bc79dea602f2f6a767797f94a5904997f

oquenchil commented 4 years ago

You will have to include a later commit of rules_cc

oquenchil commented 4 years ago
http_archive(
    name = "rules_cc",
    sha256 = "e75dfb05bc1e89ebbb6696cadb5e455833690009310d9dc5512151c5adb0e4e3",
    strip_prefix = "rules_cc-cfe68f6bc79dea602f2f6a767797f94a5904997f",
    urls = [        "https://github.com/bazelbuild/rules_cc/archive/cfe68f6bc79dea602f2f6a767797f94a5904997f.zip",
    ],
)
lberki commented 4 years ago

Is this still a problem?

load("@rules_cc//cc:defs.bzl", "cc_binary")

cc_binary(
    name = "cc",
    srcs = ["cc.cc"],
    tags = ["tag"],
)

Seems to work alright.