Remove attribute for visibility file.

The same command line can be obtained with the attributes
user_link_flags and additional_linker_inputs used together.

In the first design iterations of cc_shared_library it was decided to have the
visibility_file attribute so that a cc_shared_library could be used for many
different platforms smoothly.

For this to work the visibility file would have had to be platform neutral and
then Bazel would have had to write a visibility file specific for each
platform, e.g. the version script for Unix and the exports map for Windows.

However, in the last approved design it was decided not to have Bazel get in
the business of understanding symbols and automatically writing export maps.

With this approach, it then became necessary for people to use selects() in the
visibility_file attribute depending on the platform that the file was for.

Since we have added a new way to add files with the attribute
additional_linker_inputs and we need selects() anyway,
it doesn't make sense to keep the visibility_file attribute, the
same can be achieved with selects in the other two attributes mentioned.

In any case, if this can be made more ergonomic in the future, we can do so.
However, removing this attribute after flipping the experimental flag would be
an incompatible change.

PiperOrigin-RevId: 295925566
Change-Id: I52733e006f4b0f79f50380e89fc2eeae58dbad4d
2 files changed
tree: 0b534a99493d5ed40d80e648fbe4a2942b18066b
  1. .bazelci/
  2. cc/
  3. distro/
  4. examples/
  5. tests/
  6. third_party/
  7. tools/
  8. .gitignore
  9. BUILD
  10. CODEOWNERS
  11. CONTRIBUTING.md
  12. internal_deps.bzl
  13. internal_setup.bzl
  14. ISSUE_TEMPLATE.md
  15. LICENSE
  16. README.md
  17. renovate.json
  18. WORKSPACE
README.md

C++ rules for Bazel

  • Postsubmit Build status
  • Postsubmit + Current Bazel Incompatible flags Build status

This repository contains Starlark implementation of C++ rules in Bazel.

The rules are being incrementally converted from their native implementations in the Bazel source tree.

For the list of C++ rules, see the Bazel documentation.

Getting Started

There is no need to use rules from this repository just yet. If you want to use rules_cc anyway, add the following to your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "rules_cc",
    urls = ["https://github.com/bazelbuild/rules_cc/archive/TODO"],
    sha256 = "TODO",
)

Then, in your BUILD files, import and use the rules:

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

cc_library(
    ...
)

Migration Tools

This repository also contains migration tools that can be used to migrate your project for Bazel incompatible changes.

Legacy fields migrator

Script that migrates legacy crosstool fields into features (incompatible flag, tracking issue).

TLDR:

bazel run @rules_cc//tools/migration:legacy_fields_migrator -- \
  --input=my_toolchain/CROSSTOOL \
  --inline

Contributing

Bazel and rules_cc are the work of many contributors. We appreciate your help!

To contribute, please read the contribution guidelines: CONTRIBUTING.md.

Note that the rules_cc use the GitHub issue tracker for bug reports and feature requests only. For asking questions see: