Commit Graph

258 Commits

Author SHA1 Message Date
Copybara-Service cb2dfba674 Merge pull request #34 from hlopko:put_include_paths_into_action
PiperOrigin-RevId: 266894179
Change-Id: Ic93db66d9d22843b61b68f30851a312f74673ddb
2019-09-03 03:35:29 -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 c2790137ae Stop running Buildifier as part of the presubmit
We now have copies of .bzl files that we have to keep in sync between @rules_cc and @bazel_tools/tools
I propose to re-enable the Buildifier presubmit once this issue is resolved.

*** Original change description ***

Run Buildifier as part of the presubmit.

As a result we will catch some errors already in GitHub, and not later in Critique when it's harder to fix them.

***

PiperOrigin-RevId: 265636234
Change-Id: I10730665134240b3f47950e0e8fa0add8e0bd591
2019-08-27 01:51:17 -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
Googler 624b5d59df Run Buildifier as part of the presubmit.
As a result we will catch some errors already in GitHub, and not later in Critique when it's harder to fix them.

PiperOrigin-RevId: 262967050
Change-Id: If598cea7cf9283203bad94533a6bb5be3349e118
2019-08-12 11:23:38 -07:00
Copybara-Service aed5c5b6d4 Merge pull request #31 from fweikert:merge
PiperOrigin-RevId: 262965730
Change-Id: Ibf68e12666dd01930f40adf04c4be18cb52d040f
2019-08-12 11:19:21 -07:00
fweikert 6d232cc0d6 Use federation version with working zlib repo 2019-08-12 15:56:12 +02:00
Florian Weikert d5d6527fcf Use federation version with required BUILD files 2019-08-09 16:17:16 +02: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 401380cd22 Add a cc_toolchain_config_compare_test that compares 2 Starlark C++ toolchain configuration rules
With CROSSTOOL not existing anymore, the comparison script can continue being useful in refactoring Starlark toolchain config rules.

RELNOTES: None.
PiperOrigin-RevId: 262544859
Change-Id: I633fdc4c09c7643d6e5d1c10537efa3c9a82003c
2019-08-09 05:56:16 -07:00
Googler e68ae76a67 Allow the C++ toolchain config rules comparator script to not need toolchain_identifier argument when both --before and --after arguments are CToolchains (coming from Starlark rules instead of CROSSTOOL proto)
We don't need to select a toolchain by the identifier when we get the proto from Starlark rules because in that case the proto contains a single toolchain.
The difference in toolchain_identifier field between the first and the second proto file will be caught as any other field.

RELNOTES: None.
PiperOrigin-RevId: 262543753
Change-Id: I1e66ee302bf551ade883c217f6269f44382393c0
2019-08-09 05:43:22 -07: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 555d034dbf C++: Add defs.bzl to genproto.bzl
RELNOTES:
PiperOrigin-RevId: 258767676
Change-Id: I72c1a4b10daa62c996472b4ed03659bc2ae99d48
2019-07-18 07:40:49 -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
Copybara-Service 31b9de3cbf Merge pull request #23 from hlopko:fix_skylib
PiperOrigin-RevId: 255620253
Change-Id: I581657a0e29e0fe5e30c8da6fd7d4ad979d173d3
2019-06-28 10:03:31 -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
Googler dfd3d3408e Update Slack link to use slack.bazel.build
PiperOrigin-RevId: 253354235
Change-Id: I9006e6ab21dbe26340a6fc0ee8202474c6282bd8
2019-06-14 23:38:22 -07:00
Copybara-Service e354fc37dc Merge pull request #19 from renovate-bot:renovate/io_bazel_rules_go-0.x
PiperOrigin-RevId: 253206234
Change-Id: I565fc794f6974839c15a5e6c7e435591552f862c
2019-06-14 04:37:25 -07:00
Renovate Bot c1b466c767
Update dependency io_bazel_rules_go to v0.18.6 2019-06-12 17:23:28 +00: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
Copybara-Service 1ef290f596 Merge pull request #16 from hlopko:alias_toolchain_type
PiperOrigin-RevId: 250112515
Change-Id: Id5d4e4b74f11fd2060e2e564a0da9fd7fc217e3b
2019-05-27 01:08:13 -07: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
Copybara-Service 96eb170c6e Merge pull request #15 from hlopko:fix_examples_for_platforms
PiperOrigin-RevId: 249821791
Change-Id: I61b10b87731a9f5a892c58b8ea4c7158e35a943e
2019-05-24 06:17:43 -07:00
Marcel Hlopko 6cd7e75fc4 Update examples for platforms 2019-05-24 14:52:19 +02:00
Googler f25bda7e0d Internal change
PiperOrigin-RevId: 249460768
Change-Id: Ie2d02f0245492230c7a116a3b5acc92b759e73d8
2019-05-22 09:15:39 -07:00
Googler eeec015f3e Update rules_cc for --incompatible_enable_cc_toolchain_resolution
[Copybara import of https://github.com/bazelbuild/rules_cc/pull/14]

https://github.com/bazelbuild/bazel/issues/7260
Merge 3e6d3b9a4a into b308aae57f

PiperOrigin-RevId: 248296402
2019-05-15 02:19:39 -07:00
hlopko b308aae57f Add ctx argument to cc_common.configure_features
In order to migrate C++ rules to platforms, we need the access to the C++
configuration fragment in Starlark APIs. All existing APIs have already access
to it, but cc_common.configure_features doesn't. This change adds a
ctx argument to configure_features.

This is the migration needed for
https://github.com/bazelbuild/bazel/issues/7793, and is part of the effort for
https://github.com/bazelbuild/bazel/issues/6516.

If the rule doesn't depend on cpp fragment yet, you will have to add `fragments
=['cpp']` argument to the rule() call.

Note that this behavior is only available in Bazel 0.25 (to be released this month).

RELNOTES: None.
PiperOrigin-RevId: 247171967
2019-05-08 01:46:21 -07:00
Googler f678ef5279 Automatic code cleanup.
PiperOrigin-RevId: 245027760
2019-04-24 05:30:15 -07:00
philwo 9e7c9de880 Add http_archive entries for testing with various JDK versions.
RELNOTES: None.
PiperOrigin-RevId: 245023756
2019-04-24 04:54:39 -07:00
philwo a4c4f3aa88 Don't test on Ubuntu 14.04.
Ubuntu 14.04 is about to be end-of-life and Bazel CI will stop supporting it shortly afterwards.

Context: https://groups.google.com/d/msg/bazel-dev/_D6XzfNkQQE/8TNKiNmsCAAJ
PiperOrigin-RevId: 245015462
2019-04-24 03:19:08 -07: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
Googler 3723b4c35f Update rules_go to 0.18.1
[Copybara import of https://github.com/bazelbuild/rules_cc/pull/9]

Merge 6181c870fc into 2312d72134

PiperOrigin-RevId: 240145582
2019-03-25 08:39:10 -07:00
Googler e86b282e6f Update protobuf to the latest release (3.7.0)
[Copybara import of https://github.com/bazelbuild/rules_cc/pull/8]

Because of https://github.com/protocolbuffers/protobuf/issues/5918 we
cannot use protobuf_deps() just yet. At least we can use the zlib.BUILD
file from their examples.

Fixes https://github.com/bazelbuild/rules_cc/issues/6
Merge 9bb624f3c8 into 2312d72134

PiperOrigin-RevId: 240091300
2019-03-25 01:00:32 -07:00
rosica 2312d72134 Fix allowed values in 'compiler' attribute of cc_toolchain_config rule.
When cpu value is not enough to distinguish between two toolchains, we use the compiler value. In that case, the user needs to specify the compiler value for all cc_toolchain_config rules, even for the ones with unique cpu. This cl fixes the allowed values in the compiler attribute to account for the values from unique toolchains.

Issue #5380
RELNOTES: None.
PiperOrigin-RevId: 239396228
2019-03-20 07:55:12 -07:00
rosica 943183cae8 Fix load("//tools/cpp:cc_toolchain_config_lib.bzl") to load("@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl")
And add a test checking the full output from the migrator for a simple CROSSTOOL.

Issue #5380
RELNOTES: None.
PiperOrigin-RevId: 239153961
2019-03-19 02:46:26 -07:00
rosica 3b89ccfbe7 Remove linter warnings that a feature or action_config may not be declared by setting it to None instead.
Also rename the rule from cc_toolchain_config_rule to cc_toolchain_config

Issue #5380

RELNOTES: None.
PiperOrigin-RevId: 238945434
2019-03-18 01:50:26 -07:00
hlopko 0c017ebc6d Do not condition linker_flags from DYNAMIC linking_mode_flags for transitive dynamic libraries on dynamic_linking_mode feature
https://github.com/bazelbuild/bazel/issues/6861

RELNOTES: None.
PiperOrigin-RevId: 238941083
2019-03-18 01:04:18 -07:00
hlopko 10f38e16da Fix migrator to correctly migrate dynamic linking mode linker_flags
This would have not introduced the osx crosstool bug in 2d0e27e8bc which was then fixed in unknown commit.

RELNOTES: None.
PiperOrigin-RevId: 238699176
2019-03-15 13:25:11 -07:00
hlopko b844e0c4b8 Replace scrubbing with copybara-comment-this-out-please in copybara
This will make sure the copybara export is reversible, which is needed for setting up copybara workflow for importing github PRs.

RELNOTES: None.
PiperOrigin-RevId: 238445502
2019-03-14 17:13:28 +01:00