Commit Graph

27 Commits

Author SHA1 Message Date
Googler 02becfef8b Automatic code cleanup.
PiperOrigin-RevId: 327262788
Change-Id: I13ea852be5ec154593a547e4a4511df5f9c94928
2020-08-18 10:57:24 -07:00
Marcel Hlopko d6cfe773b8 Rename skylark->starlark 2020-06-03 09:13:26 +02:00
Marcel Hlopko 0e4443f2ca Instead disable the buildifier warning 2020-05-04 11:59:13 +02:00
Marcel Hlopko b70b375b6d Add `name` parameter to `cc_configure`
To satisfy the buildifier and make the build green again.
2020-05-04 11:58:50 +02:00
Marcel Hlopko ed50da4736 Disable unnamed-macro check for cc_configure 2020-05-04 11:58:50 +02:00
Googler 67086db2c4 Remove obsolete alias to //external:cc_toolchain.
RELNOTES: None.
PiperOrigin-RevId: 306383589
Change-Id: Id1c4cebefb444d7bd76624ef05a623eafd75808d
2020-04-13 23:44:09 -07:00
Googler 7c3170fe93 Automatic code cleanup.
PiperOrigin-RevId: 305641156
Change-Id: I4f0b09f27d06c00ab23e6c7f19b187c09c8937f7
2020-04-09 01:35:48 -07:00
Googler 34ca16f4aa Partially fix MacOS llvm coverage collection
This allows setting GCOV on the command line to overwrite the default setting, which points to /usr/bin/gcov. In order to use this, you also need to disable the gcov coverage feature and enable the llvm coverage feature instead. The full command-line looks like this:

GCOV=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/llvm-profdata bazel coverage --features=llvm_coverage_map_format --features=-gcc_coverage_map_format //cpp:test

Progress on #10457.

Original change by ulfjack
RELNOTES: None.
PiperOrigin-RevId: 300583709
Change-Id: Ibeda8469db6750fc9fc3bba60e19118a2e482ed8
2020-03-12 11:08:12 -07:00
Googler d545fa4f79 C++: Move default linker flags with libs after libraries
Default linker flags contains flags like -lstdc++ which should come after the
user libraries. The library flags are removed from default linker flags and added to link_libs instead which comes after user libraries.

See #9254

Incompatible flag bug: https://github.com/bazelbuild/bazel/issues/10905

I introduce a new method to repositories ctx that allows checking the value of a Starlark semantic option from a repository rule.

RELNOTES:none
PiperOrigin-RevId: 299336105
Change-Id: I81b9ee0c72e2a2252b406f1c584997389a530e40
2020-03-06 05:45:05 -08:00
Googler 286f85b5a2 C++: Adds clang resource-dir to include paths to be searched
Fixes #10510

RELNOTES:none
PiperOrigin-RevId: 297089846
Change-Id: I06e0c6557fd83698a096b2b23a78895b1ec78500
2020-02-25 04:39:35 -08:00
Googler 4de26b53a6 Remove need for exported_by or linked_statically_by
For now we will restrict allowed exports to the same package. At the same time
static_deps should be used to take into account what should be linked into a
shared library.

RELNOTES:none
PiperOrigin-RevId: 294668451
Change-Id: Ia087519106983bfa9a980e471d3102ab391a53eb
2020-02-12 08:01:50 -08:00
Googler 7e650b11fe Fix cc toolchain autodetection to not error when BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN is set.
Copies the fix from bazelbuild/bazel#10440.

PiperOrigin-RevId: 287988047
Change-Id: I7a6bf88cf13996022c43bde872ff7874b60b04fb
2020-01-03 07:17:37 -08:00
Googler 6cfb2fba70 Fix codebase in preparation for incompatible_use_cc_configure_from_rules_cc
We're working on removing C++ toolchain autoconfiguration logic out of Bazel,
and moving towards using rules_cc repository for it. Some bzl files will no
longer be available through bazel/tools/cpp/*, but through
@rules_cc/cc/*.

RELNOTES: None.
PiperOrigin-RevId: 279935457
Change-Id: I3bae259548dacc5c6789efe0f27dd07738c1057c
2019-11-12 04:35:10 -08:00
Googler 8bd6cd75d0 Keep @rules_cc//cc:toolchain_type as fully-qualified label always
Labels in toolchains attribute need to include the repository, otherwise the resolution won't work.

RELNOTES: None.
PiperOrigin-RevId: 279347045
Change-Id: Iba1eb8bb677771e2c089ab6bc1b5e019c4da434e
2019-11-08 10:50:36 -08:00
Googler fe8f0a4cf9 Add //cc:srcs filegroup that Bazel can depend on in unittests
RELNOTES: None.
PiperOrigin-RevId: 279041716
Change-Id: I90ce28031a4f2ac737cffbe57d42030c0d1d862b
2019-11-07 02:27:13 -08:00
Copybara-Service e7c97c3af7 Merge pull request #45 from hlopko:fix_cc_configure
PiperOrigin-RevId: 278612577
Change-Id: I70ed5cfba7bc5c5ee5cb0db45e0f072a36a49cff
2019-11-05 06:40:31 -08:00
Marcel Hlopko 1f8a00e6b8 Skip gcc build configuration options mentioning gold 2019-11-04 20:02:10 +01:00
Marcel Hlopko 199157190a Use wrapped_clang for C++ link actions (port of 2682688331) 2019-11-01 17:02:17 +01:00
Marcel Hlopko 4f8676f6ca Add rules_cc_toolchains to repositories.bzl
This is the new entry point for registering C++ toolchains (replacing
implicit cc_configure()).

While at it, fix one misnamed function.
2019-11-01 16:36:34 +01:00
Googler 262ebec3c2 Fix buildifier warnings in @rules_cc
Fixes:

* Enabled buildifier on the Bazel CI again
* Added Skydocs where missing
* Moved public files out of .../private/... (e.g. cc_toolchain_config_lib.bzl)
* Reformatted
* Removed unused loads
* Using relative labels for cc_configure related files
* Added development dependency on rules_proto
    * they're not in the federation yet, so hand rolling in rules_cc's WORKSPACE file
* Added development dependency on rules_python (from federation)
* Cleaned up copybara (notable change - not using @rules_cc in labels inside rules_cc repo)
* Made cc_flags_supplier usable internally
* Moved load statements to the top of the bzl file
* Moved runfiles to the tools directory
* Unified toolchain_utils.bzl and find_cc_toolchain.bzl

RELNOTES: None.
PiperOrigin-RevId: 276479521
Change-Id: I3196896061fa2ee61a3efb130c214d288782066a
2019-10-24 07:01:25 -07:00
Googler 42ed56d8ac Remove unused load statements from .bzl files
BEGIN_PUBLIC
Remove unused load statements from .bzl files

After transitive loads have been disabled in Blaze, unused load statements have
no effect (besides not useful memory consumption).

The CL has been created automatically by calling `buildifier --lint=fix --warnings=load` on all .bzl files.

The following additional command were run on all affected files to clean them up:

  * buildifier -a -v --lint=fix --warnings=load-on-top
    Moves all load statements to the top of a file
  * buildifier -a -v --lint=fix --warnings=same-origin-load
    Compresses all load statements from the same .bzl file to one load statement

END_PUBLIC

PiperOrigin-RevId: 269552258
Change-Id: I85ae6bf3467bf560ac3e0ab2470f864abb89e8e6
2019-09-17 06:09:06 -07:00
Marcel Hlopko 8cf01f5ce5 Fix 2019-09-03 11:51:10 +02:00
Marcel Hlopko 2d62d780d1 Put include paths into action 2019-09-03 11:30:13 +02:00
Googler ea5c5422a6 Add support for thin LTO optimization in Bazel
Usage: CC=clang bazel build //foo:bar --features=thin_lto -c opt

RELNOTES: Bazel now supports ThinLTO builds on Linux for Clang versions >= 6.0. ThinLTO can be enabled through --features=thin_lto
PiperOrigin-RevId: 265649618
Change-Id: I68a38b8b8c1480e3b73d8e6f24e9dafece2c7de6
2019-08-27 03:33:52 -07:00
Googler 4a1c578fb0 C++: Move tools/cpp from bazel_tools to rules_cc
Here we are duplicating bazel_tools/tools/cpp. The goal is for the BUILD files in bazel_tools/tools/cpp to have an alias that point to rules_cc. Then later on with the incompatible flag these aliases will no longer be valid.

Working towards #8743

RELNOTES:none
PiperOrigin-RevId: 264604076
Change-Id: I389702793a1a95b0990dce93577de2b7182e2e6b
2019-08-21 07:30:04 -07:00
Googler 438368b58b Automated rollback of commit a34fafd5f5.
*** Reason for rollback ***

Rolling back. No time before 1.0.

*** Original change description ***

C++: Move tools/cpp from bazel_tools to rules_cc

Here we are duplicating bazel_tools/tools/cpp. The goal is for the BUILD files in bazel_tools/tools/cpp to have an alias that point to rules_cc. Then later on with the incompatible flag these aliases will no longer be valid.

Working towards #8743

RELNOTES:none
PiperOrigin-RevId: 258756552
Change-Id: Ia44c0b5084ed9b28efbf9058e3dc29696db86fac
2019-07-18 06:12:58 -07:00
Googler a34fafd5f5 C++: Move tools/cpp from bazel_tools to rules_cc
Here we are duplicating bazel_tools/tools/cpp. The goal is for the BUILD files in bazel_tools/tools/cpp to have an alias that point to rules_cc. Then later on with the incompatible flag these aliases will no longer be valid.

Working towards #8743

RELNOTES:none
PiperOrigin-RevId: 258344117
Change-Id: I5c0ffb1c7b501facabb543ad57440ea067ab3d34
2019-07-16 04:57:31 -07:00