Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable legacy C++ configuration API #6380

Closed
hlopko opened this issue Oct 15, 2018 · 3 comments
Closed

Disable legacy C++ configuration API #6380

hlopko opened this issue Oct 15, 2018 · 3 comments
Assignees
Labels
incompatible-change Incompatible/breaking change team-Rules-CPP Issues for C++ rules

Comments

@hlopko
Copy link
Member

hlopko commented Oct 15, 2018

Incompatible change.

This turns off legacy Starlark access to cc toolchain information via the ctx.fragments.cpp fragment. Instead of declaring dependency on the ctx.fragments.cpp using the fragments attribute declare a dependency on the @bazel_tools//tools/cpp:current_cc_toolchain via implicit attribute named _cc_toolchain (see example in the full migration docs). Use find_cpp_toolchain from @bazel_tools//tools/cpp:toolchain_utils.bzl to get the current C++ toolchain in the rule implementation.

full migration docs

@hlopko hlopko added team-Rules-CPP Issues for C++ rules incompatible-change Incompatible/breaking change labels Oct 15, 2018
@hlopko hlopko self-assigned this Oct 15, 2018
bazel-io pushed a commit that referenced this issue Oct 15, 2018
…ible flag.

#6380

RELNOTES: Incompatible flag --incompatible_disable_legacy_cpp_toolchain_skylark_api was flipped.
PiperOrigin-RevId: 217169905
bazel-io pushed a commit that referenced this issue Oct 16, 2018
*** Reason for rollback ***

Broke buildkite: https://buildkite.com/bazel/bazel-with-downstream-projects-bazel/builds/503

*** Original change description ***

Flip --incompatible_disable_legacy_cpp_toolchain_skylark_api incompatible flag.

#6380

RELNOTES: Incompatible flag --incompatible_disable_legacy_cpp_toolchain_skylark_api was flipped.
PiperOrigin-RevId: 217275296
bazel-io pushed a commit that referenced this issue Oct 18, 2018
…ible flag.

This is a roll-forward of 8d1a324 after fixing the world of buildkite ( https://buildkite.com/bazel/bazel-with-downstream-projects-bazel/builds/503).

#6380

RELNOTES: Incompatible flag --incompatible_disable_legacy_cpp_toolchain_skylark_api was flipped.
PiperOrigin-RevId: 217684457
hlopko added a commit to bazelbuild/rules_rust that referenced this issue Oct 19, 2018
This is needed for rules_rust to be forward compatible with Bazel 0.20.
Tracking issues for migration:

* bazelbuild/bazel#6380
* bazelbuild/bazel#6434

Fixes #131.
hlopko added a commit to bazelbuild/rules_rust that referenced this issue Oct 22, 2018
This is needed for rules_rust to be forward compatible with Bazel 0.20.
Tracking issues for migration:

* bazelbuild/bazel#6380
* bazelbuild/bazel#6434

Fixes #131.
@hlopko
Copy link
Member Author

hlopko commented Oct 23, 2018

Flag is flipped, therefore closing the issue.

@hlopko hlopko closed this as completed Oct 23, 2018
bazel-io pushed a commit that referenced this issue Oct 29, 2018
Baseline: ac88041

Cherry picks:

   + 9bc3b20:
     Fix the "nojava" platform and enable full presubmit checks for
     the various JDK platforms now that we have enough GCE resources.
   + 54c2572:
     Add openjdk_linux_archive java_toolchain for nojava platform.
   + 20bfdc6:
     Automated rollback of commit
     19a401c.
   + 914b4ce:
     Windows: Fix Precondition check for addDynamicInputLinkOptions
   + 83d406b:
     Windows, test-setup.sh: Setting RUNFILES_MANIFEST_FILE only when
     it exists.
   + e025726:
     Update turbine
   + 5f312dd:
     Fix event id for action_completed BEP events

The Bazel team is happy to announce a new version of Bazel, [Bazel 0.19](https://github.com/bazelbuild/bazel/releases/tag/0.19.0).

This document lists the major changes since Bazel 0.18.

General changes
---------------

* The `--incompatible_expand_directories` flag will automatically expand directories in command lines. Design doc: https://docs.google.com/document/d/11agWFiOUiz2htBLj6swPTob5z78TrCxm8DQE4uJLOwM

* The `--loading_phase_threads` flag now defaults to `auto` (not 200, as was previously the case), which at the moment corresponds to the number of CPUs. This is appropriate for most users. However, if your sources reside on a network file system, increasing this value may yield better analysis-time performance when disk caches are cold.

Android
-------

* Fixed missing debug symbols when building native code with `--compilation_mode=dbg` that target Android ARM architectures by adding the `-g` flag.

C++
---

* Added `--incompatible_disable_legacy_flags_cc_toolchain_api` to deprecate legacy `cc_toolchain` Starlark API for legacy CROSSTOOL fields. Tracking issue is #6434. Migration docs are on the bazel website.

* Runfiles in cc_test: the C++ runfiles library (`@bazel_tools//tools/cpp/runfiles`) can now create Runfiles objects for tests. See `//tools/cpp/runfiles/runfiles_src.h` (in the Bazel source tree) for documentation.

* :cc_binary link action no longer hardcodes `-static-libgcc` for toolchains that support embedded runtimes (guarded by `--experimental_dont_emit_static_libgcc` temporarily).

* The flag `--experimental_enable_cc_configuration_make_variables` is removed, use `--incompatible_disable_cc_configuration_make_variables` instead.

Java
----

* If the `--javabase` flag is unset, Bazel locates a JDK using the `JAVA_HOME` environment variable and searching the PATH. If no JDK is found `--javabase` will be empty, and builds targeting Java will not be supported.  Previously Bazel would fall back to using the embedded JDK as a `--javabase`, but this is no longer default behaviour. A JDK should be explicitly installed instead to enable Java development.

Code Coverage
-------------

* LcovMerger was renamed to CoverageOutputGenerator.

* Faster coverage collection for gcc compiled C++ code can now be tested by enabling it with `--experimental_cc_coverage`.

Other Changes
-------------

* Add `--apple_compiler` and `--apple_grte_top options`. These provide the equivalent of --compiler / --grte_top for the toolchain configured in --apple_crosstool_top.

* There is now a `same_pkg_direct_rdeps` query function. See the query documentation for more details.

* Propagating remote errors to the user even if `--verbose_failures=false` is set.

* Add number of configured targets to analysis phase status output.

* Bazel will now check stderr instead of stdout to decide if it is outputting to a terminal.  `--isatty` is deprecated, use `--is_stderr_atty` instead.

Future Changes
--------------

* None of the C++ related incompatible flags mentioned in the 0.18 release were flipped, they will be flipped in the next release (0.20). We have created tracking issues for all the relevant incompatible flags:
    * [`--incompatible_disable_late_bound_option_defaults`](https://docs.bazel.build/versions/master/skylark/backward-compatibility.html#disable-late-bound-option-defaults): #6384
    * [`--incompatible_disable_depset_in_cc_user_flags`](https://docs.bazel.build/versions/master/skylark/backward-compatibility.html#disable-depsets-in-c-toolchain-api-in-user-flags): #6383
    * [`--incompatible_disable_cc_toolchain_label_from_crosstool_proto`](https://docs.bazel.build/versions/master/skylark/backward-compatibility.html#disallow-using-crosstool-to-select-the-cc_toolchain-label): #6382
    * [`--incompatible_disable_cc_configuration_make_variables`](#6381): #6381
    * [`--incompatible_disable_legacy_cpp_toolchain_skylark_api`](https://docs.bazel.build/versions/master/skylark/backward-compatibility.html#disable-legacy-c-configuration-api): #6380
    * [`incompatible_disable_legacy_flags_cc_toolchain_api`](https://docs.bazel.build/versions/master/skylark/backward-compatibility.html#disable-legacy-c-toolchain-api): #6434

* In the 0.20 release the flags [`--incompatible_remove_native_git_repository`](https://docs.bazel.build/versions/master/skylark/backward-compatibility.html#remove-native-git-repository) and [`--incompatible_remove_native_http_archive`](https://docs.bazel.build/versions/master/skylark/backward-compatibility.html#remove-native-http-archive) will be turned on.

Thank you to our contributors!
------------------------------

This release contains contributions from many people at Google, as well as Andreas Herrmann, Andreas Hippler, Benjamin Peterson, David Ostrovsky, Ed Baunton, George Gensure, Igal Tabachnik, Jason Gavris, Loo Rong Jie, rmalik, and Yannic Bonenberger

Thank you to everyone who contributed to this release!
talya pushed a commit to talya/bazel that referenced this issue Nov 1, 2018
Baseline: ac88041

Cherry picks:

   + 9bc3b20:
     Fix the "nojava" platform and enable full presubmit checks for
     the various JDK platforms now that we have enough GCE resources.
   + 54c2572:
     Add openjdk_linux_archive java_toolchain for nojava platform.
   + 20bfdc6:
     Automated rollback of commit
     19a401c.
   + 914b4ce:
     Windows: Fix Precondition check for addDynamicInputLinkOptions
   + 83d406b:
     Windows, test-setup.sh: Setting RUNFILES_MANIFEST_FILE only when
     it exists.
   + e025726:
     Update turbine
   + 5f312dd:
     Fix event id for action_completed BEP events

The Bazel team is happy to announce a new version of Bazel, [Bazel 0.19](https://github.com/bazelbuild/bazel/releases/tag/0.19.0).

This document lists the major changes since Bazel 0.18.

General changes
---------------

* The `--incompatible_expand_directories` flag will automatically expand directories in command lines. Design doc: https://docs.google.com/document/d/11agWFiOUiz2htBLj6swPTob5z78TrCxm8DQE4uJLOwM

* The `--loading_phase_threads` flag now defaults to `auto` (not 200, as was previously the case), which at the moment corresponds to the number of CPUs. This is appropriate for most users. However, if your sources reside on a network file system, increasing this value may yield better analysis-time performance when disk caches are cold.

Android
-------

* Fixed missing debug symbols when building native code with `--compilation_mode=dbg` that target Android ARM architectures by adding the `-g` flag.

C++
---

* Added `--incompatible_disable_legacy_flags_cc_toolchain_api` to deprecate legacy `cc_toolchain` Starlark API for legacy CROSSTOOL fields. Tracking issue is bazelbuild#6434. Migration docs are on the bazel website.

* Runfiles in cc_test: the C++ runfiles library (`@bazel_tools//tools/cpp/runfiles`) can now create Runfiles objects for tests. See `//tools/cpp/runfiles/runfiles_src.h` (in the Bazel source tree) for documentation.

* :cc_binary link action no longer hardcodes `-static-libgcc` for toolchains that support embedded runtimes (guarded by `--experimental_dont_emit_static_libgcc` temporarily).

* The flag `--experimental_enable_cc_configuration_make_variables` is removed, use `--incompatible_disable_cc_configuration_make_variables` instead.

Java
----

* If the `--javabase` flag is unset, Bazel locates a JDK using the `JAVA_HOME` environment variable and searching the PATH. If no JDK is found `--javabase` will be empty, and builds targeting Java will not be supported.  Previously Bazel would fall back to using the embedded JDK as a `--javabase`, but this is no longer default behaviour. A JDK should be explicitly installed instead to enable Java development.

Code Coverage
-------------

* LcovMerger was renamed to CoverageOutputGenerator.

* Faster coverage collection for gcc compiled C++ code can now be tested by enabling it with `--experimental_cc_coverage`.

Other Changes
-------------

* Add `--apple_compiler` and `--apple_grte_top options`. These provide the equivalent of --compiler / --grte_top for the toolchain configured in --apple_crosstool_top.

* There is now a `same_pkg_direct_rdeps` query function. See the query documentation for more details.

* Propagating remote errors to the user even if `--verbose_failures=false` is set.

* Add number of configured targets to analysis phase status output.

* Bazel will now check stderr instead of stdout to decide if it is outputting to a terminal.  `--isatty` is deprecated, use `--is_stderr_atty` instead.

Future Changes
--------------

* None of the C++ related incompatible flags mentioned in the 0.18 release were flipped, they will be flipped in the next release (0.20). We have created tracking issues for all the relevant incompatible flags:
    * [`--incompatible_disable_late_bound_option_defaults`](https://docs.bazel.build/versions/master/skylark/backward-compatibility.html#disable-late-bound-option-defaults): bazelbuild#6384
    * [`--incompatible_disable_depset_in_cc_user_flags`](https://docs.bazel.build/versions/master/skylark/backward-compatibility.html#disable-depsets-in-c-toolchain-api-in-user-flags): bazelbuild#6383
    * [`--incompatible_disable_cc_toolchain_label_from_crosstool_proto`](https://docs.bazel.build/versions/master/skylark/backward-compatibility.html#disallow-using-crosstool-to-select-the-cc_toolchain-label): bazelbuild#6382
    * [`--incompatible_disable_cc_configuration_make_variables`](bazelbuild#6381): bazelbuild#6381
    * [`--incompatible_disable_legacy_cpp_toolchain_skylark_api`](https://docs.bazel.build/versions/master/skylark/backward-compatibility.html#disable-legacy-c-configuration-api): bazelbuild#6380
    * [`incompatible_disable_legacy_flags_cc_toolchain_api`](https://docs.bazel.build/versions/master/skylark/backward-compatibility.html#disable-legacy-c-toolchain-api): bazelbuild#6434

* In the 0.20 release the flags [`--incompatible_remove_native_git_repository`](https://docs.bazel.build/versions/master/skylark/backward-compatibility.html#remove-native-git-repository) and [`--incompatible_remove_native_http_archive`](https://docs.bazel.build/versions/master/skylark/backward-compatibility.html#remove-native-http-archive) will be turned on.

Thank you to our contributors!
------------------------------

This release contains contributions from many people at Google, as well as Andreas Herrmann, Andreas Hippler, Benjamin Peterson, David Ostrovsky, Ed Baunton, George Gensure, Igal Tabachnik, Jason Gavris, Loo Rong Jie, rmalik, and Yannic Bonenberger

Thank you to everyone who contributed to this release!
@sgreenstein
Copy link
Contributor

I was going through the docs following the example to migrate to the new recommended way. I kept running into an issue, and finally noticed that --incompatible_disable_legacy_flags_cc_toolchain_api breaks the example.

It's confusing to me that the example solution to one deprecation is also deprecated

Please change the example to use the non-deprecated method or add a note that the other deprecation should also be considered

bazel-io pushed a commit that referenced this issue Nov 20, 2018
Since both --incompatible_disable_legacy_cpp_toolchain_skylark_api and --incompatible_disable_legacy_flags_cc_toolchain_api incompatible flags are flipped now, this code is no longer accessible. Thus removing. There is no user-visible impact of this cl.

#6380
#6434

RELNOTES: None.
PiperOrigin-RevId: 222252039
@hlopko
Copy link
Member Author

hlopko commented Nov 28, 2018

Hi Seth,

sorry for the trouble, I'll submit a fix shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incompatible-change Incompatible/breaking change team-Rules-CPP Issues for C++ rules
Projects
None yet
Development

No branches or pull requests

2 participants