2
0
Fork 0
mirror of https://github.com/bazelbuild/rules_cc synced 2024-11-25 17:31:30 +00:00
Commit graph

134 commits

Author SHA1 Message Date
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
hlopko 7a628f3387 Make python scripts consistent with ctoolchain_comparator
This will simplify copybara export logic.

RELNOTES: None.
PiperOrigin-RevId: 238396543
2019-03-14 17:12:55 +01:00
hlopko 475ed28215 Automated rollback of commit a613d78865.
*** Reason for rollback ***

And now rolling forward because apparently ospo approved renovate.

*** Original change description ***

Automated rollback of commit 776b274c8a.

*** Reason for rollback ***

Because they use agpl licence.

*** Original change description ***

Enable 'renovate' bot for rules_cc

Fixes https://github.com/bazelbuild/rules_cc/pull/5.

RELNOTES: None.
PiperOrigin-RevId: 237213545
2019-03-07 02:55:44 -08:00
hlopko 0b8e7b5940 Use is_using_fission in legacy_fields_migrator
Since unknown commit is submitted, the principled variable to use in per_object_debug_info is is_using_fission, not per_object_debug_info_file (in case of thinlto build, the former is present also for thinlto bitcode compile, the latter only for backend compile).

RELNOTES: None.
PiperOrigin-RevId: 237192121
2019-03-07 00:02:00 -08:00
Googler 2d3bc12294 Remove duplication of feature_configuration
RELNOTES: None.
PiperOrigin-RevId: 236652129
2019-03-04 07:53:44 -08:00
hlopko e12b276bc7 Fix issue template
RELNOTES: None.
PiperOrigin-RevId: 235876964
2019-02-27 01:37:03 -08:00
hlopko 3d5980e5cb Add example writing custom rule that depends and is dependable from rules_cc
RELNOTES: None.
PiperOrigin-RevId: 235869541
2019-02-27 00:37:05 -08:00
hlopko a613d78865 Automated rollback of commit 776b274c8a.
*** Reason for rollback ***

Because they use agpl licence.

*** Original change description ***

Enable 'renovate' bot for rules_cc

Fixes https://github.com/bazelbuild/rules_cc/pull/5.

RELNOTES: None.
PiperOrigin-RevId: 235746738
2019-02-26 10:28:17 -08:00
hlopko a68eaadfed List places to ask questions for rules_cc
RELNOTES: None.
PiperOrigin-RevId: 235702390
2019-02-26 05:11:07 -08:00
hlopko d08a69a7bd Let's see if this fixes issue template
RELNOTES: None.
PiperOrigin-RevId: 235700492
2019-02-26 04:55:08 -08:00
hlopko b099c8dd38 Add default issue template for rules_cc
RELNOTES: None.
PiperOrigin-RevId: 235695323
2019-02-26 04:02:29 -08:00
hlopko 776b274c8a Enable 'renovate' bot for rules_cc
Fixes https://github.com/bazelbuild/rules_cc/pull/5.

RELNOTES: None.
PiperOrigin-RevId: 235694213
2019-02-26 03:50:12 -08:00
cushon 64efe1299e Automated rollback of commit 2e79abf8ca.
PiperOrigin-RevId: 234756779
2019-02-20 01:41:00 -08:00
hlopko 7e835b273a Clear dynamic_library_linker_flag in legacy_fields_migrator
RELNOTES: None.
PiperOrigin-RevId: 234748020
2019-02-20 00:25:12 -08:00
hlopko 2e79abf8ca Flip --incompatible_disable_expand_if_all_available_in_flag_set
FlagSets in the CROSSTOOL no longer accept expand_if_all_available field

Fixes #7008

RELNOTES: `--incompatible_disable_expand_if_all_available_in_flag_set` has been flipped (https://github.com/bazelbuild/bazel/issues/7008)
PiperOrigin-RevId: 234466411
2019-02-18 05:16:18 -08:00
hlopko 5743a325d1 Add examples on how to integrate with rules_cc
RELNOTES: None.
PiperOrigin-RevId: 233926824
2019-02-14 13:22:51 +01:00
hlopko 7caec85c2c Improve rules_cc copybara
* # copybara-scrub suffix now works in BUILD and bzl files
* //tools/cpp is rewritten to @bazel_build//tools/cpp **in any filetype**
* //third_party/bazel_rules/rules_cc is rewritten to // **in any filetype**

PiperOrigin-RevId: 233919400
2019-02-14 13:22:37 +01:00
hlopko d485e267a5 Enable features that were previously enabled by Bazel in legacy_fields_migrator
https://github.com/bazelbuild/bazel/issues/6861

RELNOTES: None.
PiperOrigin-RevId: 233735389
2019-02-13 05:40:50 -08:00
hlopko 49a6c21b32 Do not use static_linking_mode for dynamic libraries and objc rules
Another dark corner corner of crosstools appeared, and apparently we didn't enable MOSTLY STATIC linking mode flags for dynamic libraries or objc. This cl addresses that in the legacy fields migrator.

RELNOTES: None.
PiperOrigin-RevId: 233397974
2019-02-11 06:47:26 -08:00
hlopko dfb180b486 Migrate repeated expand_if_(all|none)_available into nested flag_groups
Crosstool in Starlark assumes these fields as singular, not collections. This cl updates the migration script to prepare crosstool in proto for this.

https://github.com/bazelbuild/bazel/issues/6861
https://github.com/bazelbuild/bazel/issues/5883

RELNOTES: None.
PiperOrigin-RevId: 233041028
2019-02-08 04:53:52 -08:00
rosica 903ad72c43 Make CToolchain comparator ignore differences in CToolchain.Tool.tool_path and CToolcain.ToolPath.path when one is "" and the other "NOT_USED"
Starlark constructors for tool_path and tool do not allow empty strings for the path field. Therefore the migrator replaces the "" with "NOT_USED". We should ignore this difference when comparing the CToolchains.

#5380

PiperOrigin-RevId: 232827179
2019-02-07 01:04:52 -08:00
rosica d4fef61119 Add feature declaration tests
And fix an error where we added previously unseen action_names to the dictionary of familiar ACTION_NAMES, so later when we would encounter them, we would treat them as variables, not as string literals
eg
env_set {
  action = "a"
}
would translate to
env_set(
  actions = [a],
)
which is, obviously wrong.

Issue #5380

PiperOrigin-RevId: 232817515
2019-02-06 23:50:49 -08:00
rosica e02152f86e Remove fail("Unreachable") from features' and action_configs' declaration statements
If toolchain A and B need feature f, but toolchain C doesn't, the generated declaration statement for feature f would be:
if ctx.attr.cpu == 'A.cpu':
   f = feature(...)
elif ctx.attr.cpu == "B.cpu" and ctx.attr.compiler == "B.compiler":
   f = feature(...)
else:
   fail("Unreachable")

This will break the rule implementation in the case of toolchain C because it will reach the  fail("Unreachable") although it doesn't need to declare feature f

This cl fixes that

Issue #5380

PiperOrigin-RevId: 232683639
2019-02-06 08:56:10 -08:00
rosica de27916485 Fix action_config names
If an action_config's name doesn't appear in the action_names.bzl, eg action-a.b+c, in it's assignments statement we would declare it as:
action_a.b+c_action = action_config( ...

This cl fixes it to create the action_config variable with the +, - and .
It also adds tests for action_config

Issue #5380

PiperOrigin-RevId: 232681355
2019-02-06 08:41:22 -08:00
rosica 9432a5a6e8 Make crosstool to starlark converter error out if it comes across multiple expand_if_all_available or expand_if_none_available in a single flag_group
PiperOrigin-RevId: 232499399
2019-02-05 09:20:21 -08:00