Commit Graph

171 Commits

Author SHA1 Message Date
hlopko f9cdb36627 Always put linker_flags from linking_mode_flags.DYNAMIC to nodeps-dynamic-library
This cl fixes a bug in the migrator where it didn't pass mentioned flags to c++-nodeps-dynamic-library unconditionally (it only passed them as with feature { feature: 'dynamic_linking_mode' }, which is incorrect, the feature doesn't not apply to nodeps-dynamic-library, only to transitive linking actions.

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

RELNOTES: None.
PiperOrigin-RevId: 229692958
2019-01-17 00:07:27 -08:00
hlopko 0fd5bb9b75 Rename/remove fields referencing legacy features in legacy_fields_migrator
When renaming legacy_*_flags to default_*_flags, also rename other fields such as requires.

We're intentionally not replacing the implies line, just removing it, because default_*_features are enabled by default, so they don't need to be implied (Implied field is older than enabled field, so there are uses of it where enabled would work just fine. The only semantic difference is that implied features cannot be disabled, whereas enabled can. But since the standard style of writing crosstools seems to prefer enabled, I'm doing the same here.)

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

RELNOTES: None.
PiperOrigin-RevId: 229518029
2019-01-16 01:41:22 -08:00
hlopko f79b9301fa Add buildkite badge to rules_cc readme
RELNOTES: None.
PiperOrigin-RevId: 229379408
2019-01-15 08:54:24 -08:00
hlopko 04195ada17 Fix legacy_fields_migrator
Another round of fixes:

* if the toolchain contains legacy_compile_flags or legacy_link_flags, replace the feature with default_compile_flags or default_link_flags. This is to ensure the location of the flags stays intact.
* it fixes the order of compilation flags, the correct order is:
  1) compiler_flag
  2) compilation_mode_flags.compiler_flag
  3) cxx_flag
  4) compilation_mode_flags.cxx_flag
* We don't add cxx_flags to assemble and preprocess-assemble actions
* We don't add sysroot to assemble action

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

RELNOTES: None.
PiperOrigin-RevId: 229336027
2019-01-15 02:09:19 -08:00
hlopko 5a13c61858 Fix typo in readme
RELNOTES: None.

PiperOrigin-RevId: 229193101
2019-01-14 09:06:25 -08:00
hlopko e08b244cc5 Test rules_cc postsubmit pipeline
RELNOTES: None.
PiperOrigin-RevId: 228871773
2019-01-11 06:18:23 -08:00
hlopko c0ac741cbe Improve legacy_fields_migrator to work properly for objc crosstools
https://github.com/bazelbuild/bazel/issues/5883
https://github.com/bazelbuild/bazel/issues/6861

RELNOTES: None.
PiperOrigin-RevId: 228839863
2019-01-11 00:11:34 -08:00
hlopko 9a340db871 Fix inconsistencies in rules_cc WORKSPACE file
RELNOTES: None.
PiperOrigin-RevId: 228839269
2019-01-11 00:05:36 -08:00
hlopko eefe53ee7c Add initial bazelci config for rules_cc
RELNOTES: None.
PiperOrigin-RevId: 228509583
2019-01-11 00:05:29 -08:00
hlopko e9752a83c6 Add rules_cc deps to bazel-mirror
RELNOTES: None.
PiperOrigin-RevId: 228469668
2019-01-11 00:05:25 -08:00
hlopko da4c91577a Add repository for py.mock to rules_cc
RELNOTES: None.
PiperOrigin-RevId: 228326658
2019-01-09 08:59:42 +01:00
hlopko 281a8bc480 Add BUILD.third_party to rules_cc
Only to make //third_party a package

RELNOTES: None
PiperOrigin-RevId: 228316989
2019-01-09 08:59:30 +01:00
rosica 175f81c847 Add a script for comparing CToolchian built from different CROSSTOOL/Ctoolchain proto text files
Progress towards #5380

RELNOTES: None.
PiperOrigin-RevId: 228312688
2019-01-09 08:59:20 +01:00
hlopko 246bff6d0e Add things needed for rules_cc to build & test in the open
* Adding .gitignore
* Referencing protobuf, absl, and six in the WORKSPACE
* Adding six.BUILD

RELNOTES: None
PiperOrigin-RevId: 228309963
2019-01-09 08:59:09 +01:00
hlopko 63003094c9 Make cc_embed_data.bzl forward compatible with removal of legacy crosstool fields
RELNOTES: None
PiperOrigin-RevId: 228301880
2019-01-09 08:58:59 +01:00
hlopko f835b8bea2 Fix legacy_fields_migrator
This cl fixes:

* clears 'supports_embedded_runtimes'
* adds user_compile_flags and sysroot feature
  * these are needed to appear before unfiltered_compile_flags

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

RELNOTES: None.
PiperOrigin-RevId: 228299172
2019-01-09 08:58:48 +01:00
hlopko 91210fecfb Add WORKSPACE to rules_cc
PiperOrigin-RevId: 228298222
2019-01-09 08:58:36 +01:00
hlopko 05d087e921 Make bazel option --collect_symbol_counts a noop
Our reasoning:
* it only works with gold
* it was broken for the last 3 months (since unknown commit) (silently did
nothing and nobody complained)
* we see almost zero usage of this option

RELNOTES: None.
PiperOrigin-RevId: 228116158
2019-01-09 08:58:26 +01:00
hlopko 17818b2501 Add initial content of rules_cc repo
RELNOTES: None.
PiperOrigin-RevId: 227846116
2019-01-09 08:58:14 +01:00
hlopko 30e32836fa Add --inline option to legacy_fields_migrator
https://github.com/bazelbuild/bazel/issues/5883

RELNOTES: None.
PiperOrigin-RevId: 227827560
2019-01-09 08:58:04 +01:00
hlopko b809b1312f Fix edge cases of legacy crosstool migrator
https://github.com/bazelbuild/bazel/issues/5883

RELNOTES: None.
PiperOrigin-RevId: 227688115
2019-01-09 08:57:53 +01:00
hlopko 37f9cc51a5 Add --incompatible_disable_expand_if_all_available_in_flag_set
Corresponding issue: https://github.com/bazelbuild/bazel/issues/7008

RELNOTES: None.
PiperOrigin-RevId: 227522028
2019-01-09 08:57:41 +01:00
hlopko 169818c32d Allow setting needsPic crosstool capability using feature
`needsPic` can now be expressed using 'pic' feature (should be enabled for it to take effect).

This cl is a step towards https://github.com/bazelbuild/bazel/issues/5883. Also
see the rollout doc here:
https://docs.google.com/document/d/1uv4c1zag6KvdI31qdx8C6jiTognXPQrxgsUpVefm9fM/edit#.

Flag removing legacy behavior is https://github.com/bazelbuild/bazel/issues/6861

RELNOTES: None.
PiperOrigin-RevId: 227134726
2019-01-09 08:57:31 +01:00
hlopko c8a8211959 Allow setting supports_embedded_runtimes crosstool capability using feature
`supports_embedded_runtimes` can now be expressed using 'static_link_cpp_runtimes' feature (should be enabled for it to take effect).

This cl allows toolchain owners to express that toolchain supports embedded runtimes in the same way as other crosstool capabilities are expressed.

This cl is a step towards https://github.com/bazelbuild/bazel/issues/5883. Also
see the rollout doc here:
https://docs.google.com/document/d/1uv4c1zag6KvdI31qdx8C6jiTognXPQrxgsUpVefm9fM/edit#.

Flag removing legacy behavior is https://github.com/bazelbuild/bazel/issues/6861

RELNOTES: None.
PiperOrigin-RevId: 227024509
2019-01-09 08:57:20 +01:00
hlopko 8062601195 Allow setting supports_fission crosstool capability using feature
`supports_fission` can now be expressed using 'per_object_debug_info' feature (should be enabled for it to take effect).

This cl is a step towards https://github.com/bazelbuild/bazel/issues/5883. Also
see the rollout doc here:
https://docs.google.com/document/d/1uv4c1zag6KvdI31qdx8C6jiTognXPQrxgsUpVefm9fM/edit#.

Flag removing legacy behavior is https://github.com/bazelbuild/bazel/issues/6861

RELNOTES: None.
PiperOrigin-RevId: 226950450
2019-01-09 08:57:10 +01:00
hlopko 392be757fe Cleanup uses of supports_dsym
Apparently it's not used, so removing traces of it.

RELNOTES: None.
PiperOrigin-RevId: 226486811
2019-01-09 08:56:59 +01:00
hlopko e327d70146 Mark unused crosstool fields
RELNOTES: None.
PiperOrigin-RevId: 226302225
2019-01-09 08:56:44 +01:00
hlopko 2c36045d81 Add --incompatible_disable_runtimes_filegroups
This change adds cc_toolchain.static_runtime_lib and
cc_toolchain.dynamic_runtime_lib attributes and an incompatible flag that
disables deprecated cc_toolchain.static_runtime_libs and
cc_toolchain.dynamic_runtime_libs.

Issue for the incompatible flag: #6942
Tracking issue for legacy crosstool fields removal: #5883

RELNOTES: Added --incompatible_disable_runtimes_filegroups
(https://github.com/bazelbuild/bazel/issues/6942).
PiperOrigin-RevId: 226165743
2019-01-09 08:56:32 +01:00
hlopko 46dc52e008 Add crosstool_query
A quick hack of a tool that will be used for removing runtime filegroups

Issue for the --incompatible_disable_runtimes_filegroups incompatible flag
(which this cl is a step towards to): #6942
Tracking issue for legacy crosstool fields removal: #5883

RELNOTES: None.
PiperOrigin-RevId: 225995150
2019-01-09 08:56:21 +01:00
hlopko e1d74cbe59 Move legacy_fields_migrator to rules_cc
Needed for --incompatible_disable_legacy_crosstool_fields migration: https://github.com/bazelbuild/bazel/issues/6861
Tracking issue: https://github.com/bazelbuild/bazel/issues/5883

RELNOTES: None.
PiperOrigin-RevId: 225956311
2019-01-09 08:56:10 +01:00
hlopko f37a53e8c9 Internal change
PiperOrigin-RevId: 225221110
2019-01-09 08:56:00 +01:00
jingwen 3c88920d55 Correct misspelled English words in comments and printed messages in Bazel's src/... directory (and run fix)
RELNOTES: None.
PiperOrigin-RevId: 222473871
2019-01-09 08:55:49 +01:00
hlopko fccbfbf395 Do not use CROSSTOOL to select cc_toolchain
This is a preparation for flipping
--incompatible_disable_cc_toolchain_label_from_crosstool_proto, which will stop
reading default_toolchain fields from the crosstool and will rely on
cc_toolchain_suite.toolchains containing entries for cpu without compiler.

Migrations docs can be found here:
https://docs.bazel.build/versions/master/skylark/backward-compatibility.html#disallow-using-crosstool-to-select-the-cc_toolchain-label.

RELNOTES: None.
PiperOrigin-RevId: 216470358
2019-01-09 08:55:38 +01:00
hlopko 364065d6a5 Make CROSSTOOL.default_target_cpu optional
It's deprecated, and not used, there's no reason for it to be required.

RELNOTES: None.
PiperOrigin-RevId: 213639602
2019-01-09 08:55:27 +01:00
hlopko ce4d5692c2 Remove LipoMode and LipoModeFlags from CROSSTOOL
RELNOTES: None.
PiperOrigin-RevId: 200747338
2019-01-09 08:55:16 +01:00
rosica 2ea125ddd6 Remove supports_lipo field from DefaultCpuToolchain
RELNOTES: None.
PiperOrigin-RevId: 200399094
2019-01-09 08:55:06 +01:00
pcloudy d08ec26583 Refactor artifact_name_pattern in CROSSTOOL
Instead of using a string pattern, we replace it with a prefix and an
extension.

RELNOTES: NONE
PiperOrigin-RevId: 197132215
2019-01-09 08:54:54 +01:00
hlopko 358b48dc26 Remove traces of optional_flags from crosstool
AFAIK all uses have been migrated to features, so they are not needed anymore.

RELNOTES: CppRules: optional_compiler_flag was removed from CROSSTOOL, use features instead.
PiperOrigin-RevId: 192277764
2019-01-09 08:54:43 +01:00
hlopko ff0944a403 Remove optional_*_flag fields from crosstool
They are not used anyway. optional_compiler_flag will be removed once internal
migration is finished.

RELNOTES: CppRules: Remove optional_*_flag fields from CROSSTOOL, they are not
used, and could be expressed using features.
PiperOrigin-RevId: 190600731
2019-01-09 08:54:32 +01:00
Googler 87e4245462 Automatic code cleanup.
PiperOrigin-RevId: 183118434
2019-01-09 08:54:21 +01:00
Googler 851eed198a Allow conditioning flags on the _absence_ of a feature.
This allows a flag_set to emit one flag when a feature is enabled, and a
different flag when that feature is disabled.

And while I was in there, I noticed and fixed a couple other issues:

1. env_set didn't actually implement with_feature, despite having the field in
   its proto.
2. action_config implemented with_feature as an optional field, instead of
   repeated field.

RELNOTES: None
PiperOrigin-RevId: 176510960
2019-01-09 08:54:10 +01:00
cpeyser 199f7d9280 Allow an action_config to be activated by default.
PiperOrigin-RevId: 175531318
2019-01-09 08:53:59 +01:00
klimek 503f0a9868 Implement user experience for LIPO / ThinLTO users.
Add flag --convert_lipo_to_thinlto, which allows builds with LLVM to use
ThinLTO when the user specifies LIPO + FDO flags; if that flag is not set, and
the user requests a build with LLVM, the compile will now fail.

Add an attribute supports_lipo to the DefaultCpuToolchain crosstool proto and
skip default toolchains that do not support LIPO when the user has specified
LIPO flags in the toolchain selection; this enables CROSSTOOL files to cause
an implicit fallback to a hybrid / LIPO toolchain when using an LLVM toolchain
as the default.

Add a CrosstoolBuilder to MockCcSupport and add a new method
setupCrosstoolFromScratch that allows unit tests to fully control the setup.
The other methods available in MockCcSupport will always load in a default
CROSSTOOL file and may show different unit test results depending on the
content of that file.

RELNOTES: None.
PiperOrigin-RevId: 163819246
2019-01-09 08:53:47 +01:00
klimek 1fbdf51208 Typo fix.
PiperOrigin-RevId: 163191957
2019-01-09 08:53:37 +01:00
lberki 21b2542b61 Mark the default_target_cpu field in CROSSTOOL deprecated.
It hasn't been used since a while.

RELNOTES: None.
PiperOrigin-RevId: 162215841
2019-01-09 08:53:26 +01:00
hlopko 94ad5f559a Make C++ archiving use action_configs instead of hardcoded flags
RELNOTES: Use action_config in crosstool for static library archiving, remove ar_flag.
PiperOrigin-RevId: 157685703
2019-01-09 08:53:14 +01:00
jfield e975b380fb Automated rollback of commit 6dbdb050cb.
*** Reason for rollback ***

b/37401971

*** Original change description ***

Make C++ archiving use action_configs instead of hardcoded flags

RELNOTES: Use action_config in crosstool for static library archiving, remove ar_flag.
PiperOrigin-RevId: 153344597
2019-01-09 08:53:04 +01:00
hlopko 6dbdb050cb Make C++ archiving use action_configs instead of hardcoded flags
RELNOTES: Use action_config in crosstool for static library archiving, remove ar_flag.
PiperOrigin-RevId: 153046587
2019-01-09 08:52:53 +01:00
Googler ad6e1ca6c5 Add a boolean flag to a Feature to specify whether it is enabled by default.
This enables us to configure default features for each toolchain without having
to hard-code anything in class such as CcCommon.

PiperOrigin-RevId: 146904287
2019-01-09 08:52:42 +01:00
Googler fe7d55ba32 RELNOTES: Allow CROSSTOOL files to have linker flags specific to static shared libraries.
PiperOrigin-RevId: 146655595
2019-01-09 08:52:30 +01:00