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

Remove legacy crosstool fields #5883

Closed
hlopko opened this issue Aug 14, 2018 · 0 comments
Closed

Remove legacy crosstool fields #5883

hlopko opened this issue Aug 14, 2018 · 0 comments
Assignees
Labels
P1 I'll work on this now. (Assignee required) team-Rules-CPP Issues for C++ rules type: feature request

Comments

@hlopko
Copy link
Member

hlopko commented Aug 14, 2018

Remove legacy crosstool fields

For this to happen we need to:

  1. Create a CcToolchainProvider Skylark API to replace existing ctx.fragments.cpp.compiler_options() and ctx.fragments.cpp.linker_options() etc.
    Done in Implement Skylark API for C++ toolchain/feature configuration #4571
  2. Prepare migration tooling (elaborated [here]).(https://docs.google.com/document/d/1uv4c1zag6KvdI31qdx8C6jiTognXPQrxgsUpVefm9fM/edit#).
  3. Add incompatible flags to help Bazel users migrate.
  4. Migrate all crosstools to features.
  5. Remove legacy fields from crosstools:
    • all supports_* fields
    • static_runtimes_filegroup
    • dynamic_runtimes_filegroup
    • compiler_flag
    • optional_compiler_flag
    • cxx_flag
    • optional_cxx_flag
    • unfiltered_cxx_flag
    • optional_unfiltered_cxx_flag
    • linker_flag
    • optional_linker_flag
    • dynamic_library_linker_flag
    • optional_dynamic_library_linker_flag
    • test_only_linker_flag
    • objcopy_embed_flag
    • ld_embed_flag
    • ar_flag
    • ar_thin_archives_flag
    • gcc_plugin_compiler_flag
    • compilation_mode_flags
    • lipo_mode_flags
    • linking_mode_flags
    • gcc_plugin_header_directory
    • mao_plugin_header_directory
    • tool_path
@hlopko hlopko added type: feature request P1 I'll work on this now. (Assignee required) category: rules > C++ labels Aug 14, 2018
@hlopko hlopko self-assigned this Aug 14, 2018
@hlopko hlopko added team-Rules-CPP Issues for C++ rules and removed team-Rules-CPP Issues for C++ rules category: rules > C++ labels Oct 11, 2018
bazel-io pushed a commit that referenced this issue Dec 18, 2018
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: cc_toolchain.(static|dynamic)_runtime_libs attributes are now optional
PiperOrigin-RevId: 225990391
bazel-io pushed a commit that referenced this issue Dec 19, 2018
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
(#6942).
PiperOrigin-RevId: 226165743
bazel-io pushed a commit that referenced this issue Dec 20, 2018
This cl allows toolchain owners to express that toolchain supports --start-lib/--end-lib using enabled feature "supports_start_end_lib".

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

Flag removing legacy behavior is #6861

RELNOTES: None.
PiperOrigin-RevId: 226292303
bazel-io pushed a commit that referenced this issue Dec 20, 2018
… feature

This cl allows toolchain owners to express that toolchain supports creating interface shared libraries.

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

Flag removing legacy behavior is #6861

RELNOTES: None.
PiperOrigin-RevId: 226302378
bazel-io pushed a commit that referenced this issue Dec 22, 2018
This cl allows toolchain owners to express that toolchain supports creating dynamic libraries.

This is in theory a breaking change, for the crosstools that don't use `dynamic_library_linker_flag`, and don't specify `linking_mode_flags { mode: DYNAMIC }`, and they do specify feature { name: 'dynamic_linking_mode' }. This currently means the toolchain will generate shared libraries, but with this change it will not.

But since this only happens to toolchains that don't use legacy fields, and I don't think there are such toolchains in the wild, I'll go ahead and do this change without following the incompatible change process.

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

Flag removing legacy behavior is #6861

RELNOTES: None.
PiperOrigin-RevId: 226631573
bazel-io pushed a commit that referenced this issue Dec 26, 2018
`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 #5883. Also
see the rollout doc here:
https://docs.google.com/document/d/1uv4c1zag6KvdI31qdx8C6jiTognXPQrxgsUpVefm9fM/edit#.

Flag removing legacy behavior is #6861

RELNOTES: None.
PiperOrigin-RevId: 226950450
bazel-io pushed a commit that referenced this issue Dec 27, 2018
…eature

`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 #5883. Also
see the rollout doc here:
https://docs.google.com/document/d/1uv4c1zag6KvdI31qdx8C6jiTognXPQrxgsUpVefm9fM/edit#.

Flag removing legacy behavior is #6861

RELNOTES: None.
PiperOrigin-RevId: 227024509
bazel-io pushed a commit that referenced this issue Dec 28, 2018
Incompatible flag issue: #6861
Tracking issue: #5883

RELNOTES: Added --incompatible_disable_legacy_crosstool_fields. See the
migration notes at #6861.
PiperOrigin-RevId: 227104932
bazel-io pushed a commit that referenced this issue Dec 28, 2018
`needsPic` can now be expressed using 'pic' feature (should be enabled for it to take effect).

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

Flag removing legacy behavior is #6861

RELNOTES: None.
PiperOrigin-RevId: 227134726
bazel-io pushed a commit that referenced this issue Jan 2, 2019
This cl is a step towards #5883. Also
see the rollout doc here:
https://docs.google.com/document/d/1uv4c1zag6KvdI31qdx8C6jiTognXPQrxgsUpVefm9fM/edit#.

Flag removing legacy behavior is #6861

RELNOTES: None.
PiperOrigin-RevId: 227491541
bazel-io pushed a commit that referenced this issue Jan 3, 2019
Progress towards #5380 and #5883

RELNOTES: None.
PiperOrigin-RevId: 227646729
bazel-io pushed a commit that referenced this issue Jan 3, 2019
Progress towards #5380 and #5883

RELNOTES: None.
PiperOrigin-RevId: 227675648
bazel-io pushed a commit that referenced this issue Jan 7, 2019
Progress towards:
#6861
#5883

RELNOTES: None.
PiperOrigin-RevId: 228175730
bazel-io pushed a commit that referenced this issue Jan 7, 2019
This will help users who want to use CROSSTOOL with other than C++ rules, plus
it will enable users to make rules forward compatible for incompatible CROSSTOOL
changes.

Progress towards
#5883

RELNOTES: None.
PiperOrigin-RevId: 228216650
bazel-io pushed a commit to bazelbuild/rules_cc that referenced this issue Jan 11, 2019
Needed for --incompatible_disable_legacy_crosstool_fields migration: bazelbuild/bazel#6861
Tracking issue: bazelbuild/bazel#5883

RELNOTES: None.
PiperOrigin-RevId: 225956311
bazel-io pushed a commit to bazelbuild/rules_cc that referenced this issue Jan 11, 2019
`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 bazelbuild/bazel#5883. Also
see the rollout doc here:
https://docs.google.com/document/d/1uv4c1zag6KvdI31qdx8C6jiTognXPQrxgsUpVefm9fM/edit#.

Flag removing legacy behavior is bazelbuild/bazel#6861

RELNOTES: None.
PiperOrigin-RevId: 226950450
bazel-io pushed a commit to bazelbuild/rules_cc that referenced this issue Jan 11, 2019
…eature

`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 bazelbuild/bazel#5883. Also
see the rollout doc here:
https://docs.google.com/document/d/1uv4c1zag6KvdI31qdx8C6jiTognXPQrxgsUpVefm9fM/edit#.

Flag removing legacy behavior is bazelbuild/bazel#6861

RELNOTES: None.
PiperOrigin-RevId: 227024509
bazel-io pushed a commit to bazelbuild/rules_cc that referenced this issue Jan 11, 2019
`needsPic` can now be expressed using 'pic' feature (should be enabled for it to take effect).

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

Flag removing legacy behavior is bazelbuild/bazel#6861

RELNOTES: None.
PiperOrigin-RevId: 227134726
bazel-io pushed a commit to bazelbuild/rules_cc that referenced this issue Jan 11, 2019
bazelbuild/bazel#5883

RELNOTES: None.
PiperOrigin-RevId: 227688115
bazel-io pushed a commit to bazelbuild/rules_cc that referenced this issue Jan 11, 2019
bazelbuild/bazel#5883

RELNOTES: None.
PiperOrigin-RevId: 227827560
bazel-io pushed a commit to bazelbuild/rules_cc that referenced this issue Jan 11, 2019
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:
bazelbuild/bazel#6861
bazelbuild/bazel#5883

RELNOTES: None.
PiperOrigin-RevId: 228299172
bazel-io pushed a commit to bazelbuild/rules_cc that referenced this issue Jan 11, 2019
bazel-io pushed a commit that referenced this issue Jan 14, 2019
…edRuntimes is not set

Before, Bazel explicitly added static_link_cpp_runtimes to disabled features, when toolchain didn't set supportsEmbeddedRuntimes. This is unnecessary (if the toolchain doesn't support embeddded runtimes, it can just not create/enable the feature), and it makes migration for #5883 harder. Let's remove it.

#5883
#6861

RELNOTES: None.
PiperOrigin-RevId: 229188252
bazel-io pushed a commit that referenced this issue Jan 15, 2019
Currently we move legacy_compile_flags to the top of the crosstool, and the same behavior is needed for migrated crosstools in case of default_compile_flags.

#6861
#5883

RELNOTES: None.
PiperOrigin-RevId: 229339668
bazel-io pushed a commit to bazelbuild/rules_cc that referenced this issue Jan 15, 2019
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

bazelbuild/bazel#6861
bazelbuild/bazel#5883

RELNOTES: None.
PiperOrigin-RevId: 229336027
bazel-io pushed a commit to bazelbuild/rules_cc that referenced this issue Jan 16, 2019
…rator

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.)

bazelbuild/bazel#6861
bazelbuild/bazel#5883

RELNOTES: None.
PiperOrigin-RevId: 229518029
bazel-io pushed a commit to bazelbuild/rules_cc that referenced this issue Jan 17, 2019
…amic-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.

bazelbuild/bazel#6861
bazelbuild/bazel#5883

RELNOTES: None.
PiperOrigin-RevId: 229692958
katre pushed a commit to katre/bazel that referenced this issue Jan 17, 2019
bazel-io pushed a commit to bazelbuild/rules_cc that referenced this issue Jan 24, 2019
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.

bazelbuild/bazel#6861
bazelbuild/bazel#5883

RELNOTES: None.
PiperOrigin-RevId: 230701029
bazel-io pushed a commit that referenced this issue Jan 24, 2019
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.

#6861
#5883

RELNOTES: None.
PiperOrigin-RevId: 230701029
weixiao-huang pushed a commit to weixiao-huang/bazel that referenced this issue Jan 31, 2019
weixiao-huang pushed a commit to weixiao-huang/bazel that referenced this issue Jan 31, 2019
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.

bazelbuild#6861
bazelbuild#5883

RELNOTES: None.
PiperOrigin-RevId: 230701029
bazel-io pushed a commit to bazelbuild/rules_cc that referenced this issue Feb 14, 2019
Crosstool in Starlark assumes these fields as singular, not collections. This cl updates the migration script to prepare crosstool in proto for this.

bazelbuild/bazel#6861
bazelbuild/bazel#5883

RELNOTES: None.
PiperOrigin-RevId: 233041028
luca-digrazia pushed a commit to luca-digrazia/DatasetCommitsDiffSearch that referenced this issue Sep 4, 2022
    Closes bazelbuild/bazel#5883.

    RELNOTES: None.
    PiperOrigin-RevId: 240978300
luca-digrazia pushed a commit to luca-digrazia/DatasetCommitsDiffSearch that referenced this issue Sep 4, 2022
    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.

    bazelbuild/bazel#6861
    bazelbuild/bazel#5883

    RELNOTES: None.
    PiperOrigin-RevId: 230701029
luca-digrazia pushed a commit to luca-digrazia/DatasetCommitsDiffSearch that referenced this issue Sep 4, 2022
…dedRuntimes is not set

    Before, Bazel explicitly added static_link_cpp_runtimes to disabled features, when toolchain didn't set supportsEmbeddedRuntimes. This is unnecessary (if the toolchain doesn't support embeddded runtimes, it can just not create/enable the feature), and it makes migration for bazelbuild/bazel#5883 harder. Let's remove it.

    bazelbuild/bazel#5883
    bazelbuild/bazel#6861

    RELNOTES: None.
    PiperOrigin-RevId: 229188252
luca-digrazia pushed a commit to luca-digrazia/DatasetCommitsDiffSearch that referenced this issue Sep 4, 2022
    This will help users who want to use CROSSTOOL with other than C++ rules, plus
    it will enable users to make rules forward compatible for incompatible CROSSTOOL
    changes.

    Progress towards
    bazelbuild/bazel#5883

    RELNOTES: None.
    PiperOrigin-RevId: 228216650
luca-digrazia pushed a commit to luca-digrazia/DatasetCommitsDiffSearch that referenced this issue Sep 4, 2022
luca-digrazia pushed a commit to luca-digrazia/DatasetCommitsDiffSearch that referenced this issue Sep 4, 2022
    This cl is a step towards bazelbuild/bazel#5883. Also
    see the rollout doc here:
    https://docs.google.com/document/d/1uv4c1zag6KvdI31qdx8C6jiTognXPQrxgsUpVefm9fM/edit#.

    Flag removing legacy behavior is bazelbuild/bazel#6861

    RELNOTES: None.
    PiperOrigin-RevId: 227491541
luca-digrazia pushed a commit to luca-digrazia/DatasetCommitsDiffSearch that referenced this issue Sep 4, 2022
    Incompatible flag issue: bazelbuild/bazel#6861
    Tracking issue: bazelbuild/bazel#5883

    RELNOTES: Added --incompatible_disable_legacy_crosstool_fields. See the
    migration notes at bazelbuild/bazel#6861.
    PiperOrigin-RevId: 227104932
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 I'll work on this now. (Assignee required) team-Rules-CPP Issues for C++ rules type: feature request
Projects
None yet
Development

No branches or pull requests

1 participant