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

incompatible_no_rule_outputs_param: disable outputs param of rule function #7977

Open
c-parsons opened this issue Apr 8, 2019 · 18 comments
Open
Labels
incompatible-change Incompatible/breaking change P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts type: process

Comments

@c-parsons
Copy link
Contributor

c-parsons commented Apr 8, 2019

This flag disables the outputs parameter on the rule() function.

Flag: --incompatible_no_rule_outputs_param

Motivation
Output Map Madness outlines some problems and inconsistencies in using this pattern, and there are also a couple of github issues (#2883 and #5581) on this matter.

Additional details in #6241

Migration
Use OutputGroupInfo specify output files instead.

For example, replace:

def _my_rule_impl(ctx):
    ...

my_rule = rule(
    implementation = _my_rule_impl,
    outputs = {“bin”: “%{name}.exe”},
)

with:

def _rule_impl(ctx):
    ...
    bin_name = ctx.attr.name + “.exebin_output = ctx.actions.declare_file(bin_name)
    # bin_output will, as before, need to be the output of an action
    ...
    return [OutputGroupInfo(bin = depset([bin_output])]

my_rule = rule(
    implementation = _my_rule_impl,
)

Note that this migration approach does not automatically let you specify these outputs by label. For example, you will notice that, with this exact approach, you cannot specify the ".exe"-suffix as its own label.
In order to preserve this implicit-output functionality, you will need to use attr.output with a macro-specified default. For example:

def _rule_impl(ctx):
    ...
    bin_output = ctx.outputs.bin_output
    # bin_output will, as before, need to be the output of an action
    ...
    return [OutputGroupInfo(bin = depset([bin_output])]

_my_rule = rule(
    implementation = _my_rule_impl,
    attrs = {
       "bin_output" : attr.output(),
    }
)

def my_rule(name, **kwargs):
    my_rule(name = name,
        bin_output = name + ".exe",
        **kwargs)
@c-parsons c-parsons self-assigned this Apr 8, 2019
@c-parsons c-parsons added incompatible-change Incompatible/breaking change team-Starlark P1 I'll work on this now. (Assignee required) labels Apr 8, 2019
bazel-io pushed a commit that referenced this issue Apr 17, 2019
This constitutes an incompatible change guarded by flag --incompatible_no_rule_outputs_param. See #7977 for further details.

Implementation for #7977.

RELNOTES: The `outputs` parameter of the `rule()` function is deprecated and attached to flag `--incompatible_no_rule_outputs_param`. Migrate rules to use `OutputGroupInfo` or `attr.output` instead. See #7977 for more info.
PiperOrigin-RevId: 244032985
@c-parsons
Copy link
Contributor Author

I've spoken to authors of rules_apple (@thomasvl @allevato @sergiocampama) who have established some pains with respect to this change. These are issues we should work to resolve before proceeding with this migration.

  1. It's unfortunate and a pain to make rule-name consistent with macro name. The only way is to define the rule in another file, export it as a different name, and call that from the macro. That is:

my_rule_private.bzl:

my_rule = rule(...)

my_rule.bzl:

load(':my_rule_private.bzl', _my_rule="my_rule")
def my_rule(name, **kwargs):
    _my_rule(name = name, kwargs)

Loading an additional bzl file has performance implications, and this pattern requires annoying separation between related bits of code.

Possible workaround: One workaround would be if we allow rules to define their proper name to be different than their exported name.
For example:

_my_rule = rule(exported_name = "my_rule", ...)

def my_rule(name, **kwargs):
    _my_rule(name = name, kwargs)
  1. This requires writing documentation in parallel for a macro and the rule it requires. Stardoc should look to the rule documentation and no macro documentation should be required! However, skylint aggressively indicates these macros must be documented.
    (Except, it may be best if one were able to document default values of output attributes alongside the macro which controls it -- but this should merely enhance the existing rule documentation, not require duplicating the rule's docs!)

This seems a high priority feature for Stardoc, and perhaps a blocker for this migration.

For completeness, we also discussed a question I have been asked before regarding this migration:
Q: Aren't macros a thing we want to avoid? Why is the recommendation to use a macro to set output values?
A: No, Starlark team discourages complex macros that users can depend on. If there is a 1:1 correspondence between macro and subsequent rule, the macro should be OK for users to depend on. That is all this migration plan suggests.

@allevato
Copy link
Member

allevato commented Apr 30, 2019

Aside: rules_apple/rules_swift can look into using output groups as well (which would avoid the need for a macro), but those output groups can't be referenced directly by other rules (i.e., there's no equivalent to :Foo.ipa), right?

@c-parsons
Copy link
Contributor Author

c-parsons commented Apr 30, 2019

That's correct -- the only way to make optional outputs specifiable by label is to use attr.output or attr.output_list, whose values must be set by macro.

FWIW, the correct approach is to use both output groups and attr.output. The former allows a user to build Foo.ipa by specifying:

bazel build //my:Foo --output_groups=ipa

and the latter allows building Foo.ipa by specifying:

bazel build //my:Foo.ipa

(or similarly a dependency on //my:Foo.ipa from another target)

bazel-io pushed a commit that referenced this issue May 6, 2019
*** Reason for rollback ***

Breaks Bazel's target //scripts/packages/debian:bazel-debian.deb which is needed for bazel releases.

*** Original change description ***

Disable outputs param of rule function

This constitutes an incompatible change guarded by flag --incompatible_no_rule_outputs_param. See #7977 for further details.

Implementation for #7977.

RELNOTES: The `outputs` parameter of the `rule()` function is deprecated and attached to flag `--incompatible_no_rule_outputs_param`. Migrate rules to use `OutputGroupInfo` or `attr.output` instead. See #7977 for more info.
PiperOrigin-RevId: 246792521
pull bot pushed a commit to Pandinosaurus/bazel that referenced this issue May 28, 2019
Baseline: daa8ae5

Cherry picks:

   + 61c7ffa:
     Automated rollback of commit
     87388e2.
   + 898d7b6:
     Add test for repository overrides, conflicting with managed
     directories being added when Bazel server is already started.
   + c2001a4:
     Automated rollback of commit
     bbe47a1.
   + e67c961:
     Fix a non-determinism in create_embedded_tools.py.
   + 81aefe7:
     Remove unsupported cpu attribute from cc_toolchains.
   + 597e289:
     remote: made CombinedCache a composition of Disk and Http Cache
   + 942f7cf:
     C++: Fixes bug in C++ API with external repo aspects
   + 85a5a2b:
     Configure @androidsdk//:emulator_x86 and :emulator_arm to point
     to the unified emulator binary
   + 9835cb4:
     Automated rollback of commit
     844e4e2.
   + c963ba2:
     Windows, Python: fix arg. esc. also in host config
   + a1ea487:
     Do not pre-cache changed files under managed directories
   + 7dc78cd:
     Add explicit execution and target constraints for autodiscovered
     cc t?
   + dd9ac13:
     Fix a bug when a relative path is used for the execution log
   + 0ff19c6:
     Fix StandaloneTestStrategy.appendStderr
   + 7f49531:
     Fix the autodetecting Python toolchain on Mac
   + ddce723:
     Avoid exporting PATH unnecessarily
   + 35dd05a:
     Allow Starlark rules to be able to use the `exec_compatible_with`

Incompatible changes:

  - Flip --incompatible_windows_escape_jvm_flags to true. See
    bazelbuild#7486
  - Flip --incompatible_windows_style_arg_escaping to true.  See
    bazelbuild#7454
  - --incompatible_windows_escape_jvm_flags is enabled by default,
    and the flag no longer exists
  - `--incompatible_no_output_attr_default` is enabled by default.
  - --incompatible_depset_union is enabled by default.
  - Python rules now determine the Python runtime using toolchains
    rather than `--python_top` and `--python_path`, which are
    deprecated. See
    [bazelbuild#7899](bazelbuild#7899) for
    information on declaring Python toolchains and migrating your
    code. As a side-benefit, this addresses bazelbuild#4815 (incorrect
    interpreter version used) on non-Windows platforms. You can
    temporarily opt out of this change with
    `--incompatible_use_python_toolchains=false`.
  - Python rules now determine the Python runtime using toolchains
    rather than `--python_top` and `--python_path`, which are
    deprecated. See bazelbuild#7899 for information on declaring Python
    toolchains and migrating your code. As a side-benefit, this
    addresses bazelbuild#4815 (incorrect interpreter version used) on
    non-Windows platforms. You can temporarily opt out of this change
    with `--incompatible_use_python_toolchains=false`.

New features:

  - Windows, Python: the --incompatible_windows_escape_python_args
    flag (false by default) builds py_binary and py_test targets with
    correct command line argument escaping.
  - cquery supports --output=build

Important changes:

  - Allow debugging C++ features logic.
  - The --ios_multi_cpus, --watchos_cpus, --macos_cpus and tvos_cpus
    are now additive. This means that you can now split the
    --ios_multi_cpus=arm64,armv7 into --ios_multi_cpus=arm64 and
    --ios_multi_cpus=armv7.
  - Generated Go protobufs now depend on
    //net/proto2/go:proto_gendeps instead of //net/proto2/go:proto
  - Add new options --cs_fdo_instrument and --cs_profile to support
    LLVM's context-sensitive FDO (CSFDO).
  - Bazel C++ compile/link Starlark API. Can be used with
    experimental flag
    --experimental_cc_skylark_api_enabled_packages=<package_path>,<pac
    kage_path2>.
  - `cc_toolchain.static_runtime_lib` and
    `cc_toolchain.dynamic_runtime_lib` are now exposed to Starlark.
  - New flag `--incompatible_no_kwargs_in_build_files`. See
    bazelbuild#8021
  - struct.to_proto() converts dict into proto3 text message (map<,>).
  - Android resource conflicts will no longer be reported between a
    strong attr resource and a weak attr resource, if the weak attr
    does not have format specified.
  - Flag `--incompatible_static_name_resolution_in_build_files` is
    added. See bazelbuild#8022
  - Add --incompatible_objc_framework_cleanup to control whether to
    enable some objc framework cleanup that changes the API.
    Specifically, the cleanup changes the objc provider API
    pertaining to frameworks.  This change is expected to be
    transparent to most users unless they write their own Starlark
    rules to handle frameworks.  See
    bazelbuild#7594 for details.
  - Added --incompatible_remove_binary_profile to disable the old
    binary
    profiles. Instead use the JSON profile format:
    https://docs.bazel.build/versions/master/skylark/performance.html#
    json-profile
  - Introducing --execution_log_binary_file and
    --execution_log_json_file that output a stable sorted execution
    log. They will offer a stable replacement to
    --experimental_execution_log_file.
  - Flag `--incompatible_disallow_old_octal_notation` is added. See
    //github.com/bazelbuild/issues/8059
  - Removes the
    --incompatible_disable_genrule_cc_toolchain_dependency flag.
  - Android resource conflicts will no longer be reported between a
    strong attr resource and a weak attr resource, if the weak attr
    does not have format specified.
  - Incompatible flag
    `--incompatible_make_thinlto_command_lines_standalone` has been
    added. See bazelbuild#6791 for
    details.
  - objc_library does not support resource attributes any more.
    Please read bazelbuild#7594 for more info.
  - The `outputs` parameter of the `rule()` function is deprecated
    and attached to flag `--incompatible_no_rule_outputs_param`.
    Migrate rules to use `OutputGroupInfo` or `attr.output` instead.
    See bazelbuild#7977 for more info.
  - New platform_mappings ability to allow gradual flag to
    platforms/toolchains migration. See also
    bazelbuild#6426
  - Added support for compiling against fully qualified R classes
    from aar_import dependencies.
  - --tls_enabled flag is deprecated. Please provide 'grpcs' as a
    scheme in the URLs if TLS should be used for a remote connection.
  - Adds
    incompatible_disallow_rule_execution_platform_constraints_allowed,
     which
    disallows the use of the "execution_platform_constraints_allowed"
    attribute when defining new rules.
  - Flag `--incompatible_restrict_named_params` is added. See
    bazelbuild#8147 for details.
  - The glob function has a new argument `allow_empty`. When set to
    False, the glob fails when it doesn't match anything.
  - Adds the "disable_whole_archive_for_static_lib" feature to allow
    turning off legacy_whole_archive for individual targets.
  - C++ Starlark API for compilation and linking is no longer
    whitelisted
  - Update visibility advice in build-style
  - --incompatible_disable_objc_provider_resources is now enabled by
    default.
  - Fixed an issue where some `py_runtime`s were incompatible with
    using `--build_python_zip` (bazelbuild#5104).
  - The `outputs` parameter of the `rule()` function is deprecated
    and attached to flag `--incompatible_no_rule_outputs_param`.
    Migrate rules to use `OutputGroupInfo` or `attr.output` instead.
    See bazelbuild#7977 for more info.

This release contains contributions from many people at Google, as well as Benjamin Peterson, Brian Topping, clyang82, Dave Lee, George Gensure, Greg Estren, Greg, Guro Bokum, Keith Smiley, Max Vorobev, Michael Hackner, Robert Brown, Robert Sayre, Ryan Beasley, Yannic.
aehlig pushed a commit that referenced this issue Jun 3, 2019
Baseline: daa8ae5

Cherry picks:

   + 61c7ffa:
     Automated rollback of commit
     87388e2.
   + 898d7b6:
     Add test for repository overrides, conflicting with managed
     directories being added when Bazel server is already started.
   + c2001a4:
     Automated rollback of commit
     bbe47a1.
   + e67c961:
     Fix a non-determinism in create_embedded_tools.py.
   + 81aefe7:
     Remove unsupported cpu attribute from cc_toolchains.
   + 597e289:
     remote: made CombinedCache a composition of Disk and Http Cache
   + 942f7cf:
     C++: Fixes bug in C++ API with external repo aspects
   + 85a5a2b:
     Configure @androidsdk//:emulator_x86 and :emulator_arm to point
     to the unified emulator binary
   + 9835cb4:
     Automated rollback of commit
     844e4e2.
   + c963ba2:
     Windows, Python: fix arg. esc. also in host config
   + a1ea487:
     Do not pre-cache changed files under managed directories
   + 7dc78cd:
     Add explicit execution and target constraints for autodiscovered
     cc t?
   + dd9ac13:
     Fix a bug when a relative path is used for the execution log
   + 0ff19c6:
     Fix StandaloneTestStrategy.appendStderr
   + 7f49531:
     Fix the autodetecting Python toolchain on Mac
   + ddce723:
     Avoid exporting PATH unnecessarily
   + 35dd05a:
     Allow Starlark rules to be able to use the `exec_compatible_with`

Incompatible changes:

  - Flip --incompatible_windows_escape_jvm_flags to true. See
    #7486
  - Flip --incompatible_windows_style_arg_escaping to true.  See
    #7454
  - --incompatible_windows_escape_jvm_flags is enabled by default,
    and the flag no longer exists
  - `--incompatible_no_output_attr_default` is enabled by default.
  - --incompatible_depset_union is enabled by default.
  - Python rules now determine the Python runtime using toolchains
    rather than `--python_top` and `--python_path`, which are
    deprecated. See
    [#7899](#7899) for
    information on declaring Python toolchains and migrating your
    code. As a side-benefit, this addresses #4815 (incorrect
    interpreter version used) on non-Windows platforms. You can
    temporarily opt out of this change with
    `--incompatible_use_python_toolchains=false`.
  - Python rules now determine the Python runtime using toolchains
    rather than `--python_top` and `--python_path`, which are
    deprecated. See #7899 for information on declaring Python
    toolchains and migrating your code. As a side-benefit, this
    addresses #4815 (incorrect interpreter version used) on
    non-Windows platforms. You can temporarily opt out of this change
    with `--incompatible_use_python_toolchains=false`.

New features:

  - Windows, Python: the --incompatible_windows_escape_python_args
    flag (false by default) builds py_binary and py_test targets with
    correct command line argument escaping.
  - cquery supports --output=build

Important changes:

  - Allow debugging C++ features logic.
  - The --ios_multi_cpus, --watchos_cpus, --macos_cpus and tvos_cpus
    are now additive. This means that you can now split the
    --ios_multi_cpus=arm64,armv7 into --ios_multi_cpus=arm64 and
    --ios_multi_cpus=armv7.
  - Generated Go protobufs now depend on
    //net/proto2/go:proto_gendeps instead of //net/proto2/go:proto
  - Add new options --cs_fdo_instrument and --cs_profile to support
    LLVM's context-sensitive FDO (CSFDO).
  - Bazel C++ compile/link Starlark API. Can be used with
    experimental flag
    --experimental_cc_skylark_api_enabled_packages=<package_path>,<pac
    kage_path2>.
  - `cc_toolchain.static_runtime_lib` and
    `cc_toolchain.dynamic_runtime_lib` are now exposed to Starlark.
  - New flag `--incompatible_no_kwargs_in_build_files`. See
    #8021
  - struct.to_proto() converts dict into proto3 text message (map<,>).
  - Android resource conflicts will no longer be reported between a
    strong attr resource and a weak attr resource, if the weak attr
    does not have format specified.
  - Flag `--incompatible_static_name_resolution_in_build_files` is
    added. See #8022
  - Add --incompatible_objc_framework_cleanup to control whether to
    enable some objc framework cleanup that changes the API.
    Specifically, the cleanup changes the objc provider API
    pertaining to frameworks.  This change is expected to be
    transparent to most users unless they write their own Starlark
    rules to handle frameworks.  See
    #7594 for details.
  - Added --incompatible_remove_binary_profile to disable the old
    binary
    profiles. Instead use the JSON profile format:
    https://docs.bazel.build/versions/master/skylark/performance.html#
    json-profile
  - Introducing --execution_log_binary_file and
    --execution_log_json_file that output a stable sorted execution
    log. They will offer a stable replacement to
    --experimental_execution_log_file.
  - Flag `--incompatible_disallow_old_octal_notation` is added. See
    //github.com//issues/8059
  - Removes the
    --incompatible_disable_genrule_cc_toolchain_dependency flag.
  - Android resource conflicts will no longer be reported between a
    strong attr resource and a weak attr resource, if the weak attr
    does not have format specified.
  - Incompatible flag
    `--incompatible_make_thinlto_command_lines_standalone` has been
    added. See #6791 for
    details.
  - objc_library does not support resource attributes any more.
    Please read #7594 for more info.
  - The `outputs` parameter of the `rule()` function is deprecated
    and attached to flag `--incompatible_no_rule_outputs_param`.
    Migrate rules to use `OutputGroupInfo` or `attr.output` instead.
    See #7977 for more info.
  - New platform_mappings ability to allow gradual flag to
    platforms/toolchains migration. See also
    #6426
  - Added support for compiling against fully qualified R classes
    from aar_import dependencies.
  - --tls_enabled flag is deprecated. Please provide 'grpcs' as a
    scheme in the URLs if TLS should be used for a remote connection.
  - Adds
    incompatible_disallow_rule_execution_platform_constraints_allowed,
     which
    disallows the use of the "execution_platform_constraints_allowed"
    attribute when defining new rules.
  - Flag `--incompatible_restrict_named_params` is added. See
    #8147 for details.
  - The glob function has a new argument `allow_empty`. When set to
    False, the glob fails when it doesn't match anything.
  - Adds the "disable_whole_archive_for_static_lib" feature to allow
    turning off legacy_whole_archive for individual targets.
  - C++ Starlark API for compilation and linking is no longer
    whitelisted
  - Update visibility advice in build-style
  - --incompatible_disable_objc_provider_resources is now enabled by
    default.
  - Fixed an issue where some `py_runtime`s were incompatible with
    using `--build_python_zip` (#5104).
  - The `outputs` parameter of the `rule()` function is deprecated
    and attached to flag `--incompatible_no_rule_outputs_param`.
    Migrate rules to use `OutputGroupInfo` or `attr.output` instead.
    See #7977 for more info.

This release contains contributions from many people at Google, as well as Benjamin Peterson, Brian Topping, clyang82, Dave Lee, George Gensure, Greg Estren, Greg, Guro Bokum, Keith Smiley, Max Vorobev, Michael Hackner, Robert Brown, Robert Sayre, Ryan Beasley, Yannic.
bazel-io pushed a commit that referenced this issue Jun 7, 2019
Original change broke //scripts/packages/debian:bazel-debian.deb
This rollforward manually tested to not break that target.

*** Original change description ***

Disable outputs param of rule function

This constitutes an incompatible change guarded by flag --incompatible_no_rule_outputs_param. See #7977 for further details.

Implementation for #7977.

RELNOTES: The `outputs` parameter of the `rule()` function is deprecated and attached to flag `--incompatible_no_rule_outputs_param`. Migrate rules to use `OutputGroupInfo` or `attr.output` instead. See #7977 for more info.
PiperOrigin-RevId: 252063297
bazel-io pushed a commit that referenced this issue Jun 17, 2019
Baseline: 5935259

Cherry picks:

   + fe81b49:
     Support of using the absolute path profile for LLVM's Context
     Sensitive FDO
   + ce5e718:
     Demote OptionProcessor from globals
   + 3ed9d36:
     Properly wire up BES half-close. The lack thereof was a simple
     oversight.
   + 4ca768e:
     standardize graph output indentation with 2 spaces
   + aff189a:
     Make sure default Linux artifacts have an associated action,
     even when artifact names are altered.
   + 8c3b3fb:
     Failures early in package loading will now fail all --keep_going
     builds.
   + 123c68d:
     Warn in more cases of possible Python version mismatch in host
     config
   + 052167e:
     Add a non-strict autodetecting Python toolchain
   + 6ef6d87:
     Default java toolchain target
   + 50fa3ec:
     Fix problems with the non-strict Python toolchain
   + e2a626c:
     Automated rollback of commit
     bc6f7cb.
   + 6efc5b7:
     Treat existence of managed directories as a part of repository
     dirtiness.
   + 3a4be3c:
     Add /usr/local/bin to default PATH under strict action env
   + 5c1005c:
     Automated rollback of commit
     536a166.

Incompatible changes:

  - --incompatible_disable_objc_provider_resources no longer has
    effect. Use of deprecated resource fields on the Objc provider is
    now disallowed regardless of this flag.
  - deleted deprecated --experimental-remote-retry* flags, please use
    --remote_retries instead
  - flipped --incompatible_list_based_execution_strategy_selection
    flag to be true by default. See
    #7480 for details.
  - Octal integer literals in Starlark are required to start with
    "Oo".
  - The "native" module is no longer available in BUILD files, all
    its members can be accessed directly as global symbols. This can
    be temporarily reverted by providing
    --incompatible_disallow_native_in_build_file=false as a flag to
    Blaze.
  - The "native" module is no longer available in BUILD files, all
    its members can be accessed directly as global symbols. This can
    be temporarily reverted by providing
    --incompatible_disallow_native_in_build_file=false as a flag to
    Blaze.
  - Turn off binary style profile format.
  - The "native" module is no longer available in BUILD files, all
    its members can be accessed directly as global symbols. This can
    be temporarily reverted by providing
    --incompatible_disallow_native_in_build_f...
  - cleanup that affects user provided apple frameworks is
    now enabled by default.  See
    #7944 for more info.
  - Python rules now determine the Python runtime using toolchains
    rather than `--python_top` and `--python_path`, which are
    deprecated. See
    [#7899](#7899) for
    information on declaring Python toolchains and migrating your
    code. As a side-benefit, this addresses
    [#4815](#4815)
    (incorrect interpreter version used) on non-Windows platforms.
    Note however that some builds break due to getting the version
    they asked for -- consider setting `python_version = "PY2"` on
    Python 2 targets and `--host_force_python=PY2` if any Python 2
    targets are used in the host configuration. You can temporarily
    opt out of this change with
    `--incompatible_use_python_toolchains=false`.
  - Depsets can't be iterated over unless they're converted to lists
    using the .to_list() method. Use
    --incompatible_depset_is_not_iterable=false to
    temporarily restore the previous behaviour.

New features:

  - Bash, runfiles: the copy-pasted init code of the Bash runfiles
    library is now shorter, see `tools/bash/runfiles/runfiles.bash`.
    The rlocation() implementation is the same.
  - Bash, runfiles: the copy-pasted init code of the Bash runfiles
    library is now shorter, see `tools/bash/runfiles/runfiles.bash`.
    The rlocation() implementation is the same.
  - Bash, runfiles: the copy-pasted init code of the Bash runfiles
    library is now shorter, see `tools/bash/runfiles/runfiles.bash`.
    To use the new init code, you need Bazel 0.27 or newer. The old
    (longer) init code still works.

Important changes:

  - The `outputs` parameter of the `rule()` function is deprecated
    and attached to flag `--incompatible_no_rule_outputs_param`.
    Migrate rules to use `OutputGroupInfo` or `attr.output` instead.
    See #7977 for more info.
  - The --incompatible_disable_objc_library_resources flag is being
    removed. Please remove it from your configs as it otherwise will
    fail the build.
  - Add a generic additional_linker_inputs attribute on cc_binary
    rules.
  - Windows, C++ autoconfigure: BAZEL_VC and BAZEL_VS may now have
    quotes, so if you set these envvars' values in cmd.exe via
    TAB-completion then you no longer need to remove the surrounding
    quotes.
  - pkg_deb has new attributes: `config` and `templates` that can be
    used for integration with debconf
  - Allow cc_import() of a DLL with no interface library on Windows,
    used to document runtime dependencies.
  - All host-configured Python tools that are built for the wrong
    Python version will now emit a warning message when they exit
    with non-zero status. See #7899.
  - deprecated --remote_local_fallback_strategy. Use
    `--strategy=remote,local` instead. See
    #7480.
  - Introduce --incompatible_disable_native_android_rules flag
  - The Android desugaring actions now support a persistent worker
    mode for faster local build performance. Enable it with
    `--strategy=Desugar=worker`.
  - --incompatible_static_name_resolution_in_build_files is now
    enabled by default
  - --incompatible_disable_deprecated_attr_params is now enabled by
    default (#5818)
  - Repository containing autoconfigured C++ toolchain
    `@local_config_cc` has been split in 2 - see
    `local_config_cc_toolchains`.
  - --incompatible_string_join_requires_strings is now enabled by
    default
  - Flag --incompatible_new_actions_api is enabled by dewfault (#5825)
  - New flag `--incompatible_disallow_empty_glob`. See
    #8195
  - --incompatible_no_kwargs_in_build_files is enabled by default
  - Incompatible flag
    `--incompatible_require_ctx_in_configure_features` has been
    flipped. See #7793 for
    more information.
  - `BAZEL_USE_XCODE_TOOLCHAIN=1` tells Bazel not to look for Xcode to
    decide whether to enable toolchains for Apple rules, but to
    assume Xcode is
    available. Can be also used when building on Darwin and no C++ or
    ObjC is being
    built, so there is no need to detect Xcode.
  - Android desugaring actions now use persistent workers by default.
    This has been measured to provide up to 20% reduction in build
    times. To disable it, use the `--strategy=Desugar=sandboxed`
    flag. See #8342 and
    #8427 for more details
    on local build speed optimization for Android apps.
  - Fixed an issue with Android builds where `--fat_apk_cpu` doesn't
    pack all selected shared libraries from `aar_import` targets into
    the APK. See
    [#8283](#8283).
  - Turn on --experimental_starlark_config_transitions by default for
    starlark transitions (see
    https://docs.bazel.build/versions/master/skylark/config.html#user-
    defined-transitions for more info)
  - Turn on --experimental_build_setting_api by default for starlark
    build settings (see
    https://docs.bazel.build/versions/master/skylark/config.html#user-
    defined-build-settings for more info)
  - Incompatible flag
    `--incompatible_dont_enable_host_nonhost_crosstool_features` has
    been flipped. See #7407
    for more information.
  - Added support for Android NDK 19 and 20.
  - Flip --incompatible_no_support_tools_in_action_inputs
  - --remote_executor, --remote_cache or --bes_backend=someurl.com
    would be treated as grpcs://someurl.com, if the
    --incompatible_tls_enabled_removed flag enabled. See
    #8061 for details.
  - Add new options --cs_fdo_absolute_path= to support the absolute
    path
    profile for LLVM's context-sensitive FDO.
  - When `--incompatible_strict_action_env` is enabled, the default
    `PATH` now includes `/usr/local/bin`.
  - Turn on --experimental_build_setting_api by default for starlark
    build settings (see
    https://docs.bazel.build/versions/master/skylark/config.html#user-
    defined-build-settings for more info)

This release contains contributions from many people at Google, as well as Alex Thompson, Andy Scott, Benjamin Peterson, David McNett, Drew Gassaway, Ira Shikhman, James deBoer, Jay Vercellone, Jingwen Chen, Josh Rosen, Keith Smiley, Laurent Le Brun, Lee Mracek, Marwan Tammam, Matt Passell, Michael Hackner, Michal Majcherski, Patrick Niklaus, Peter Mounce, Ricky Pai, Steeve Morin, szakmary, Takuto Ikuta, Vladimir Chebotarev, Yen-Chi Chen.
irengrig pushed a commit to irengrig/bazel that referenced this issue Jun 18, 2019
Baseline: daa8ae5

Cherry picks:

   + 61c7ffa:
     Automated rollback of commit
     87388e2.
   + 898d7b6:
     Add test for repository overrides, conflicting with managed
     directories being added when Bazel server is already started.
   + c2001a4:
     Automated rollback of commit
     bbe47a1.
   + e67c961:
     Fix a non-determinism in create_embedded_tools.py.
   + 81aefe7:
     Remove unsupported cpu attribute from cc_toolchains.
   + 597e289:
     remote: made CombinedCache a composition of Disk and Http Cache
   + 942f7cf:
     C++: Fixes bug in C++ API with external repo aspects
   + 85a5a2b:
     Configure @androidsdk//:emulator_x86 and :emulator_arm to point
     to the unified emulator binary
   + 9835cb4:
     Automated rollback of commit
     844e4e2.
   + c963ba2:
     Windows, Python: fix arg. esc. also in host config
   + a1ea487:
     Do not pre-cache changed files under managed directories
   + 7dc78cd:
     Add explicit execution and target constraints for autodiscovered
     cc t?
   + dd9ac13:
     Fix a bug when a relative path is used for the execution log
   + 0ff19c6:
     Fix StandaloneTestStrategy.appendStderr
   + 7f49531:
     Fix the autodetecting Python toolchain on Mac
   + ddce723:
     Avoid exporting PATH unnecessarily
   + 35dd05a:
     Allow Starlark rules to be able to use the `exec_compatible_with`

Incompatible changes:

  - Flip --incompatible_windows_escape_jvm_flags to true. See
    bazelbuild#7486
  - Flip --incompatible_windows_style_arg_escaping to true.  See
    bazelbuild#7454
  - --incompatible_windows_escape_jvm_flags is enabled by default,
    and the flag no longer exists
  - `--incompatible_no_output_attr_default` is enabled by default.
  - --incompatible_depset_union is enabled by default.
  - Python rules now determine the Python runtime using toolchains
    rather than `--python_top` and `--python_path`, which are
    deprecated. See
    [bazelbuild#7899](bazelbuild#7899) for
    information on declaring Python toolchains and migrating your
    code. As a side-benefit, this addresses bazelbuild#4815 (incorrect
    interpreter version used) on non-Windows platforms. You can
    temporarily opt out of this change with
    `--incompatible_use_python_toolchains=false`.
  - Python rules now determine the Python runtime using toolchains
    rather than `--python_top` and `--python_path`, which are
    deprecated. See bazelbuild#7899 for information on declaring Python
    toolchains and migrating your code. As a side-benefit, this
    addresses bazelbuild#4815 (incorrect interpreter version used) on
    non-Windows platforms. You can temporarily opt out of this change
    with `--incompatible_use_python_toolchains=false`.

New features:

  - Windows, Python: the --incompatible_windows_escape_python_args
    flag (false by default) builds py_binary and py_test targets with
    correct command line argument escaping.
  - cquery supports --output=build

Important changes:

  - Allow debugging C++ features logic.
  - The --ios_multi_cpus, --watchos_cpus, --macos_cpus and tvos_cpus
    are now additive. This means that you can now split the
    --ios_multi_cpus=arm64,armv7 into --ios_multi_cpus=arm64 and
    --ios_multi_cpus=armv7.
  - Generated Go protobufs now depend on
    //net/proto2/go:proto_gendeps instead of //net/proto2/go:proto
  - Add new options --cs_fdo_instrument and --cs_profile to support
    LLVM's context-sensitive FDO (CSFDO).
  - Bazel C++ compile/link Starlark API. Can be used with
    experimental flag
    --experimental_cc_skylark_api_enabled_packages=<package_path>,<pac
    kage_path2>.
  - `cc_toolchain.static_runtime_lib` and
    `cc_toolchain.dynamic_runtime_lib` are now exposed to Starlark.
  - New flag `--incompatible_no_kwargs_in_build_files`. See
    bazelbuild#8021
  - struct.to_proto() converts dict into proto3 text message (map<,>).
  - Android resource conflicts will no longer be reported between a
    strong attr resource and a weak attr resource, if the weak attr
    does not have format specified.
  - Flag `--incompatible_static_name_resolution_in_build_files` is
    added. See bazelbuild#8022
  - Add --incompatible_objc_framework_cleanup to control whether to
    enable some objc framework cleanup that changes the API.
    Specifically, the cleanup changes the objc provider API
    pertaining to frameworks.  This change is expected to be
    transparent to most users unless they write their own Starlark
    rules to handle frameworks.  See
    bazelbuild#7594 for details.
  - Added --incompatible_remove_binary_profile to disable the old
    binary
    profiles. Instead use the JSON profile format:
    https://docs.bazel.build/versions/master/skylark/performance.html#
    json-profile
  - Introducing --execution_log_binary_file and
    --execution_log_json_file that output a stable sorted execution
    log. They will offer a stable replacement to
    --experimental_execution_log_file.
  - Flag `--incompatible_disallow_old_octal_notation` is added. See
    //github.com/bazelbuild/issues/8059
  - Removes the
    --incompatible_disable_genrule_cc_toolchain_dependency flag.
  - Android resource conflicts will no longer be reported between a
    strong attr resource and a weak attr resource, if the weak attr
    does not have format specified.
  - Incompatible flag
    `--incompatible_make_thinlto_command_lines_standalone` has been
    added. See bazelbuild#6791 for
    details.
  - objc_library does not support resource attributes any more.
    Please read bazelbuild#7594 for more info.
  - The `outputs` parameter of the `rule()` function is deprecated
    and attached to flag `--incompatible_no_rule_outputs_param`.
    Migrate rules to use `OutputGroupInfo` or `attr.output` instead.
    See bazelbuild#7977 for more info.
  - New platform_mappings ability to allow gradual flag to
    platforms/toolchains migration. See also
    bazelbuild#6426
  - Added support for compiling against fully qualified R classes
    from aar_import dependencies.
  - --tls_enabled flag is deprecated. Please provide 'grpcs' as a
    scheme in the URLs if TLS should be used for a remote connection.
  - Adds
    incompatible_disallow_rule_execution_platform_constraints_allowed,
     which
    disallows the use of the "execution_platform_constraints_allowed"
    attribute when defining new rules.
  - Flag `--incompatible_restrict_named_params` is added. See
    bazelbuild#8147 for details.
  - The glob function has a new argument `allow_empty`. When set to
    False, the glob fails when it doesn't match anything.
  - Adds the "disable_whole_archive_for_static_lib" feature to allow
    turning off legacy_whole_archive for individual targets.
  - C++ Starlark API for compilation and linking is no longer
    whitelisted
  - Update visibility advice in build-style
  - --incompatible_disable_objc_provider_resources is now enabled by
    default.
  - Fixed an issue where some `py_runtime`s were incompatible with
    using `--build_python_zip` (bazelbuild#5104).
  - The `outputs` parameter of the `rule()` function is deprecated
    and attached to flag `--incompatible_no_rule_outputs_param`.
    Migrate rules to use `OutputGroupInfo` or `attr.output` instead.
    See bazelbuild#7977 for more info.

This release contains contributions from many people at Google, as well as Benjamin Peterson, Brian Topping, clyang82, Dave Lee, George Gensure, Greg Estren, Greg, Guro Bokum, Keith Smiley, Max Vorobev, Michael Hackner, Robert Brown, Robert Sayre, Ryan Beasley, Yannic.
irengrig pushed a commit to irengrig/bazel that referenced this issue Jun 18, 2019
Original change broke //scripts/packages/debian:bazel-debian.deb
This rollforward manually tested to not break that target.

*** Original change description ***

Disable outputs param of rule function

This constitutes an incompatible change guarded by flag --incompatible_no_rule_outputs_param. See bazelbuild#7977 for further details.

Implementation for bazelbuild#7977.

RELNOTES: The `outputs` parameter of the `rule()` function is deprecated and attached to flag `--incompatible_no_rule_outputs_param`. Migrate rules to use `OutputGroupInfo` or `attr.output` instead. See bazelbuild#7977 for more info.
PiperOrigin-RevId: 252063297
irengrig pushed a commit to irengrig/bazel that referenced this issue Jun 18, 2019
Baseline: 5935259

Cherry picks:

   + fe81b49:
     Support of using the absolute path profile for LLVM's Context
     Sensitive FDO
   + ce5e718:
     Demote OptionProcessor from globals
   + 3ed9d36:
     Properly wire up BES half-close. The lack thereof was a simple
     oversight.
   + 4ca768e:
     standardize graph output indentation with 2 spaces
   + aff189a:
     Make sure default Linux artifacts have an associated action,
     even when artifact names are altered.
   + 8c3b3fb:
     Failures early in package loading will now fail all --keep_going
     builds.
   + 123c68d:
     Warn in more cases of possible Python version mismatch in host
     config
   + 052167e:
     Add a non-strict autodetecting Python toolchain
   + 6ef6d87:
     Default java toolchain target
   + 50fa3ec:
     Fix problems with the non-strict Python toolchain
   + e2a626c:
     Automated rollback of commit
     bc6f7cb.
   + 6efc5b7:
     Treat existence of managed directories as a part of repository
     dirtiness.
   + 3a4be3c:
     Add /usr/local/bin to default PATH under strict action env
   + 5c1005c:
     Automated rollback of commit
     536a166.

Incompatible changes:

  - --incompatible_disable_objc_provider_resources no longer has
    effect. Use of deprecated resource fields on the Objc provider is
    now disallowed regardless of this flag.
  - deleted deprecated --experimental-remote-retry* flags, please use
    --remote_retries instead
  - flipped --incompatible_list_based_execution_strategy_selection
    flag to be true by default. See
    bazelbuild#7480 for details.
  - Octal integer literals in Starlark are required to start with
    "Oo".
  - The "native" module is no longer available in BUILD files, all
    its members can be accessed directly as global symbols. This can
    be temporarily reverted by providing
    --incompatible_disallow_native_in_build_file=false as a flag to
    Blaze.
  - The "native" module is no longer available in BUILD files, all
    its members can be accessed directly as global symbols. This can
    be temporarily reverted by providing
    --incompatible_disallow_native_in_build_file=false as a flag to
    Blaze.
  - Turn off binary style profile format.
  - The "native" module is no longer available in BUILD files, all
    its members can be accessed directly as global symbols. This can
    be temporarily reverted by providing
    --incompatible_disallow_native_in_build_f...
  - cleanup that affects user provided apple frameworks is
    now enabled by default.  See
    bazelbuild#7944 for more info.
  - Python rules now determine the Python runtime using toolchains
    rather than `--python_top` and `--python_path`, which are
    deprecated. See
    [bazelbuild#7899](bazelbuild#7899) for
    information on declaring Python toolchains and migrating your
    code. As a side-benefit, this addresses
    [bazelbuild#4815](bazelbuild#4815)
    (incorrect interpreter version used) on non-Windows platforms.
    Note however that some builds break due to getting the version
    they asked for -- consider setting `python_version = "PY2"` on
    Python 2 targets and `--host_force_python=PY2` if any Python 2
    targets are used in the host configuration. You can temporarily
    opt out of this change with
    `--incompatible_use_python_toolchains=false`.
  - Depsets can't be iterated over unless they're converted to lists
    using the .to_list() method. Use
    --incompatible_depset_is_not_iterable=false to
    temporarily restore the previous behaviour.

New features:

  - Bash, runfiles: the copy-pasted init code of the Bash runfiles
    library is now shorter, see `tools/bash/runfiles/runfiles.bash`.
    The rlocation() implementation is the same.
  - Bash, runfiles: the copy-pasted init code of the Bash runfiles
    library is now shorter, see `tools/bash/runfiles/runfiles.bash`.
    The rlocation() implementation is the same.
  - Bash, runfiles: the copy-pasted init code of the Bash runfiles
    library is now shorter, see `tools/bash/runfiles/runfiles.bash`.
    To use the new init code, you need Bazel 0.27 or newer. The old
    (longer) init code still works.

Important changes:

  - The `outputs` parameter of the `rule()` function is deprecated
    and attached to flag `--incompatible_no_rule_outputs_param`.
    Migrate rules to use `OutputGroupInfo` or `attr.output` instead.
    See bazelbuild#7977 for more info.
  - The --incompatible_disable_objc_library_resources flag is being
    removed. Please remove it from your configs as it otherwise will
    fail the build.
  - Add a generic additional_linker_inputs attribute on cc_binary
    rules.
  - Windows, C++ autoconfigure: BAZEL_VC and BAZEL_VS may now have
    quotes, so if you set these envvars' values in cmd.exe via
    TAB-completion then you no longer need to remove the surrounding
    quotes.
  - pkg_deb has new attributes: `config` and `templates` that can be
    used for integration with debconf
  - Allow cc_import() of a DLL with no interface library on Windows,
    used to document runtime dependencies.
  - All host-configured Python tools that are built for the wrong
    Python version will now emit a warning message when they exit
    with non-zero status. See bazelbuild#7899.
  - deprecated --remote_local_fallback_strategy. Use
    `--strategy=remote,local` instead. See
    bazelbuild#7480.
  - Introduce --incompatible_disable_native_android_rules flag
  - The Android desugaring actions now support a persistent worker
    mode for faster local build performance. Enable it with
    `--strategy=Desugar=worker`.
  - --incompatible_static_name_resolution_in_build_files is now
    enabled by default
  - --incompatible_disable_deprecated_attr_params is now enabled by
    default (bazelbuild#5818)
  - Repository containing autoconfigured C++ toolchain
    `@local_config_cc` has been split in 2 - see
    `local_config_cc_toolchains`.
  - --incompatible_string_join_requires_strings is now enabled by
    default
  - Flag --incompatible_new_actions_api is enabled by dewfault (bazelbuild#5825)
  - New flag `--incompatible_disallow_empty_glob`. See
    bazelbuild#8195
  - --incompatible_no_kwargs_in_build_files is enabled by default
  - Incompatible flag
    `--incompatible_require_ctx_in_configure_features` has been
    flipped. See bazelbuild#7793 for
    more information.
  - `BAZEL_USE_XCODE_TOOLCHAIN=1` tells Bazel not to look for Xcode to
    decide whether to enable toolchains for Apple rules, but to
    assume Xcode is
    available. Can be also used when building on Darwin and no C++ or
    ObjC is being
    built, so there is no need to detect Xcode.
  - Android desugaring actions now use persistent workers by default.
    This has been measured to provide up to 20% reduction in build
    times. To disable it, use the `--strategy=Desugar=sandboxed`
    flag. See bazelbuild#8342 and
    bazelbuild#8427 for more details
    on local build speed optimization for Android apps.
  - Fixed an issue with Android builds where `--fat_apk_cpu` doesn't
    pack all selected shared libraries from `aar_import` targets into
    the APK. See
    [bazelbuild#8283](bazelbuild#8283).
  - Turn on --experimental_starlark_config_transitions by default for
    starlark transitions (see
    https://docs.bazel.build/versions/master/skylark/config.html#user-
    defined-transitions for more info)
  - Turn on --experimental_build_setting_api by default for starlark
    build settings (see
    https://docs.bazel.build/versions/master/skylark/config.html#user-
    defined-build-settings for more info)
  - Incompatible flag
    `--incompatible_dont_enable_host_nonhost_crosstool_features` has
    been flipped. See bazelbuild#7407
    for more information.
  - Added support for Android NDK 19 and 20.
  - Flip --incompatible_no_support_tools_in_action_inputs
  - --remote_executor, --remote_cache or --bes_backend=someurl.com
    would be treated as grpcs://someurl.com, if the
    --incompatible_tls_enabled_removed flag enabled. See
    bazelbuild#8061 for details.
  - Add new options --cs_fdo_absolute_path= to support the absolute
    path
    profile for LLVM's context-sensitive FDO.
  - When `--incompatible_strict_action_env` is enabled, the default
    `PATH` now includes `/usr/local/bin`.
  - Turn on --experimental_build_setting_api by default for starlark
    build settings (see
    https://docs.bazel.build/versions/master/skylark/config.html#user-
    defined-build-settings for more info)

This release contains contributions from many people at Google, as well as Alex Thompson, Andy Scott, Benjamin Peterson, David McNett, Drew Gassaway, Ira Shikhman, James deBoer, Jay Vercellone, Jingwen Chen, Josh Rosen, Keith Smiley, Laurent Le Brun, Lee Mracek, Marwan Tammam, Matt Passell, Michael Hackner, Michal Majcherski, Patrick Niklaus, Peter Mounce, Ricky Pai, Steeve Morin, szakmary, Takuto Ikuta, Vladimir Chebotarev, Yen-Chi Chen.
@sergiocampama
Copy link
Contributor

Looks like this is incompatible with rule transitions, I get the following error:

java.lang.RuntimeException: Unrecoverable error while evaluating node X:X.out BuildConfigurationValue.Key[ee7a6eae9f289e48bf8a1e925f4979c1] false' (requested by nodes )
	at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:528)
	at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:399)
	at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1396)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:283)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.localPopAndExec(ForkJoinPool.java:950)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1607)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175)
Caused by: com.google.common.base.VerifyException: Could not find prerequisite X:X in the expected configuration
	at com.google.common.base.Verify.verify(Verify.java:124)
	at com.google.common.base.Verify.verifyNotNull(Verify.java:500)
	at com.google.devtools.build.lib.analysis.TargetContext.findDirectPrerequisite(TargetContext.java:113)
	at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createConfiguredTarget(ConfiguredTargetFactory.java:213)
	at com.google.devtools.build.lib.skyframe.SkyframeBuildView.createConfiguredTarget(SkyframeBuildView.java:774)
	at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.createConfiguredTarget(ConfiguredTargetFunction.java:891)
	at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.compute(ConfiguredTargetFunction.java:351)
	at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:451)

Granted, this is also an issue with implicit outputs, just wanted to bring this into attention in case the solution is different.

buchgr pushed a commit to buchgr/bazel that referenced this issue Jun 23, 2019
Baseline: 5935259

Cherry picks:

   + fe81b49:
     Support of using the absolute path profile for LLVM's Context
     Sensitive FDO
   + ce5e718:
     Demote OptionProcessor from globals
   + 3ed9d36:
     Properly wire up BES half-close. The lack thereof was a simple
     oversight.
   + 4ca768e:
     standardize graph output indentation with 2 spaces
   + aff189a:
     Make sure default Linux artifacts have an associated action,
     even when artifact names are altered.
   + 8c3b3fb:
     Failures early in package loading will now fail all --keep_going
     builds.
   + 123c68d:
     Warn in more cases of possible Python version mismatch in host
     config
   + 052167e:
     Add a non-strict autodetecting Python toolchain
   + 6ef6d87:
     Default java toolchain target
   + 50fa3ec:
     Fix problems with the non-strict Python toolchain
   + e2a626c:
     Automated rollback of commit
     bc6f7cb.
   + 6efc5b7:
     Treat existence of managed directories as a part of repository
     dirtiness.
   + 3a4be3c:
     Add /usr/local/bin to default PATH under strict action env
   + 5c1005c:
     Automated rollback of commit
     536a166.

Incompatible changes:

  - --incompatible_disable_objc_provider_resources no longer has
    effect. Use of deprecated resource fields on the Objc provider is
    now disallowed regardless of this flag.
  - deleted deprecated --experimental-remote-retry* flags, please use
    --remote_retries instead
  - flipped --incompatible_list_based_execution_strategy_selection
    flag to be true by default. See
    bazelbuild#7480 for details.
  - Octal integer literals in Starlark are required to start with
    "Oo".
  - The "native" module is no longer available in BUILD files, all
    its members can be accessed directly as global symbols. This can
    be temporarily reverted by providing
    --incompatible_disallow_native_in_build_file=false as a flag to
    Blaze.
  - The "native" module is no longer available in BUILD files, all
    its members can be accessed directly as global symbols. This can
    be temporarily reverted by providing
    --incompatible_disallow_native_in_build_file=false as a flag to
    Blaze.
  - Turn off binary style profile format.
  - The "native" module is no longer available in BUILD files, all
    its members can be accessed directly as global symbols. This can
    be temporarily reverted by providing
    --incompatible_disallow_native_in_build_f...
  - cleanup that affects user provided apple frameworks is
    now enabled by default.  See
    bazelbuild#7944 for more info.
  - Python rules now determine the Python runtime using toolchains
    rather than `--python_top` and `--python_path`, which are
    deprecated. See
    [bazelbuild#7899](bazelbuild#7899) for
    information on declaring Python toolchains and migrating your
    code. As a side-benefit, this addresses
    [bazelbuild#4815](bazelbuild#4815)
    (incorrect interpreter version used) on non-Windows platforms.
    Note however that some builds break due to getting the version
    they asked for -- consider setting `python_version = "PY2"` on
    Python 2 targets and `--host_force_python=PY2` if any Python 2
    targets are used in the host configuration. You can temporarily
    opt out of this change with
    `--incompatible_use_python_toolchains=false`.
  - Depsets can't be iterated over unless they're converted to lists
    using the .to_list() method. Use
    --incompatible_depset_is_not_iterable=false to
    temporarily restore the previous behaviour.

New features:

  - Bash, runfiles: the copy-pasted init code of the Bash runfiles
    library is now shorter, see `tools/bash/runfiles/runfiles.bash`.
    The rlocation() implementation is the same.
  - Bash, runfiles: the copy-pasted init code of the Bash runfiles
    library is now shorter, see `tools/bash/runfiles/runfiles.bash`.
    The rlocation() implementation is the same.
  - Bash, runfiles: the copy-pasted init code of the Bash runfiles
    library is now shorter, see `tools/bash/runfiles/runfiles.bash`.
    To use the new init code, you need Bazel 0.27 or newer. The old
    (longer) init code still works.

Important changes:

  - The `outputs` parameter of the `rule()` function is deprecated
    and attached to flag `--incompatible_no_rule_outputs_param`.
    Migrate rules to use `OutputGroupInfo` or `attr.output` instead.
    See bazelbuild#7977 for more info.
  - The --incompatible_disable_objc_library_resources flag is being
    removed. Please remove it from your configs as it otherwise will
    fail the build.
  - Add a generic additional_linker_inputs attribute on cc_binary
    rules.
  - Windows, C++ autoconfigure: BAZEL_VC and BAZEL_VS may now have
    quotes, so if you set these envvars' values in cmd.exe via
    TAB-completion then you no longer need to remove the surrounding
    quotes.
  - pkg_deb has new attributes: `config` and `templates` that can be
    used for integration with debconf
  - Allow cc_import() of a DLL with no interface library on Windows,
    used to document runtime dependencies.
  - All host-configured Python tools that are built for the wrong
    Python version will now emit a warning message when they exit
    with non-zero status. See bazelbuild#7899.
  - deprecated --remote_local_fallback_strategy. Use
    `--strategy=remote,local` instead. See
    bazelbuild#7480.
  - Introduce --incompatible_disable_native_android_rules flag
  - The Android desugaring actions now support a persistent worker
    mode for faster local build performance. Enable it with
    `--strategy=Desugar=worker`.
  - --incompatible_static_name_resolution_in_build_files is now
    enabled by default
  - --incompatible_disable_deprecated_attr_params is now enabled by
    default (bazelbuild#5818)
  - Repository containing autoconfigured C++ toolchain
    `@local_config_cc` has been split in 2 - see
    `local_config_cc_toolchains`.
  - --incompatible_string_join_requires_strings is now enabled by
    default
  - Flag --incompatible_new_actions_api is enabled by dewfault (bazelbuild#5825)
  - New flag `--incompatible_disallow_empty_glob`. See
    bazelbuild#8195
  - --incompatible_no_kwargs_in_build_files is enabled by default
  - Incompatible flag
    `--incompatible_require_ctx_in_configure_features` has been
    flipped. See bazelbuild#7793 for
    more information.
  - `BAZEL_USE_XCODE_TOOLCHAIN=1` tells Bazel not to look for Xcode to
    decide whether to enable toolchains for Apple rules, but to
    assume Xcode is
    available. Can be also used when building on Darwin and no C++ or
    ObjC is being
    built, so there is no need to detect Xcode.
  - Android desugaring actions now use persistent workers by default.
    This has been measured to provide up to 20% reduction in build
    times. To disable it, use the `--strategy=Desugar=sandboxed`
    flag. See bazelbuild#8342 and
    bazelbuild#8427 for more details
    on local build speed optimization for Android apps.
  - Fixed an issue with Android builds where `--fat_apk_cpu` doesn't
    pack all selected shared libraries from `aar_import` targets into
    the APK. See
    [bazelbuild#8283](bazelbuild#8283).
  - Turn on --experimental_starlark_config_transitions by default for
    starlark transitions (see
    https://docs.bazel.build/versions/master/skylark/config.html#user-
    defined-transitions for more info)
  - Turn on --experimental_build_setting_api by default for starlark
    build settings (see
    https://docs.bazel.build/versions/master/skylark/config.html#user-
    defined-build-settings for more info)
  - Incompatible flag
    `--incompatible_dont_enable_host_nonhost_crosstool_features` has
    been flipped. See bazelbuild#7407
    for more information.
  - Added support for Android NDK 19 and 20.
  - Flip --incompatible_no_support_tools_in_action_inputs
  - --remote_executor, --remote_cache or --bes_backend=someurl.com
    would be treated as grpcs://someurl.com, if the
    --incompatible_tls_enabled_removed flag enabled. See
    bazelbuild#8061 for details.
  - Add new options --cs_fdo_absolute_path= to support the absolute
    path
    profile for LLVM's context-sensitive FDO.
  - When `--incompatible_strict_action_env` is enabled, the default
    `PATH` now includes `/usr/local/bin`.
  - Turn on --experimental_build_setting_api by default for starlark
    build settings (see
    https://docs.bazel.build/versions/master/skylark/config.html#user-
    defined-build-settings for more info)

This release contains contributions from many people at Google, as well as Alex Thompson, Andy Scott, Benjamin Peterson, David McNett, Drew Gassaway, Ira Shikhman, James deBoer, Jay Vercellone, Jingwen Chen, Josh Rosen, Keith Smiley, Laurent Le Brun, Lee Mracek, Marwan Tammam, Matt Passell, Michael Hackner, Michal Majcherski, Patrick Niklaus, Peter Mounce, Ricky Pai, Steeve Morin, szakmary, Takuto Ikuta, Vladimir Chebotarev, Yen-Chi Chen.
siberex pushed a commit to siberex/bazel that referenced this issue Jul 4, 2019
Baseline: 5935259

Cherry picks:

   + fe81b49:
     Support of using the absolute path profile for LLVM's Context
     Sensitive FDO
   + ce5e718:
     Demote OptionProcessor from globals
   + 3ed9d36:
     Properly wire up BES half-close. The lack thereof was a simple
     oversight.
   + 4ca768e:
     standardize graph output indentation with 2 spaces
   + aff189a:
     Make sure default Linux artifacts have an associated action,
     even when artifact names are altered.
   + 8c3b3fb:
     Failures early in package loading will now fail all --keep_going
     builds.
   + 123c68d:
     Warn in more cases of possible Python version mismatch in host
     config
   + 052167e:
     Add a non-strict autodetecting Python toolchain
   + 6ef6d87:
     Default java toolchain target
   + 50fa3ec:
     Fix problems with the non-strict Python toolchain
   + e2a626c:
     Automated rollback of commit
     bc6f7cb.
   + 6efc5b7:
     Treat existence of managed directories as a part of repository
     dirtiness.
   + 3a4be3c:
     Add /usr/local/bin to default PATH under strict action env
   + 5c1005c:
     Automated rollback of commit
     536a166.

Incompatible changes:

  - --incompatible_disable_objc_provider_resources no longer has
    effect. Use of deprecated resource fields on the Objc provider is
    now disallowed regardless of this flag.
  - deleted deprecated --experimental-remote-retry* flags, please use
    --remote_retries instead
  - flipped --incompatible_list_based_execution_strategy_selection
    flag to be true by default. See
    bazelbuild#7480 for details.
  - Octal integer literals in Starlark are required to start with
    "Oo".
  - The "native" module is no longer available in BUILD files, all
    its members can be accessed directly as global symbols. This can
    be temporarily reverted by providing
    --incompatible_disallow_native_in_build_file=false as a flag to
    Blaze.
  - The "native" module is no longer available in BUILD files, all
    its members can be accessed directly as global symbols. This can
    be temporarily reverted by providing
    --incompatible_disallow_native_in_build_file=false as a flag to
    Blaze.
  - Turn off binary style profile format.
  - The "native" module is no longer available in BUILD files, all
    its members can be accessed directly as global symbols. This can
    be temporarily reverted by providing
    --incompatible_disallow_native_in_build_f...
  - cleanup that affects user provided apple frameworks is
    now enabled by default.  See
    bazelbuild#7944 for more info.
  - Python rules now determine the Python runtime using toolchains
    rather than `--python_top` and `--python_path`, which are
    deprecated. See
    [bazelbuild#7899](bazelbuild#7899) for
    information on declaring Python toolchains and migrating your
    code. As a side-benefit, this addresses
    [bazelbuild#4815](bazelbuild#4815)
    (incorrect interpreter version used) on non-Windows platforms.
    Note however that some builds break due to getting the version
    they asked for -- consider setting `python_version = "PY2"` on
    Python 2 targets and `--host_force_python=PY2` if any Python 2
    targets are used in the host configuration. You can temporarily
    opt out of this change with
    `--incompatible_use_python_toolchains=false`.
  - Depsets can't be iterated over unless they're converted to lists
    using the .to_list() method. Use
    --incompatible_depset_is_not_iterable=false to
    temporarily restore the previous behaviour.

New features:

  - Bash, runfiles: the copy-pasted init code of the Bash runfiles
    library is now shorter, see `tools/bash/runfiles/runfiles.bash`.
    The rlocation() implementation is the same.
  - Bash, runfiles: the copy-pasted init code of the Bash runfiles
    library is now shorter, see `tools/bash/runfiles/runfiles.bash`.
    The rlocation() implementation is the same.
  - Bash, runfiles: the copy-pasted init code of the Bash runfiles
    library is now shorter, see `tools/bash/runfiles/runfiles.bash`.
    To use the new init code, you need Bazel 0.27 or newer. The old
    (longer) init code still works.

Important changes:

  - The `outputs` parameter of the `rule()` function is deprecated
    and attached to flag `--incompatible_no_rule_outputs_param`.
    Migrate rules to use `OutputGroupInfo` or `attr.output` instead.
    See bazelbuild#7977 for more info.
  - The --incompatible_disable_objc_library_resources flag is being
    removed. Please remove it from your configs as it otherwise will
    fail the build.
  - Add a generic additional_linker_inputs attribute on cc_binary
    rules.
  - Windows, C++ autoconfigure: BAZEL_VC and BAZEL_VS may now have
    quotes, so if you set these envvars' values in cmd.exe via
    TAB-completion then you no longer need to remove the surrounding
    quotes.
  - pkg_deb has new attributes: `config` and `templates` that can be
    used for integration with debconf
  - Allow cc_import() of a DLL with no interface library on Windows,
    used to document runtime dependencies.
  - All host-configured Python tools that are built for the wrong
    Python version will now emit a warning message when they exit
    with non-zero status. See bazelbuild#7899.
  - deprecated --remote_local_fallback_strategy. Use
    `--strategy=remote,local` instead. See
    bazelbuild#7480.
  - Introduce --incompatible_disable_native_android_rules flag
  - The Android desugaring actions now support a persistent worker
    mode for faster local build performance. Enable it with
    `--strategy=Desugar=worker`.
  - --incompatible_static_name_resolution_in_build_files is now
    enabled by default
  - --incompatible_disable_deprecated_attr_params is now enabled by
    default (bazelbuild#5818)
  - Repository containing autoconfigured C++ toolchain
    `@local_config_cc` has been split in 2 - see
    `local_config_cc_toolchains`.
  - --incompatible_string_join_requires_strings is now enabled by
    default
  - Flag --incompatible_new_actions_api is enabled by dewfault (bazelbuild#5825)
  - New flag `--incompatible_disallow_empty_glob`. See
    bazelbuild#8195
  - --incompatible_no_kwargs_in_build_files is enabled by default
  - Incompatible flag
    `--incompatible_require_ctx_in_configure_features` has been
    flipped. See bazelbuild#7793 for
    more information.
  - `BAZEL_USE_XCODE_TOOLCHAIN=1` tells Bazel not to look for Xcode to
    decide whether to enable toolchains for Apple rules, but to
    assume Xcode is
    available. Can be also used when building on Darwin and no C++ or
    ObjC is being
    built, so there is no need to detect Xcode.
  - Android desugaring actions now use persistent workers by default.
    This has been measured to provide up to 20% reduction in build
    times. To disable it, use the `--strategy=Desugar=sandboxed`
    flag. See bazelbuild#8342 and
    bazelbuild#8427 for more details
    on local build speed optimization for Android apps.
  - Fixed an issue with Android builds where `--fat_apk_cpu` doesn't
    pack all selected shared libraries from `aar_import` targets into
    the APK. See
    [bazelbuild#8283](bazelbuild#8283).
  - Turn on --experimental_starlark_config_transitions by default for
    starlark transitions (see
    https://docs.bazel.build/versions/master/skylark/config.html#user-
    defined-transitions for more info)
  - Turn on --experimental_build_setting_api by default for starlark
    build settings (see
    https://docs.bazel.build/versions/master/skylark/config.html#user-
    defined-build-settings for more info)
  - Incompatible flag
    `--incompatible_dont_enable_host_nonhost_crosstool_features` has
    been flipped. See bazelbuild#7407
    for more information.
  - Added support for Android NDK 19 and 20.
  - Flip --incompatible_no_support_tools_in_action_inputs
  - --remote_executor, --remote_cache or --bes_backend=someurl.com
    would be treated as grpcs://someurl.com, if the
    --incompatible_tls_enabled_removed flag enabled. See
    bazelbuild#8061 for details.
  - Add new options --cs_fdo_absolute_path= to support the absolute
    path
    profile for LLVM's context-sensitive FDO.
  - When `--incompatible_strict_action_env` is enabled, the default
    `PATH` now includes `/usr/local/bin`.
  - Turn on --experimental_build_setting_api by default for starlark
    build settings (see
    https://docs.bazel.build/versions/master/skylark/config.html#user-
    defined-build-settings for more info)

This release contains contributions from many people at Google, as well as Alex Thompson, Andy Scott, Benjamin Peterson, David McNett, Drew Gassaway, Ira Shikhman, James deBoer, Jay Vercellone, Jingwen Chen, Josh Rosen, Keith Smiley, Laurent Le Brun, Lee Mracek, Marwan Tammam, Matt Passell, Michael Hackner, Michal Majcherski, Patrick Niklaus, Peter Mounce, Ricky Pai, Steeve Morin, szakmary, Takuto Ikuta, Vladimir Chebotarev, Yen-Chi Chen.
bazel-io pushed a commit that referenced this issue Jul 10, 2019
Baseline: 2e374a9

Cherry picks:

   + 6d0b14b:
     rule_test: apply "tags" to all rules in the macro

Incompatible changes:

  - Add --incompatible_enable_profile_by_default to enable the JSON
    profile by default.
  - The --incompatible_windows_style_arg_escaping flag is flipped to
    "true", and the "false" case unsupported. Bazel no longer accepts
    this flag.

Important changes:

  - Bazel now supports hiding compiler warnings for targets that
    you're not explicitly building (see
    https://docs.bazel.build/versions/master/user-manual.html#flag--au
    to_output_filter).
  - Flag `--incompatible_restrict_escape_sequences` is added. See
    #8380
  - The "info" command now supports the "starlark-semantics"
    argument, which outputs a representation of the effective Starlark
    semantics option values.
  - The `outputs` parameter of the `rule()` function is deprecated
    and attached to flag `--incompatible_no_rule_outputs_param`.
    Migrate rules to use `OutputGroupInfo` or `attr.output` instead.
    See #7977 for more info.
  - When `--incompatible_strict_action_env` is enabled, the default
    `PATH` now includes `/usr/local/bin`.
  - Turn on --experimental_build_setting_api by default for starlark
    build settings (see
    https://docs.bazel.build/versions/master/skylark/config.html#user-
    defined-build-settings for more info)
  - `@bazel_tools//tools/jdk:toolchain_java10` and
    `@bazel_tools//tools/jdk:toolchain_java11` are now available to
    enable java 10, respectively java 11 language level support.
  - The `command` parameter of the `actions.run_shell()` function
    will be restricted to only accept strings (and not string
    sequences). This check is attached to flag
    `--incompatible_run_shell_command_string`. One may migrate by
    using the `arguments` parameter of `actions.run()` instead. See
    #5903 for more info.
  - Incompatible change
    `--incompatible_use_platforms_repo_for_constraints` has been
    added. See #8622 for
    details.
  - Incompatible change
    `--incompatible_use_platforms_repo_for_constraints` has been
    added. See #8622 f...
  - Bazel's C++ autoconfiguration now understands `BAZEL_LINKLIBS`
    environment variable to specify system libraries that should be
    appended to the link command line.
  - paths under the execution root starting with "." or "_" will be
    re-linked across builds
  - execution_log_json_file now allows actions without outputs.
  - Labels aapt as deprecated for aapt_version, and heavily endorses
    aapt2.
  - Update doc links still pointing to cc_binary.features to point to
    common features
  - Incompatible change
    `--incompatible_use_platforms_repo_for_constraints` has been
    added. See #8622 for
    details.
    RELNOTES:
  - --incompatible_disable_nocopts flag has been added. See
    #8706 for details.
  - Fixed treatment of <dist:module /> tags in AndroidManifest.xml
  - Fixed asset precedence for android_binary rules with aapt2.
  - Bazel now officially supports running on CentOS 7.
  - The runtime dynamic libraries are no longer in default output
    group of cc_binary.
  - set the FDOBuildType as CSFDO for binaries built with
    --cs_fdo_absolute_path.
  - Bazel can now be bootstrapped and built on arm64 platforms
    without requiring any flags or patches.
  - Fixed treatment of AndroidManifest.xml attributes which contained
    XML escaping
  - Retire experimental blaze flag
    experimental_link_compile_output_separately. The same behavior is
    available through the feature dynamic_link_test_srcs.
  - --incompatible_load_java_rules_from_bzl was added to forbid
    loading the native java rules directly. See more on tracking
    issue #8746
  - Turn on --experimental_build_setting_api by default for starlark
    build settings (see
    https://docs.bazel.build/versions/master/skylark/config.html#user-
    defined-build-settings for more info)
  - Attribute names are going to be restricted and must be
    syntactically valid identifiers.
    #6437
  - rule_test: fix Bazel 0.27 regression ("tags" attribute was
    ingored, #8723

This release contains contributions from many people at Google, as well as Ben Diuguid, Benjamin Peterson, Dave Lee, Loo Rong Jie, Mark Butcher, Marwan Tammam, Pedro Alvarez.
@shahms
Copy link

shahms commented Jul 11, 2019

Without the ability to manually specify the rule kind, encouraging the macro-based solution is going further obscure the fact that the left-hand-side of the assignment from the return value of rule is part of the public API surface of a rule. We already have enough of a problem with this as it is (to say nothing of mnemonic) and I think the current direction in this bug will make it worse.

or-shachar added a commit to or-shachar/rules_docker that referenced this issue Jul 14, 2019
or-shachar added a commit to or-shachar/rules_docker that referenced this issue Jul 14, 2019
or-shachar added a commit to or-shachar/rules_docker that referenced this issue Jul 14, 2019
irengrig pushed a commit to irengrig/bazel that referenced this issue Jul 15, 2019
Baseline: daa8ae5

Cherry picks:

   + 61c7ffa:
     Automated rollback of commit
     87388e2.
   + 898d7b6:
     Add test for repository overrides, conflicting with managed
     directories being added when Bazel server is already started.
   + c2001a4:
     Automated rollback of commit
     bbe47a1.
   + e67c961:
     Fix a non-determinism in create_embedded_tools.py.
   + 81aefe7:
     Remove unsupported cpu attribute from cc_toolchains.
   + 597e289:
     remote: made CombinedCache a composition of Disk and Http Cache
   + 942f7cf:
     C++: Fixes bug in C++ API with external repo aspects
   + 85a5a2b:
     Configure @androidsdk//:emulator_x86 and :emulator_arm to point
     to the unified emulator binary
   + 9835cb4:
     Automated rollback of commit
     844e4e2.
   + c963ba2:
     Windows, Python: fix arg. esc. also in host config
   + a1ea487:
     Do not pre-cache changed files under managed directories
   + 7dc78cd:
     Add explicit execution and target constraints for autodiscovered
     cc t?
   + dd9ac13:
     Fix a bug when a relative path is used for the execution log
   + 0ff19c6:
     Fix StandaloneTestStrategy.appendStderr
   + 7f49531:
     Fix the autodetecting Python toolchain on Mac
   + ddce723:
     Avoid exporting PATH unnecessarily
   + 35dd05a:
     Allow Starlark rules to be able to use the `exec_compatible_with`

Incompatible changes:

  - Flip --incompatible_windows_escape_jvm_flags to true. See
    bazelbuild#7486
  - Flip --incompatible_windows_style_arg_escaping to true.  See
    bazelbuild#7454
  - --incompatible_windows_escape_jvm_flags is enabled by default,
    and the flag no longer exists
  - `--incompatible_no_output_attr_default` is enabled by default.
  - --incompatible_depset_union is enabled by default.
  - Python rules now determine the Python runtime using toolchains
    rather than `--python_top` and `--python_path`, which are
    deprecated. See
    [bazelbuild#7899](bazelbuild#7899) for
    information on declaring Python toolchains and migrating your
    code. As a side-benefit, this addresses bazelbuild#4815 (incorrect
    interpreter version used) on non-Windows platforms. You can
    temporarily opt out of this change with
    `--incompatible_use_python_toolchains=false`.
  - Python rules now determine the Python runtime using toolchains
    rather than `--python_top` and `--python_path`, which are
    deprecated. See bazelbuild#7899 for information on declaring Python
    toolchains and migrating your code. As a side-benefit, this
    addresses bazelbuild#4815 (incorrect interpreter version used) on
    non-Windows platforms. You can temporarily opt out of this change
    with `--incompatible_use_python_toolchains=false`.

New features:

  - Windows, Python: the --incompatible_windows_escape_python_args
    flag (false by default) builds py_binary and py_test targets with
    correct command line argument escaping.
  - cquery supports --output=build

Important changes:

  - Allow debugging C++ features logic.
  - The --ios_multi_cpus, --watchos_cpus, --macos_cpus and tvos_cpus
    are now additive. This means that you can now split the
    --ios_multi_cpus=arm64,armv7 into --ios_multi_cpus=arm64 and
    --ios_multi_cpus=armv7.
  - Generated Go protobufs now depend on
    //net/proto2/go:proto_gendeps instead of //net/proto2/go:proto
  - Add new options --cs_fdo_instrument and --cs_profile to support
    LLVM's context-sensitive FDO (CSFDO).
  - Bazel C++ compile/link Starlark API. Can be used with
    experimental flag
    --experimental_cc_skylark_api_enabled_packages=<package_path>,<pac
    kage_path2>.
  - `cc_toolchain.static_runtime_lib` and
    `cc_toolchain.dynamic_runtime_lib` are now exposed to Starlark.
  - New flag `--incompatible_no_kwargs_in_build_files`. See
    bazelbuild#8021
  - struct.to_proto() converts dict into proto3 text message (map<,>).
  - Android resource conflicts will no longer be reported between a
    strong attr resource and a weak attr resource, if the weak attr
    does not have format specified.
  - Flag `--incompatible_static_name_resolution_in_build_files` is
    added. See bazelbuild#8022
  - Add --incompatible_objc_framework_cleanup to control whether to
    enable some objc framework cleanup that changes the API.
    Specifically, the cleanup changes the objc provider API
    pertaining to frameworks.  This change is expected to be
    transparent to most users unless they write their own Starlark
    rules to handle frameworks.  See
    bazelbuild#7594 for details.
  - Added --incompatible_remove_binary_profile to disable the old
    binary
    profiles. Instead use the JSON profile format:
    https://docs.bazel.build/versions/master/skylark/performance.html#
    json-profile
  - Introducing --execution_log_binary_file and
    --execution_log_json_file that output a stable sorted execution
    log. They will offer a stable replacement to
    --experimental_execution_log_file.
  - Flag `--incompatible_disallow_old_octal_notation` is added. See
    //github.com/bazelbuild/issues/8059
  - Removes the
    --incompatible_disable_genrule_cc_toolchain_dependency flag.
  - Android resource conflicts will no longer be reported between a
    strong attr resource and a weak attr resource, if the weak attr
    does not have format specified.
  - Incompatible flag
    `--incompatible_make_thinlto_command_lines_standalone` has been
    added. See bazelbuild#6791 for
    details.
  - objc_library does not support resource attributes any more.
    Please read bazelbuild#7594 for more info.
  - The `outputs` parameter of the `rule()` function is deprecated
    and attached to flag `--incompatible_no_rule_outputs_param`.
    Migrate rules to use `OutputGroupInfo` or `attr.output` instead.
    See bazelbuild#7977 for more info.
  - New platform_mappings ability to allow gradual flag to
    platforms/toolchains migration. See also
    bazelbuild#6426
  - Added support for compiling against fully qualified R classes
    from aar_import dependencies.
  - --tls_enabled flag is deprecated. Please provide 'grpcs' as a
    scheme in the URLs if TLS should be used for a remote connection.
  - Adds
    incompatible_disallow_rule_execution_platform_constraints_allowed,
     which
    disallows the use of the "execution_platform_constraints_allowed"
    attribute when defining new rules.
  - Flag `--incompatible_restrict_named_params` is added. See
    bazelbuild#8147 for details.
  - The glob function has a new argument `allow_empty`. When set to
    False, the glob fails when it doesn't match anything.
  - Adds the "disable_whole_archive_for_static_lib" feature to allow
    turning off legacy_whole_archive for individual targets.
  - C++ Starlark API for compilation and linking is no longer
    whitelisted
  - Update visibility advice in build-style
  - --incompatible_disable_objc_provider_resources is now enabled by
    default.
  - Fixed an issue where some `py_runtime`s were incompatible with
    using `--build_python_zip` (bazelbuild#5104).
  - The `outputs` parameter of the `rule()` function is deprecated
    and attached to flag `--incompatible_no_rule_outputs_param`.
    Migrate rules to use `OutputGroupInfo` or `attr.output` instead.
    See bazelbuild#7977 for more info.

This release contains contributions from many people at Google, as well as Benjamin Peterson, Brian Topping, clyang82, Dave Lee, George Gensure, Greg Estren, Greg, Guro Bokum, Keith Smiley, Max Vorobev, Michael Hackner, Robert Brown, Robert Sayre, Ryan Beasley, Yannic.
irengrig pushed a commit to irengrig/bazel that referenced this issue Jul 15, 2019
Original change broke //scripts/packages/debian:bazel-debian.deb
This rollforward manually tested to not break that target.

*** Original change description ***

Disable outputs param of rule function

This constitutes an incompatible change guarded by flag --incompatible_no_rule_outputs_param. See bazelbuild#7977 for further details.

Implementation for bazelbuild#7977.

RELNOTES: The `outputs` parameter of the `rule()` function is deprecated and attached to flag `--incompatible_no_rule_outputs_param`. Migrate rules to use `OutputGroupInfo` or `attr.output` instead. See bazelbuild#7977 for more info.
PiperOrigin-RevId: 252063297
@alandonovan
Copy link
Contributor

Chris, could you update the status, and the priority if this is not active work? Thanks.

@c-parsons
Copy link
Contributor Author

Indeed, this has been deprioritized but this bug was not correctly updated to reflect the lower priority. My bad.

I frankly haven't looked at this in quite some time. I think my previous comment is the best summary of this bug.

@c-parsons c-parsons added P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed P1 I'll work on this now. (Assignee required) labels Dec 8, 2020
@camillol
Copy link

camillol commented Jan 17, 2021

As a user of rules, the real problem I have with outputs is that there are outputs I cannot reference directly. Unfortunately, this change risks encouraging this poor behavior exactly where it's most vexing.

The rules that have the greatest need for declaring outputs with patterned names are complex rules that output files of different types (e.g. debug info, source maps, loaders etc.). Because these files have different purposes, it’s important to be able to pick the one you want instead of grabbing the whole bag.

This use case is well-served by rule.outputs: you declare your outputs, name them with patterns, and they are “made available as labels” (user POV: they work).

The change proposed here means that even if rules declare their outputs, they “won’t be made available as labels” (user POV: they’re broken, and I need to use a genrule to make a copy of the file I want, which will then work). To get working outputs rule authors will need to go out of their way and write a macro, which they won’t do until thirty users run into the issue and give up, twenty run into it and hack a workaround, and the fifty-first files a bug, at which point the macro may be added. Rinse and repeat for each new rule.

BTW, I took the user POV here, but in reality I was also the author of the rule I was having an issue with. Both of me agree that we want declared labeled outputs in the rule.

@brandjon
Copy link
Member

Update: We'd still like to remove implicit outputs, but at the moment don't have the bandwidth to reassess the alternatives users would migrate to. We won't actually flip the flag until we have time to address that.

@brandjon brandjon added P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) team-Build-Language and removed P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Starlark labels Feb 17, 2021
@pauldraper
Copy link
Contributor

pauldraper commented Jan 13, 2022

Is it possible to get some more attention on this?

Huge numbers of projects (e.g. rules_docker, rules_nodejs, I believe many others) are using this feature extensively. There's no clear guidance on why it's deprecated or what they should be doing instead.

It's uncomfortable to build lots of code around deprecated behavior, but these projects have found it so useful, they do it anyway.

@aiuto
Copy link
Contributor

aiuto commented Jan 13, 2022

Going back to

The rules that have the greatest need for declaring outputs with patterned names are complex rules that output files of different types (e.g. debug info, source maps, loaders etc.). Because these files have different purposes, it’s important to be able to pick the one you want instead of grabbing the whole bag.

Let's do an example. Let's assume we have a compiler that produces a debug file, but the name should be based on a value we get from the toolchain. We can not know this until Analysis time, so the current outputs functionality does not even work. Let's call that the 'debug' output.

The way I approach this is:

  • calculate the name within the rule implementation (ctx.label.name + '_' + toolchain['fropnitz'] + '.dbg')
  • declare the output with ctx.actions.declare_file
  • name that file by logical name ('debug') in OutputGroupInfo
  • use filegroup(..., output_group = "debug", ...) to turn that slice of the rule output into a usable label.

We have an actual case in rules_pkg. The pkg_deb rule emits the .deb file as the primary output, and the .changes file name is calculated from that. I might right something like:

pkg_deb(name = "deb", ...)

filegroup(
    name = "the_changes_file",
    srcs = [":deb"],
    output_group = "changes",
)

genrule(
    name = "use_changes_file",
    srcs = [":the_changes_file"],
    outs = ["copy_of_changes.txt"],
    cmd = "cp $(location :the_changes_file) $@",
)

This might appear a little clunky, but often the filegroups can be created by a macro wrapper around the rule.

@pauldraper
Copy link
Contributor

pauldraper commented Jan 14, 2022

Output groups work, though they are definitely less ergonomic than implicit outputs.

Let's assume we have a compiler that produces a debug file, but the name should be based on a value we get from the toolchain.

Is that....is that a real example?

In any cases, yes output groups do work, though with a bit more awkwardness.


For context, a real-world example is rules_docker's container_image:

The implicit output targets are:

[name].tar: A full Docker image containing all the layers, identical to what docker save would return. This is only generated on demand.

[name].digest: An image digest that can be used to refer to that image. Unlike tags, digest references are immutable i.e. always refer to the same content.

[name]-layer.tar: A Docker image containing only the layer corresponding to that target. It is used for incremental loading of the layer.

Note: this target is not suitable for direct consumption. It is used for incremental loading and non-docker rules should depend on the Docker image ([name].tar) instead.

[name]: The incremental image loader. It will load only changed layers inside the Docker registry.

https://github.com/bazelbuild/rules_docker/blob/master/docs/container.md#container_image

Using deprecated features, tsk, tsk.

@aiuto
Copy link
Contributor

aiuto commented Jan 14, 2022

Output groups work, though they are definitely less ergonomic than implicit outputs.

Let's assume we have a compiler that produces a debug file, but the name should be based on a value we get from the toolchain.

Is that....is that a real example?

Not the compiler, but the example is real for pkg_deb. The Debian standard for naming packages includes the target hardware architecture, so we have rules that can pick that up and use it to create the name. https://github.com/bazelbuild/rules_pkg/tree/main/examples/naming_package_files

In any cases, yes output groups do work, though with a bit more awkwardness.

True. But OutputGroupInfo solves the problem of names you can not predict until analysis time, so it's a mixed call.

For context, a real-world example is rules_docker's container_image:

The implicit output targets are:
[name].tar: A full Docker image containing all the layers, identical to what docker save would return. This is only generated on demand.
[name].digest: An image digest that can be used to refer to that image. Unlike tags, digest references are immutable i.e. always refer to the same content.
[name]-layer.tar: A Docker image containing only the layer corresponding to that target. It is used for incremental loading of the layer.
Note: this target is not suitable for direct consumption. It is used for incremental loading and non-docker rules should depend on the Docker image ([name].tar) instead.
[name]: The incremental image loader. It will load only changed layers inside the Docker registry.

https://github.com/bazelbuild/rules_docker/blob/master/docs/container.md#container_image

As long as this is just variations on [name], then outputs is eaiser to use. But this also seems like something
you could do with explicit outputs and a macro wrapping the rule to add explicit output attributes for them.
I don't particularly like having to write wapper macros myself, but my objections are mostly about how
they show up in documentation and query output.

Using deprecated features, tsk, tsk.

What deprecated feature?

@pauldraper
Copy link
Contributor

pauldraper commented Jan 17, 2022

What deprecated feature?

Implicit outputs. They are deprecated, noted by both the docs and with the CLI flag.

But they are so useful, rules_docker doesn't care. (Or at least, not enough to change now.)

@aiuto
Copy link
Contributor

aiuto commented Jan 17, 2022

What deprecated feature?

Implicit outputs. They are deprecated, noted by both the docs and with the CLI flag.

But they are so useful, rules_docker doesn't care. (Or at least, not enough to change now.)

The outputs_param is deprecated, but having a rule create implicit outputs with declare is not. :-)
But that is just semantic nitpicking.

No matter what the resolution to this issue is, we need functionality that lets a rule determine (at analysis time) the actual file name which gets created for an output. That is, wrapper macros are insufficient. The outputs param was a first cut at this - but there are claims it adds unwanted complexity in Bazel (I don't have an opinion on that). Putting things in OutputGroupInfo is a more general approach, but it has the annoyance that you need an intermediate filegroup to refer explicitly to any of the outputs declared at run time.

Perhaps we could do something where attr.output had an additional parameter that defined a label template. Maybe `spec: attr.output(label='${name}.spec'). This would declare a new Label bound to that output from the rule. Other targets could depend on the 'name.spec' name in build files. Even better is if we had a ctx.action that could set the actual file name of an output. Sort of a variant of declare_file, but it only resets the name of an already declared output. I don't claim that this is even possible. I'm just trying to work up APIs that solve user problems and relatively easy to understand.

@pauldraper
Copy link
Contributor

I think attr.output(label=) is good.

Though IDK why implicit outputs were deprecated in the first place.

@meteorcloudy meteorcloudy added the migration-ready Incompatible flag is ready for migration with Bazel rolling releases or Bazel@last_green label Aug 31, 2022
@meteorcloudy
Copy link
Member

image

According to https://buildkite.com/bazel/bazelisk-plus-incompatible-flags/builds/1253

This flag is breaking almost all downstream projects, I believe it's the same for the wider community. Also this flag is marked at P4, if no active plan on migrating the ecosystem, I'll remove "migration-ready" label for now.

@meteorcloudy meteorcloudy removed the migration-ready Incompatible flag is ready for migration with Bazel rolling releases or Bazel@last_green label Sep 14, 2022
@brandjon brandjon added untriaged team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts and removed team-Build-Language labels Nov 4, 2022
@comius comius removed the untriaged label Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incompatible-change Incompatible/breaking change P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts type: process
Projects
None yet
Development

No branches or pull requests