Commit Graph

120 Commits

Author SHA1 Message Date
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
rosica 1576db8e94 Fix paths resolving for --crosstool and --output_location.
This is to make the script usable from bazel run

PiperOrigin-RevId: 232472300
2019-02-05 06:09:25 -08:00
rosica ba06942f95 Fix flag parsing
PiperOrigin-RevId: 232470483
2019-02-05 05:57:20 -08:00
dslomov 081d3ef0ad Add CODEOWNERS for rules_cc.
RELNOTES: None.
PiperOrigin-RevId: 232448494
2019-02-05 02:22:15 -08:00
Googler f76ab4888a Migrate Apple CROSSTOOL to starlark.
RELNOTES: None.
PiperOrigin-RevId: 231209609
2019-01-28 06:40:54 -08:00
rosica b3a83d701a Add a script for converting CROSSTOOL files to Starlark rules
Progress towards issue #5380

RELNOTES: None
PiperOrigin-RevId: 230795058
2019-01-24 14:54:38 -08:00
hlopko 0f72a1209b Fix rules_cc badge
RELNOTES: None.
PiperOrigin-RevId: 230732829
2019-01-24 09:10:10 -08:00
hlopko ddf13fe1da Don't require supports_fission to be set in the crosstool
Having a 'per_object_debug_data' feature enabled is giving the same signal as having supports_fission enabled. This is a safe change because all crosstools that have supports_fission: true have per_object_debug_info disabled, and with the legacy crosstool fields migration we will migrate this feature to be enabled by default for these crosstools.

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

RELNOTES: None.
PiperOrigin-RevId: 230701029
2019-01-24 04:55:15 -08:00
hlopko a9932b3939 Make ctoolchain_compare.bzl more robust by using ctx.label.name as generated files name.
This ensures that the generated files will be unique in the package and therefore there won't be action conflict.

RELNOTES: None.
PiperOrigin-RevId: 230514342
2019-01-23 05:42:09 -08:00
hlopko b8be74cc45 Change rules_cc badge to only show master branch status
RELNOTES: None.
PiperOrigin-RevId: 230198892
2019-01-21 02:54:52 -08:00
Googler da4639bd1f Actually cause the comparator / test to fail when there is an error reading one
of the toolchains.

Cosmetic spacing fixes for strings that will be concatenated and fixed a typo.

PiperOrigin-RevId: 229961708
2019-01-18 11:20:25 -08:00
Googler dc71ef6ea6 Make it possible to test multiple configs in the same BUILD file.
PiperOrigin-RevId: 229960389
2019-01-18 11:13:22 -08:00
rosica 0627ae379c Create a test rule that compares CToolchains from CROSSTOOL file and from Starlark rule
Work towards issue #5380
RELNOTES: None
PiperOrigin-RevId: 229928313
2019-01-18 07:56:03 -08:00
rosica f64680e017 Make ctoolchain_comparator.py throw exit(1) when CToolchains differ
While here, Also fix _read_crosstool_or_ctoolchain_proto to actually return the CToolchain found in the CROSSTOOL file, and add some missing \n.

RELNOTES: None.
PiperOrigin-RevId: 229926500
2019-01-18 07:37:16 -08:00
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