Commit Graph

103 Commits

Author SHA1 Message Date
Googler 1583313f41 Fix licensing errors and add default condition for `local_defines`.
PiperOrigin-RevId: 548995629
Change-Id: I0734ca5b64cf37401ec74a339a67f3044321aa7c
2023-07-18 07:27:57 -07:00
Copybara-Service 5d8ef91731 Merge pull request #167 from fmeum:add-compiler-settings
PiperOrigin-RevId: 548940888
Change-Id: Id69973c5014cfe59729cab2d983df24b7422602d
2023-07-18 02:38:23 -07:00
Googler 5a8cab742c Add support for expand_if_available for env_entry
PiperOrigin-RevId: 548694860
Change-Id: I90f46902058fe1ac3a75bb25bddbbf6e181fbabd
2023-07-17 08:12:34 -07:00
Fabian Meumertzheim 4e72e665a3 Add well-known compiler `config_setting`s
As of Bazel 6.0.0, all Bazel-provided toolchains report consistent
compiler names that can be matched on with `select`. Having a central
place for `config_setting`s that can be used for this purpose makes it
so that rulesets don't have to define them themselves and moving the
compiler flag out of `@bazel_tools` becomes easier as it is no longer
referenced directly.

Also includes minor fixes to `//tests/...` so that it can be enabled in
CI.
2023-07-10 16:39:33 +02:00
Googler 1dbb691712 Get rid of unused objcpp_executable type
PiperOrigin-RevId: 539637641
Change-Id: I80f65a738e77b58054121bfe19a47659fb50fc42
2023-06-12 06:53:11 -07:00
Googler 7f0992b0bd Remove `cc_host_toolchain_alias` target.
Right now there should be no difference between `cc_host_toolchain_alias` and `cc_toolchain_alias` rules.
This is a potentially breaking change for Bazel, if something was depending on `current_cc_host_toolchain` try depending on `current_cc_toolchain` instead.

PiperOrigin-RevId: 528762965
Change-Id: Id2d211c61fa06a578a838c054682c3507aa48261
2023-05-02 06:19:53 -07:00
Googler 2e4313aeba Automated rollback of commit 06e9dcf4b7.
*** Reason for rollback ***

Breaking tap/blaze. Example failure: []

*** Original change description ***

Sort action lists to make diffing easier.

***

PiperOrigin-RevId: 523671424
Change-Id: I475ff02bf8efd3c56e489e2de3ba2c3a5639c32e
2023-04-12 05:19:20 -07:00
Googler 06e9dcf4b7 Sort action lists to make diffing easier.
PiperOrigin-RevId: 523639362
Change-Id: I8a43799f58ad1ed5b19ec074fa9cb9a567591f36
2023-04-12 02:07:04 -07:00
Yannic 507f49698a Update cc_toolchain_config_lib.bzl for bazelbuild/bazel#10967 2023-02-16 10:19:56 -08:00
Googler ad1830946d Remove redundant "# copybara-use-repo-external-label"
Remove redundant tags for copybara to replace labels with labels including the
repository, where there are no labels to substitute after 2f8c04c044.

PiperOrigin-RevId: 510103824
Change-Id: I9b65a6b7f9b48885aec4df5f4723273633be4860
2023-02-16 04:17:58 -08:00
Googler d8dfa8b829 Introduce flag --@rules_cc//:link_extra_libs
Numerous tools override --custom_malloc to add debugging or monitoring runtimes
(see e.g. sanitizers). While this is fine for cases where the tool must also
override malloc to function, in other cases it's simply misuse of
--custom_malloc where no other mechanism exists to link an extra library.

This becomes especially problematic where a runtime library is supposed to be
added in certain configurations that should run in production or other
performance sensitive builds. In these cases, we should _not_ override malloc,
which may also be specified by a cc_binary target. Doing so would introduce
unwanted changes, potentially affecting performance negatively.

This is the @rules_cc counterpart to the equivalent Bazel tools flag
--@bazel_tools//tools/cpp:link_extra_libs. Users that use @rules_cc to build
their C++ projects may use both flags interchangably, however, the @rules_cc
flag should be preferred.

PiperOrigin-RevId: 510103352
Change-Id: Iafccd00ffdb65cb4f953d5acadc451cffc134533
2023-02-16 04:15:10 -08:00
Copybara-Service c7849af112 Merge pull request #154 from keith:ks/move-apple-toolchain-setup-to-apple_support
PiperOrigin-RevId: 502796914
Change-Id: I2cd0481a244db416ec2abb06e05dee0f783b72b5
2023-01-18 00:42:02 -08:00
Copybara-Service d7c11265cb Merge pull request #166 from fmeum:patch-1
PiperOrigin-RevId: 501245941
Change-Id: Ic064d20847215c65bf01fda2e1941cb497d949bf
2023-01-11 04:34:10 -08:00
Fabian Meumertzheim 66cf3048e9 Copybara Merge: https://github.com/bazelbuild/rules_cc/pull/165
BEGIN_PUBLIC
Copybara import of the project:

--
56e69b82484f1a9fb55d8173cc112f9f608f3581 by Fabian Meumertzheim <fabian@meumertzhe.im>:

Simplify WORKSPACE setup and update ancient deps

By removing a single unused `bzl_library` target, rules_cc no longer has
any dependencies that would need to be loaded by a dependency macro. The
existing macro is made a no-op.

The few needed Bazel Federation dependencies are inlined and, in the
case of bazel_skylib and abseil-py, updated to modern versions.

Also reorders `WORKSPACE` to list direct dependencies first and keeps
`MODULE.bazel` in sync with the dependency versions used in WORKSPACE.

The `ubuntu1604` CI pipeline is removed as the version of Python used by
it is no longer supported and the distribution is EOL. Instead, a new
pipeline is added to check the Bzlmod build.

END_PUBLIC

COPYBARA_INTEGRATE_REVIEW=https://github.com/bazelbuild/rules_cc/pull/165 from fmeum:fix-workspace-module 56e69b82484f1a9fb55d8173cc112f9f608f3581
PiperOrigin-RevId: 501245864
Change-Id: Ib71ad910705807a00929a76774387a38d2da0f9f
2023-01-11 04:33:23 -08:00
Googler bc665f9271 Automated rollback of commit 48881f1f45.
*** Reason for rollback ***

Broke a test

*** Original change description ***

The auto-configured toolchains provided by Bazel itself have diverged heavily from the version maintained in this repo. There is no need to maintain this duplication until Starlarkification has progressed succiciently for rules_cc to be the source of truth for them.

This is particularly relevant for Bzlmod, which currently uses the toolchains defined in rules_cc. As a result, Bazel C++ builds will use subtly different toolchains depending on whether --enable_bzlmod is used or not. This is fixed...

***

PiperOrigin-RevId: 501228335
Change-Id: I858dc3ea44df7ae70b5603f6dc2e082b4540c42a
2023-01-11 02:48:25 -08:00
Fabian Meumertzheim 48881f1f45 The auto-configured toolchains provided by Bazel itself have diverged heavily from the version maintained in this repo. There is no need to maintain this duplication until Starlarkification has progressed succiciently for rules_cc to be the source of truth for them.
This is particularly relevant for Bzlmod, which currently uses the toolchains defined in rules_cc. As a result, Bazel C++ builds will use subtly different toolchains depending on whether --enable_bzlmod is used or not. This is fixed by loading toolchain detection logic from @bazel_tools in the module extension.

Closes #163

PiperOrigin-RevId: 501199523
Change-Id: I01f263d37495d0c5dd070c8a32945898d1d639c5
2023-01-11 00:12:08 -08:00
Keith Smiley 404bb430e7
Remove entire macOS toolchain
This defaults to C++, and the previous setup will be moved to
apple_support
2023-01-10 08:43:46 -08:00
Keith Smiley 52f5feaf1d
Move Apple toolchain setup to apple_support
Mirrors https://github.com/bazelbuild/bazel/pull/16619
2023-01-10 08:43:45 -08:00
Fabian Meumertzheim cbf01d28ec Delete `cc/version.bzl`
The version has never been updated since the first release and since rules_cc is currently a slim wrapper around Bazel-provided rules, version detection shouldn't be necessary.
2023-01-10 11:02:51 +01:00
Fabian Meumertzheim 06112c7d9e The targets in the old package were either not publicly visible or testonly dependencies and had diverged heavily from @bazel_tools.
Instead, add an alias to the Bazel-provided runfiles library under //cc/runfiles, following https://bazel.build/rules/deploying.

Closes #162

PiperOrigin-RevId: 500929486
Change-Id: I3290c2b836af2313fbf45459c81af24fbde877d0
2023-01-10 02:00:52 -08:00
Googler 7673ce6438 Delete objc_archive action type
PiperOrigin-RevId: 499061707
Change-Id: Ia2a79f33c991a9c517c2fa940ff25c959ca35d65
2023-01-02 12:08:25 -08:00
Keith Smiley 99df95ba02
Apply upstream libtool_check_unique fix
This ports 48dd159808
2022-11-01 10:05:26 -07:00
Ivo List 13d212d39b Merge pull request #146 from bazelbuild:meteorcloudy-patch-1
PiperOrigin-RevId: 475272913
Change-Id: Id75eee2933ee396ae5fc5cbe4941369b813b2c8e
2022-09-19 13:51:00 +00:00
Tony Aiuto 3b4549ed94 Update WORKSPACE:
- point to bazelbuild/platforms for @platforms
- Use a newer version of rules_go for our internal rules.
- Make a bzl file used in a test visible to the tests.

I believe this fixes a build breakage in bazel at head and 5.3.0
2022-08-26 15:46:53 -04:00
Googler 2f8c04c044 Automatic code cleanup.
PiperOrigin-RevId: 456494185
Change-Id: I9aaefff0976cca2b68646970c8d4675c8e122d19
2022-06-22 06:02:29 -07:00
Googler 8bb0eb5c5c Add a use_cc_toolchain helper to rules_cc.
Part of github.com/bazelbuild/bazel/issues/14727.

PiperOrigin-RevId: 449499388
Change-Id: I9fb5fecd1059b0d48a26e89d1c25d54fd2348b55
2022-05-18 09:20:17 -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 58f8e026c0 Add xcode_configure in cc_configure module extension
This is needed by cc toolchain on macOS.

PiperOrigin-RevId: 435328319
Change-Id: I505b18d6058daf2cbb479f454f299b7b4a92bd84
2022-03-17 06:25:24 -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
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