Commit Graph

44 Commits

Author SHA1 Message Date
Googler 2f8c04c044 Automatic code cleanup.
PiperOrigin-RevId: 456494185
Change-Id: I9aaefff0976cca2b68646970c8d4675c8e122d19
2022-06-22 06:02:29 -07:00
Christopher Peterson Sauer e0dad88a07 Move examples from deprecated @rules_cc//cc:find_cpp_toolchain -> @bazel_tools//tools/cpp:toolchain_utils.bzl 2022-04-11 16:38:30 -07:00
Googler 3eaa3c7f88 Remove unnecessary tests from rules_cc
They are now part of the bazelbuild/bazel repository.

Copies buildifier changes contributed by Keith in https://github.com/bazelbuild/rules_cc/pull/128

RELNOTES:none
PiperOrigin-RevId: 435312636
Change-Id: I4d5d2f58d90026c0cdfb5c0a90709de7c28c6ccd
2022-03-17 04:50:16 -07:00
Googler 426f721323 Automatic code cleanup.
PiperOrigin-RevId: 407085810
Change-Id: I6cac435d8e0e89f97405c7b3923d1891da78740b
2021-11-02 08:13:14 -07:00
Googler f846566869 Update rules_cc doc references for inclusive-language-fixit-2
PiperOrigin-RevId: 405732925
Change-Id: If700320f2e8f3e45f2fbdf08e945ea94dfe32887
2021-10-26 14:16:20 -07:00
Lizan Zhou 4b46a7a447 Add -g in `per_object_debug_info` for Clang 12 and GCC 11 2021-09-27 12:20:58 -07:00
UebelAndre 0913abc3be Added `bzl_srcs` targets which only contain `.bzl` files for use in stardoc 2021-08-12 07:14:28 -07:00
Keith Smiley 03b5d84aa7 Add armeabi_cc_toolchain_config.bzl to macOS config
This is required since https://github.com/bazelbuild/bazel/pull/13449
2021-05-27 13:36:41 -07:00
Googler 56897752c0 Remove restriction on generate_pdb_file to be only used in dbg and fastbuild mode
Users may want to build in opt mode and still want the pdb file to be a linking action output.
See https://github.com/bazelbuild/rules_cc/issues/94#issuecomment-828254895

RELNOTES: None
PiperOrigin-RevId: 372351216
Change-Id: I1b8a8709014deb4abdb13db387e185cd08f408d7
2021-05-06 08:44:55 -07:00
Googler 9544a3eeac Automatic code cleanup.
PiperOrigin-RevId: 362075479
Change-Id: Ib556b478b2e28fa6c35fe493b533035de4916bd0
2021-03-10 09:58:09 -08:00
Googler 88ef31b429 Update rules_cc to use the correct toolchain type (@bazel_tools//tools/cpp:toolchain_type).
PiperOrigin-RevId: 361158816
Change-Id: Ief011b23ddb9bdf3b49237f90fa631b6f916e8de
2021-03-05 09:10:23 -08:00
Copybara-Service b1c40e1de8 Merge pull request #88 from greenhouse-org:fix-llvm-version
PiperOrigin-RevId: 341810986
Change-Id: Ieb85da0b1c25d095cd48b6cadcf6a5c825d24a48
2020-11-11 05:29:11 -08:00
Keith Smiley 271d293a8c Update osx_cc_wrappers
These are dup'd from bazel core and are changing in https://github.com/bazelbuild/bazel/pull/12265
2020-11-04 12:35:10 -08:00
Sunjay Bhatia 1a27322a0a Resolve the clang-cl version detection
- bazel presumed a trailing space in `clang-cl -v` output that is
  no longer present in the 11.0.0 release, resulting in an injected newline

Co-authored-by: Sunjay Bhatia <sunjayb@vmware.com>
Co-authored-by: William A Rowe Jr <wrowe@vmware.com>
Signed-off-by: Sunjay Bhatia <sunjayb@vmware.com>
Signed-off-by: William A Rowe Jr <wrowe@vmware.com>
2020-11-03 16:39:36 -05:00
Keith Smiley c5a9b6d32f Duplicate libtool_check_unique.cc
This is temporarily required to support old and new versions of bazel
2020-10-03 10:02:04 -07:00
Keith Smiley 5bf327ff82 Sync osx_cc_configure
Fixes https://github.com/bazelbuild/rules_cc/issues/80
2020-10-03 09:59:36 -07:00
Googler f95239adde Update rules_cc to use the toolchain transition.
This is phase 2 of of the switch to toolchain transitions. See https://github.com/bazelbuild/bazel/issues/11584 for details.

PiperOrigin-RevId: 334808134
Change-Id: Ie198b07359d4fd45368755c4cc223e397f0e8fb0
2020-10-01 07:19:37 -07:00
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