blob: 6161974ea55609023885dc9121b42a9a77d51831 [file] [log] [blame] [view]
Dmitry Lomov356ad222019-01-17 22:48:57 -08001---
2layout: documentation
Greg Estrenc0816752020-02-20 13:04:29 -08003title: Backward compatibility
daroberts223aebd2021-02-18 17:53:30 -08004category: getting-started
Dmitry Lomov356ad222019-01-17 22:48:57 -08005---
6
Googler458daaa2021-01-08 18:55:00 -08007# Backward Compatibility
Dmitry Lomov356ad222019-01-17 22:48:57 -08008
Googlercb395cb2020-12-21 10:33:20 -08009This page provides information on how to handle backward compatibility,
10including migration requirements and how to communicate incompatible changes.
11It also covers policy information and guidelines to follow these policies.
12
13Bazel is evolving, and changes will be made to Bazel that at times will be
Dmitry Lomov356ad222019-01-17 22:48:57 -080014incompatible and require some changes from Bazel users.
15
16## GitHub labels
17
18* All incompatible changes: label [**incompatible-change**](https://github.com/bazelbuild/bazel/issues?q=label%3Aincompatible-change)
19* Expected breaking change in release X.Y: label **breaking-change-X.Y** (for example: [**breaking-change-0.21**](https://github.com/bazelbuild/bazel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3Abreaking-change-0.21))
20* Release X.Y is in a migration window: label **migration-X.Y** (for example: [**migration-0.21**](https://github.com/bazelbuild/bazel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3Amigration-0.21))
21
Dmitry Lomov369fa972019-05-31 08:32:17 -070022
Dmitry Lomov356ad222019-01-17 22:48:57 -080023## At a glance
24
251. Every breaking change is guarded with an `--incompatible_*` flag.
261. Newly introduced incompatible flags default to off.
Googlera1a29ec2021-02-26 12:19:25 -0800271. For every `--incompatible_*` flag, there is a GitHub issue that explains
Dmitry Lomov356ad222019-01-17 22:48:57 -080028 the change in behavior and provides a migration recipe.
291. The migration window is at least one release long and is set by the author of the incompatible change.
Dmitry Lomov356ad222019-01-17 22:48:57 -0800301. APIs and behavior guarded by an `--experimental_*` flag can change at any time.
311. Users should never run their production builds with `--experimental_*` or `--incompatible_*` flags.
32
Greg Estrene821cfa2020-02-20 09:34:56 -080033## How to follow this policy
Dmitry Lomov369fa972019-05-31 08:32:17 -070034
Greg Estrene821cfa2020-02-20 09:34:56 -080035* [For Bazel users - how to update
Dmitry Lomov4285b4b2019-07-30 15:10:38 -070036 Bazel](updating-bazel.html)
Klaus Aehlig620d21c2019-06-18 05:23:05 -070037* [For contributors - best practices for incompatible changes](https://bazel.build/breaking-changes-guide.html)
Dmitry Lomov369fa972019-05-31 08:32:17 -070038* <a href='https://github.com/bazelbuild/continuous-integration/tree/master/docs/release-playbook.%6D%64'>For release managers - how to update issue labels and release</a>
39
40
Dmitry Lomov356ad222019-01-17 22:48:57 -080041## What is stable functionality?
42
Googlera1a29ec2021-02-26 12:19:25 -080043In general, APIs or behaviors without `--experimental_...` flags are considered
44stable, supported features in Bazel.
45
Dmitry Lomov356ad222019-01-17 22:48:57 -080046This includes:
47
48* Starlark language and APIs
49* Rules bundled with Bazel
50* Bazel APIs such as Remote Execution APIs or Build Event Protocol
51* Flags and their semantics
52
53## Incompatible changes and migration recipes
54
Googlera1a29ec2021-02-26 12:19:25 -080055When a release contains an incompatible change, the Bazel team provides
56_migration windows_ and _migration recipes_ to make it easier for Bazel users
57to update their code.
Dmitry Lomov356ad222019-01-17 22:48:57 -080058
59Migration window is one or more release of Bazel during which a migration from
60old functionality to new functionality is possible, according to a migration
61recipe.
62
Googlera1a29ec2021-02-26 12:19:25 -080063During the migration window, both the old and new functionality
64are available in the Bazel release. For every incompatible change, a
65_migration recipe_ is provided that allows updating the user code
66(`BUILD` and `.bzl` files, as well as any Bazel usage in scripts,
67usage of Bazel API, and so on) in such a way that **it works simultaneously
68without any flags with old and new functionality**.
Dmitry Lomov356ad222019-01-17 22:48:57 -080069
70In other words, during a migration window for an incompatible change `foo`:
71
721. `--incompatible_foo` flag is available in Bazel release and defaults to off.
731. User code can be updated in such a way that it works simultaneously with
74 that flag being on or off.
751. After the code is migrated, the users can check whether they migrated
76 successfully by building with `--incompatible_foo=true`. However, their
77 code will continue to work in the same release in default state (where
Greg9b496e62019-02-25 11:51:27 -080078 `--incompatible_foo` is off), as well after the migration window is over
Dmitry Lomov356ad222019-01-17 22:48:57 -080079 (at which point the flag will be effectively on).
80
81## Communicating incompatible changes
82
83The primary source of information about incompatible changes are GitHub issues
84marked with an ["incompatible-change" label](https://github.com/bazelbuild/bazel/issues?q=label%3Aincompatible-change).
85
86For every incompatible change, the issue specifies the following:
87* Name of the flag controlling the incompatible change
88* Description of the changed functionality
89* Migration recipe
90
91The incompatible change issue is closed when the incompatible flag is flipped at
92HEAD.
93
Mike Fouriecd7cd6b2019-03-08 13:28:29 -080094All the incompatible changes for which a Bazel release X.Y is part of a
Dmitry Lomov356ad222019-01-17 22:48:57 -080095migration window are marked with a label "migration-X.Y" label (for example
96[migration-0.21](https://github.com/bazelbuild/bazel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3Amigration-0.21)).
97
98All the incompatible changes that are expected to happen in release X.Y
99are marked with a label "breaking-change-X.Y" (for example
100[breaking-change-0.21](https://github.com/bazelbuild/bazel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3Abreaking-change-0.21)).
101
102
Dmitry Lomov369fa972019-05-31 08:32:17 -0700103