Commit Graph

175 Commits

Author SHA1 Message Date
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
Yun Peng 8e7357c5cc Move extensions.bzl to //cc to make buildifier happy 2021-11-05 12:21:01 +01: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
Googler d5d830baaf CcToolchainProvider does not subclass ToolchainInfo.
Bownstream bazel tests: https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/1931 (all failures are also in https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/1930, the nightly).

PiperOrigin-RevId: 359497882
Change-Id: Ib8a3725251c1187233f9324522c4ef8602448b50
2021-02-25 05:13:20 -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
Googler 8cded3e3c3 Add constants for common groups of action names.
These are used throughout the Crosstool features definitions based on local definitions there.  It seems useful to move these to a common location so they are available for other toolchains (and also so that they get updated if new actions are added to the action-name list).

The versions of these currently used by Crosstool are defined in //third_party/crosstool/v18/llvm_unstable/crosstool_helpers.bzl starting at line 124.
Tested:
  by inspection
PiperOrigin-RevId: 339440647
Change-Id: I3a2b8d37aebd8a0e8450864e079cf5b42d075def
2020-10-28 05:27:07 -07: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 9ec8187d58 Add docstring to providers to make buildifier happy.
RELNOTES: None.
PiperOrigin-RevId: 334807705
Change-Id: If0c97e6a464126367005143313dc4ddc5b47bdea
2020-10-01 07:16:37 -07:00
Copybara-Service 53f28aeac9 Merge pull request #79 from agluszak:system_library
PiperOrigin-RevId: 333279551
Change-Id: I6fdf5aca5881b271d30f5acbad48e0c1ae281237
2020-09-23 06:28:04 -07:00
Andrzej Głuszak 8398f4b2c1 Fixes after code review 2020-09-23 11:11:15 +00:00
Andrzej Głuszak 8346df34b6 Remove line breaks using backslashes 2020-09-22 14:07:45 +00:00
Andrzej Głuszak 299299f82a Move description to doc parameter, add docs for arguments 2020-09-22 13:59:48 +00:00
Andrzej Głuszak c4886cbf16 Add a module description 2020-09-22 11:48:42 +00:00
Andrzej Głuszak d3808499d2 Fix style 2020-09-22 08:18:25 +00:00
Andrzej Głuszak 6c1dbe079d Implement a repository rule for importing system libraries 2020-09-21 17:47:08 +00: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 65436199d8 Duh 2020-05-04 11:59:13 +02:00
Marcel Hlopko e8781b53aa Fix repositories.bzl 2020-05-04 11:59:10 +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 cfe68f6bc7 Fix immutable frozen set bug in defs.bzl
When adding tags to a native cc_library rule that is created through a macro we
were not properly considering the case where the tags came from a different
file and therefore were frozen. This caused an error.

RELNOTES:none
PiperOrigin-RevId: 283039855
Change-Id: Id4cb45675a08ca65196f4f7771abdd5bb0705b79
2019-11-29 04:19:02 -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 fbde6cceb5
Merge branch 'master' into fix_cc_configure 2019-11-04 15:47:01 +01:00
Marcel Hlopko 4420fcb440 Fix typo 2019-11-04 09:38:06 +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
fweikert 182a477244 Add version number to a dedicated bzl file
Adding the version number to defs.bzl caused some problems in our internal codebase.
2019-10-02 15:25:05 +02:00
fweikert 29da92c66c Use rules_pkg for building releases
This commit allows the creation of distributions, with 0.0.1 being the first version.
See distro/README.md for details on how to build a release.

This commit also uses a new version of the Bazel federation that contains rules_pkg 0.2.2 instead of 0.2.1.

There are still some problems with the WORKSPACE stanza that is being printed by the release notes generation script, though:
- It references a //cc:deps.bzl file, which doesn't exist. I have to modify the scripts in rules_pkg to support a flag like 'has_deps'.
- It doesn't support the Bazel federation yet, since it always tells users to download code from the rules_cc repository.
2019-09-17 18:00:18 +02: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 1d7c9eb8c8 Update copyright year in BUILD file.
RELNOTES:none
PiperOrigin-RevId: 265457282
Change-Id: Ibfb7f335c5f8c563ce9b31ba22435eec210cf132
2019-08-26 08:06:40 -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
Florian Weikert 6cc7e712fb Fetch dependencies through the Bazel federation.
As a result of this commit, rules_cc now contains the required bzl files to be tested as part of the Bazel federation.
2019-08-09 15:41:00 +02:00
Googler b7fe9697c0 C++: Add two more rules to defs.bzl in rules_cc
These rules are in bazel_tools.

RELNOTES:none
PiperOrigin-RevId: 259298756
Change-Id: I9ed4b8f3cd712adc889a950765c96b5b68a5d43c
2019-07-22 04:17:22 -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
oquenchil 03e7a77edc Adds load statement for @rules_cc
This is in preparation for --incompatible_load_cc_rules_from_bzl

Closes #8744.

PiperOrigin-RevId: 256969979
Change-Id: I4f73790b9204156a5380e97e6bda70e2066d04a7
2019-07-08 07:01:57 -07:00
Marcel Hlopko ec70973809 Fix sha hash of the skylib release, and put mirror first
I have no clue what happened, but it seems skylib release on github was
changed after rules_cc started to depend on it.
2019-06-28 18:46:43 +02:00
Copybara-Service 74019302a4 Merge pull request #21 from excitoon:patch-1
PiperOrigin-RevId: 255562043
Change-Id: I6b744cfcdac6578e860ad3e1a48f374e494d37bc
2019-06-28 01:56:05 -07:00
Googler 0d5f3f2768 C++: Adds macros for wrapping C++ rules.
See: https://docs.google.com/document/d/1PgCYKVUBpFA0ZXTHTgHhUiLGgTRPloxKJ2d2t47TNo4/edit?usp=sharing

RELNOTES:none
PiperOrigin-RevId: 255411415
Change-Id: I319fac86118d051644a19422d1f474bec2538774
2019-06-27 09:00:21 -07:00
Vladimir Chebotarev 4afc266bf0
Placed GitHub release first for @skylib.
See bazelbuild/bazel-skylib#164.
2019-06-27 13:51:21 +03:00
Googler d36c8d400c Refactor rules_cc to follow https://docs.bazel.build/versions/master/skylark/deploying.html
RELNOTES: None.
PiperOrigin-RevId: 253736769
Change-Id: Ib13ecb077559f890aa3cc207b7ec1a53ac18d553
2019-06-18 00:21:44 -07:00
Copybara-Service 236c6eb75c Merge pull request #17 from hlopko:add_find_cc_toolchain
PiperOrigin-RevId: 250229272
Change-Id: Id5cd1bfa65b53a54c6443a661337d5dcdcfed2e3
2019-05-28 00:50:32 -07:00
Marcel Hlopko d991801638 Add find_cc_toolchain.bzl to help accessing current C++ toolchain
This is to help migrating for:

* https://github.com/bazelbuild/bazel/issues/7260
* https://github.com/bazelbuild/bazel/issues/7643

It's mostly a copy of the file in
`@bazel_tools//tools/cpp:toolchain_utils.bzl`, with a small difference -
it depends on `@rules_cc//cc:toolchain_type`, not on
`@bazel_tools//tools/cpp:toolchain_type`.
2019-05-27 10:47:06 +02:00
Marcel Hlopko e283f126b5 Add //cc:toolchain_type alias to allow forward migration with Bazel 0.27
This target will eventually be the canonical place for C++ toolchain
type. Currently the actual target resides in @bazel_tools, but that will
soon change.
2019-05-27 09:09:16 +02:00
Googler 9667b3dd9a .../BUILD: fix build file/module bugs (#18)
Change this pattern
    if foo [not] in native.existing_rules():
to
    if [not] native.existing_rule(foo):
for efficiency.

PiperOrigin-RevId: 241954724
2019-04-04 10:25:18 -07:00
Googler 951df6a496 Add skylib dependency
[Copybara import of https://github.com/bazelbuild/rules_cc/pull/10]

Skylib will be used to check minimum supported Bazel version.
Merge 2e5b5eb2d0 into 3723b4c35f

PiperOrigin-RevId: 240725578
2019-03-28 00:52:17 -07:00
hlopko 17818b2501 Add initial content of rules_cc repo
RELNOTES: None.
PiperOrigin-RevId: 227846116
2019-01-09 08:58:14 +01:00