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

Expose ctx.fragments.(copts|cxxopts|conlyopts|linkopts) #5602

Closed
hlopko opened this issue Jul 16, 2018 · 0 comments
Closed

Expose ctx.fragments.(copts|cxxopts|conlyopts|linkopts) #5602

hlopko opened this issue Jul 16, 2018 · 0 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) type: feature request

Comments

@hlopko
Copy link
Member

hlopko commented Jul 16, 2018

Add methods that expose flags passed by --copt (and --cxxopt, --conlyopt) and --linkopt options to CppConfiguration's Skylark API.

This will be useful because:

  • That's how C++ rules in Skylark will get to those options.
  • Other rules that pretend to be C++, or care about C++ flags (e.g. haskell) can get them.

Since these methods will only return values passed from the Bazel command line, they don't interfere with current efforts removing package loading from configurations.

@hlopko hlopko added type: feature request P2 We'll consider working on this in future. (Assignee optional) category: rules > C++ labels Jul 16, 2018
bazel-io pushed a commit that referenced this issue Jul 19, 2018
Previous behavior was to put flags coming from Bazel option --linkopt into
legacy_link_flags. They should be in user_link_flags instead (together with
flags coming from linkopts rule attribute). This cl introduces
--experimental_linkopts_in_user_link_flags option that flips the behavior.

There is another incompatible change. Previously cc_common.create_link_variables() included flags from --linkopt, with the flag flipped it doesn't anymore. I believe
--linkopt flags shouldn't be there by default because:
* We don't tie the API with the specifics of C++ rules/options, enabling theoretical use with other languages (objc)
* Users are free to use ctx.fragments.cpp to access C++ options and add them explicitly (#5602)
* New behavior maintains the symmetry with --copt and user_compile_flags

RELNOTES: None.
PiperOrigin-RevId: 205274272
werkt pushed a commit to werkt/bazel that referenced this issue Aug 2, 2018
Previous behavior was to put flags coming from Bazel option --linkopt into
legacy_link_flags. They should be in user_link_flags instead (together with
flags coming from linkopts rule attribute). This cl introduces
--experimental_linkopts_in_user_link_flags option that flips the behavior.

There is another incompatible change. Previously cc_common.create_link_variables() included flags from --linkopt, with the flag flipped it doesn't anymore. I believe
--linkopt flags shouldn't be there by default because:
* We don't tie the API with the specifics of C++ rules/options, enabling theoretical use with other languages (objc)
* Users are free to use ctx.fragments.cpp to access C++ options and add them explicitly (bazelbuild#5602)
* New behavior maintains the symmetry with --copt and user_compile_flags

RELNOTES: None.
PiperOrigin-RevId: 205274272
@hlopko hlopko self-assigned this Aug 6, 2018
luca-digrazia pushed a commit to luca-digrazia/DatasetCommitsDiffSearch that referenced this issue Sep 4, 2022
    Previous behavior was to put flags coming from Bazel option --linkopt into
    legacy_link_flags. They should be in user_link_flags instead (together with
    flags coming from linkopts rule attribute). This cl introduces
    --experimental_linkopts_in_user_link_flags option that flips the behavior.

    There is another incompatible change. Previously cc_common.create_link_variables() included flags from --linkopt, with the flag flipped it doesn't anymore. I believe
    --linkopt flags shouldn't be there by default because:
    * We don't tie the API with the specifics of C++ rules/options, enabling theoretical use with other languages (objc)
    * Users are free to use ctx.fragments.cpp to access C++ options and add them explicitly (bazelbuild/bazel#5602)
    * New behavior maintains the symmetry with --copt and user_compile_flags

    RELNOTES: None.
    PiperOrigin-RevId: 205274272
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) type: feature request
Projects
None yet
Development

No branches or pull requests

2 participants