blob: 12434a5739b667808a1d1113ae509835d5fee561 [file] [log] [blame] [view]
AndroidX Core Team2e416b22020-12-03 22:58:07 +00001# Versioning
2
3[TOC]
4
AndroidX Core Team21ccf652022-04-01 14:53:07 +00005This page covers Jetpack's usage of Semantic Versioning and pre-release cycles,
6including the expectations at each cycle and criteria for moving to the next
7cycle or SemVer revision.
8
AndroidX Core Team5fa61982023-01-13 10:43:41 -05009## Semantic versioning and binary compatibility {#semver}
AndroidX Core Team2e416b22020-12-03 22:58:07 +000010
alanv5e4feac2022-07-13 09:55:38 -070011Artifacts follow strict [semantic versioning](http://semver.org) for binary
AndroidX Core Team5fa61982023-01-13 10:43:41 -050012compatibility with an added inter-version sequence of pre-release revisions.
13Versions for finalized release artifacts, which are available on
14[Google Maven](https://maven.google.com) will follow the format
alanv5e4feac2022-07-13 09:55:38 -070015`<major>.<minor>.<bugfix>` with an optional `-<alpha|beta|rc><nn>` suffix.
AndroidX Core Team5fa61982023-01-13 10:43:41 -050016Internal or nightly releases, which are available on
17[androidx.dev](http://androidx.dev), use the `-SNAPSHOT` suffix.
alanv5e4feac2022-07-13 09:55:38 -070018
AndroidX Core Team5fa61982023-01-13 10:43:41 -050019### Behavioral and source compatibility {#compat}
alanv5e4feac2022-07-13 09:55:38 -070020
AndroidX Core Team5fa61982023-01-13 10:43:41 -050021Libraries are required to preserve *behavioral compatibility* -- APIs must
22behave as described in their documentation -- across minor versions. Special
23consideration must also be made for changes to undocumented behavior, as
24developers may have made their own assumptions about API contracts based on
25observed behavior.
AndroidX Core Team2e416b22020-12-03 22:58:07 +000026
AndroidX Core Team5fa61982023-01-13 10:43:41 -050027Libraries are strongly encouraged to preserve *source compatibility* across
28minor versions. Strictly requiring source compatibility would require major
29version bumps when implementing quality-of-life improvements such as nullability
30annotations or generics, which would be [disruptive](#major-implications) to the
31library ecosystem.
32
33### Notation {#notation}
AndroidX Core Team5c914c42021-02-08 17:22:57 +000034
35Major (`x.0.0`)
36: An artifact's major version indicates a guaranteed forward-compatibility
AndroidX Core Team21ccf652022-04-01 14:53:07 +000037 window. The number is incremented only when introducing breaking API or
38 behavioral changes.
AndroidX Core Team5c914c42021-02-08 17:22:57 +000039
40Minor (`1.x.0`)
41: Minor indicates compatible public API changes. This number is incremented
AndroidX Core Team21ccf652022-04-01 14:53:07 +000042 when APIs are added, including the addition of
AndroidX Core Team5fa61982023-01-13 10:43:41 -050043 [`@Deprecated` annotations](/company/teams/androidx/api_guidelines/index.md#deprecation-and-removal).
AndroidX Core Team5c914c42021-02-08 17:22:57 +000044 Binary compatibility must be preserved between minor version changes.
45
46Bugfix (`1.0.x`)
47: Bugfix indicates internal changes to address broken behavior. Care should be
48 taken to ensure that existing clients are not broken, including clients that
49 may have been working around long-standing broken behavior.
50
AndroidX Core Team5fa61982023-01-13 10:43:41 -050051#### Pre-release cycles {#prerelease}
AndroidX Core Team5c914c42021-02-08 17:22:57 +000052
alanve048d1c2021-02-11 08:46:57 -080053Alpha (`1.0.0-alphaXX`)
AndroidX Core Team5c914c42021-02-08 17:22:57 +000054: Feature development and API stabilization phase.
55
alanve048d1c2021-02-11 08:46:57 -080056Beta (`1.0.0-betaXX`)
AndroidX Core Team21ccf652022-04-01 14:53:07 +000057: Functional stabilization phase. Suitable for production use.
AndroidX Core Team5c914c42021-02-08 17:22:57 +000058
alanve048d1c2021-02-11 08:46:57 -080059RC (`1.0.0-rcXX`)
AndroidX Core Team5c914c42021-02-08 17:22:57 +000060: Verification phase.
61
62Stable (no-suffix)
AndroidX Core Team21ccf652022-04-01 14:53:07 +000063: Recommended for production use.
AndroidX Core Team5c914c42021-02-08 17:22:57 +000064
AndroidX Core Team2e416b22020-12-03 22:58:07 +000065### Major (`x.0.0`) {#major}
66
67An artifact's major version indicates a guaranteed forward-compatibility window.
68For example, a developer could update an artifact versioned `2.0.0` to `2.7.3`
alanve048d1c2021-02-11 08:46:57 -080069without taking any additional action; however, updating from `2.7.3` to `3.0.0`
70may require a complete rewrite of their application or cause conflicts with
AndroidX Core Team21ccf652022-04-01 14:53:07 +000071their dependencies. Major version bumps are
72[strongly discouraged](#major-implications).
AndroidX Core Team2e416b22020-12-03 22:58:07 +000073
alanve54cc242021-02-11 13:49:33 -080074#### When to increment {#major-when}
AndroidX Core Team2e416b22020-12-03 22:58:07 +000075
76An artifact *must* increment its major version number in response to breaking
alanv5e4feac2022-07-13 09:55:38 -070077changes in binary or behavioral compatibility within the library itself *or* in
AndroidX Core Team2e416b22020-12-03 22:58:07 +000078response to breaking changes within a dependency.
79
80For example, if an artifact updates a SemVer-type dependency from `1.0.0` to
81`2.0.0` then the artifact must also bump its own major version number.
82
83An artifact *may in rare cases* increment its major version number to indicate
84an important but non-breaking change in the library. Note, however, that the
85SemVer implications of incrementing the major version are the same as a breaking
alanv5e4feac2022-07-13 09:55:38 -070086change -- dependent projects *must* assume the major version change is breaking
AndroidX Core Team2e416b22020-12-03 22:58:07 +000087and update their dependency specifications.
88
alanve54cc242021-02-11 13:49:33 -080089#### Ecosystem implications {#major-implications}
AndroidX Core Team2e416b22020-12-03 22:58:07 +000090
alanv5e4feac2022-07-13 09:55:38 -070091When an artifact increases its major version, *all* artifacts that depended on
AndroidX Core Team2e416b22020-12-03 22:58:07 +000092the previous major version are no longer considered compatible and must
93explicitly migrate to depend on the new major version.
94
95As a result, if the library ecosystem is slow to adopt a new major version of an
96artifact then developers may end up in a situation where they cannot update an
97artifact because they depend on a library that has not yet adopted the new major
98version.
99
100For this reason, we *strongly* recommend against increasing the major version of
101a “core” artifact that is depended upon by other libraries. “Leaf” artifacts --
102those that apps depend upon directly and are not used by other libraries -- have
103a much easier time increasing their major version.
104
alanve54cc242021-02-11 13:49:33 -0800105#### Process requirements {#major-process}
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000106
107If the artifact has dependencies within Jetpack, owners *must* complete the
108assessment before implementing any breaking changes to binary or behavioral
109compatibility.
110
111Otherwise, owners are *strongly recommended* to complete the assessment before
112implementing any breaking changes to binary or behavioral compatibility, as such
113changes may negatively impact downstream clients in Android git or Google's
114repository. These clients are not part of our pre-submit workflow, but filling
115out the assessment will provide insight into how they will be affected by a
116major version change.
117
118### Minor (`1.x.0`) {#minor}
119
120Minor indicates compatible public API changes. This number is incremented when
121APIs are added, including the addition of `@Deprecated` annotations. Binary
122compatibility must be preserved between minor version changes.
123
124#### Moving between minor versions:
125
126* A change in the minor revision indicates the addition of binary-compatible
127 APIs. Libraries **must** increment their minor revision when adding APIs.
128 Dependent libraries are not required to update their minimum required
129 version unless they depend on newly-added APIs.
130
131### Bugfix (`1.0.x`) {#bugfix}
132
133Bugfix indicates internal changes to address broken behavior. Care should be
134taken to ensure that existing clients are not broken, including clients that may
135have been working around long-standing broken behavior.
136
137#### Moving between bugfix versions:
138
139* A change in the bugfix revision indicates changes in behavior to fix bugs.
140 The API surface does not change. Changes to the bugfix version may *only*
141 occur in a release branch. The bugfix revision must always be `.0` in a
142 development branch.
143
144### Pre-release suffixes {#pre-release-suffix}
145
146The pre-release suffix indicates stability and feature completeness of a
147release. A typical release will begin as alpha, move to beta after acting on
148feedback from internal and external clients, move to release candidate for final
149verification, and ultimately move to a finalized build.
150
151Alpha, beta, and release candidate releases are versioned sequentially using a
152leading zero (ex. alpha01, beta11, rc01) for compatibility with the
153lexicographic ordering of versions used by SemVer.
154
155### Snapshot {#snapshot}
156
157Snapshot releases are whatever exists at tip-of-tree. They are only subject to
158the constraints placed on the average commit. Depending on when it's cut, a
alanv5e4feac2022-07-13 09:55:38 -0700159snapshot may even be binary-identical to an `alpha`, `beta`, or `stable`
160release.
161
162### Tooling guarantees
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000163
164Versioning policies are enforced by the following Gradle tasks:
165
166`checkApi`: ensures that changes to public API are intentional and tracked,
alanv5e4feac2022-07-13 09:55:38 -0700167asking the developer to explicitly run `updateApi` (see below) if any changes
168are detected
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000169
170`checkApiRelease`: verifies that API changes between previously released and
171currently under-development versions conform to semantic versioning guarantees
172
173`updateApi`: commits API changes to source control in such a way that they can
174be reviewed in pre-submit via Gerrit API+1 and reviewed in post-submit by API
175Council
176
177`SNAPSHOT`: is automatically added to the version string for all builds that
178occur outside the build server for release branches (ex. ub-androidx-release).
179Local release builds may be forced by passing -Prelease to the Gradle command
180line.
181
182## Picking the right version {#picking-the-right-version}
183
alanv5e4feac2022-07-13 09:55:38 -0700184Libraries follow [semantic versioning](https://semver.org), which means that the
185version code is strongly tied to the API surface. A full version consists of
186revision numbers for major, minor, and bugfix as well as a pre-release stage and
187revision. Correct versioning is, for the most part, automatically enforced;
188however, please check for the following:
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000189
190### Initial version {#initial-version}
191
192If your library is brand new, your version should start at 1.0.0, e.g.
193`1.0.0-alpha01`.
194
195The initial release within a new version always starts at `alpha01`. Note the
196two-digit revision code, which allows us to do up to 99 revisions within a
197pre-release stage.
198
199### Pre-release stages
200
201A single version will typically move through several revisions within each of
202the pre-release stages: alpha, beta, rc, and stable. Subsequent revisions within
203a stage (ex. alpha, beta) are incremented by 1, ex. `alpha01` is followed by
204`alpha02` with no gaps.
205
206### Moving between pre-release stages and revisions
207
208Libraries are expected to go through a number of pre-release stages within a
209version prior to release, with stricter requirements at each stage to ensure a
210high-quality stable release. The owner for a library should typically submit a
211CL to update the stage or revision when they are ready to perform a public
212release.
213
alanv5e4feac2022-07-13 09:55:38 -0700214Libraries are expected to allow >= 2 weeks per pre-release stage. This "soaking
215period" gives developers time to try each version, find bugs, and ensure a
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000216quality stable release. Therefore, at minimum:
217
218- An `alpha` version must be publically available for 2 weeks before releasing
219 a public `beta`
220- A `beta` version must be publically available for 2 weeks before releasing
221 an public `rc`
AndroidX Core Team39791e52021-06-01 06:53:20 -0700222- A `rc` version must be publically available for 2 weeks before releasing a
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000223 public stable version
224
225Your library must meet the following criteria to move your public release to
226each stage:
227
228### Alpha {#alpha}
229
230Alpha releases are expected to be functionally stable, but may have unstable API
231surface or incomplete features. Typically, alphas have not gone through API
232Council review but are expected to have performed a minimum level of validation.
233
234#### Within the `alphaXX` cycle
235
236* API surface
237 * Prior to `alpha01` release, API tracking **must** be enabled (either
238 `publish=true` or create an `api` directory) and remain enabled
239 * May add/remove APIs within `alpha` cycle, but deprecate/remove cycle is
240 strongly recommended.
AndroidX Core Team5fa61982023-01-13 10:43:41 -0500241 * May use
242 [experimental APIs](/company/teams/androidx/api_guidelines/index.md#experimental-api)
243 across same-version group boundaries
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000244* Testing
245 * All changes **should** be accompanied by a `Test:` stanza
246 * All pre-submit and post-submit tests are passing
247 * Flaky or failing tests **must** be suppressed or fixed within one day
248 (if affecting pre-submit) or three days (if affecting post-submit)
249
250### Beta {#beta}
251
252Beta releases are ready for production use but may contain bugs. They are
253expected to be functionally stable and have highly-stable, feature-complete API
alanve048d1c2021-02-11 08:46:57 -0800254surface. All APIs should have been reviewed by API Council at this stage. Tests
255should have 100% coverage of public API surface and translations must be 100%
256complete.
257
258While beta represents API Freeze, it does not necessarily mean APIs are locked
259down permanently. A limited number of exceptions may be granted by API Council
260in cases where ship-blocking mistakes or significant user experience issues can
261be addressed with minimal changes to the API surface. Exceptions **will not** be
262granted for new features, non-trivial API changes, significant refactorings, or
263any changes likely to introduce additional functional instability. Requests for
264exceptions **must** be accompanied by a justification explaining why the change
AndroidX Core Team0db91f02021-05-06 22:45:18 +0000265cannot be made in a future minor version. This policy does not apply to
266additions of `@Experimental` APIs or changes to `@Experimental` APIs.
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000267
AndroidX Core Teamee9c1aa2021-04-06 17:29:05 +0000268#### Checklist for moving to `beta01` {#beta-checklist}
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000269
270* API surface
271 * Entire API surface has been reviewed by API Council
272 * All APIs from alpha undergoing deprecate/remove cycle must be removed
alanv5e4feac2022-07-13 09:55:38 -0700273 * The final removal of a `@Deprecated` API should occur in alpha, not
274 in beta
AndroidX Core Team5fa61982023-01-13 10:43:41 -0500275 * Must not use
276 [experimental APIs](/company/teams/androidx/api_guidelines#experimental-api)
alanv5e4feac2022-07-13 09:55:38 -0700277 across same-version group boundaries
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000278* Testing
279 * All public APIs are tested
280 * All pre-submit and post-submit tests are enabled (e.g. all suppressions
281 are removed) and passing
alanv5e4feac2022-07-13 09:55:38 -0700282* Use of experimental Kotlin features (e.g. `@OptIn`) must be audited for
283 stability
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000284* All dependencies are `beta`, `rc`, or stable
285* Be able to answer the question "How will developers test their apps against
286 your library?"
287 * Ideally, this is an integration app with automated tests that cover the
288 main features of the library and/or a `-testing` artifact as seen in
289 other Jetpack libraries
290
291#### Within the `betaXX` cycle
292
293* API surface
alanve54cc242021-02-11 13:49:33 -0800294 * May not add, remove, or change APIs unless granted an exception by API
295 Council following the beta API change exception request process
AndroidX Core Team0db91f02021-05-06 22:45:18 +0000296 * Must go through the full `@Deprecate` and hard-removal cycle in
297 separate `beta` releases for any exception-approved API removals or
298 changes
alanv5e4feac2022-07-13 09:55:38 -0700299 * May not remove `@RequiresOptIn` annotations from experimental APIs, as
300 this would amount to an API addition
301 * **May** add new `@RequiresOptIn` APIs and change existing experimental
AndroidX Core Team0db91f02021-05-06 22:45:18 +0000302 APIs
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000303
304### RC {#rc}
305
306Release candidates are expected to be nearly-identical to the final release, but
307may contain critical last-minute fixes for issues found during integration
308testing.
309
310#### Checklist for moving to `rc01`
311
312* All previous checklists still apply
313* Release branch, e.g. `androidx-<group_id>-release`, is created
314* API surface
315 * Any API changes from `beta` cycle are reviewed by API Council
alanv5e4feac2022-07-13 09:55:38 -0700316* No **known** `P0` or `P1` (ship-blocking) issues
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000317* All dependencies are `rc` or stable
318
319#### Within the `rcXX` cycle
320
321* Ship-blocking bug fixes only
322* All changes must have corresponding tests
323* No API changes allowed
324
325### Stable {#stable}
326
327Final releases are well-tested, both by internal tests and external clients, and
328their API surface is reviewed and finalized. While APIs may be deprecated and
329removed in future versions, any APIs added at this stage must remain for at
330least a year.
331
332#### Checklist for moving to stable
333
334* Identical to a previously released `rcXX` (note that this means any bugs
335 that result in a new release candidate will necessarily delay your stable
336 release by a minimum of two weeks)
337* No changes of any kind allowed
338* All dependencies are stable
339
340## Updating your version {#update}
341
342A few notes about version updates:
343
AndroidX Core Team408c27b2020-12-15 15:57:00 +0000344- The version of your library listed in `androidx-main` should *always* be
345 higher than the version publically available on Google Maven. This allows us
346 to do proper version tracking and API tracking.
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000347- Version increments must be done before the CL cutoff date (aka the build cut
348 date).
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000349- **Increments to the next stability suffix** (like `alpha` to `beta`) should
AndroidX Core Team5fa61982023-01-13 10:43:41 -0500350 be handled by the library owner, with the Jetpack TPM (natnaelbelay@) CC'd
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000351 for API+1.
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000352- Version increments in release branches will need to follow the guide
AndroidX Core Team5fa61982023-01-13 10:43:41 -0500353 [How to update your version on a release branch](/company/teams/androidx/release_branches.md#update-your-version)
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000354- When you're ready for `rc01`, the increment to `rc01` should be done in
AndroidX Core Team408c27b2020-12-15 15:57:00 +0000355 `androidx-main` and then your release branch should be snapped to that
AndroidX Core Team5fa61982023-01-13 10:43:41 -0500356 build. See the guide
357 [Snap your release branch](/company/teams/androidx/release_branches.md#snap)
358 on how to do this. After the release branch is snapped to that build, you
359 will need to update your version in `androidx-main` to `alpha01` of the next
AndroidX Core Team408c27b2020-12-15 15:57:00 +0000360 minor (or major) version.
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000361
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000362### How to update your version
363
AndroidX Core Team179f25b2022-02-04 15:20:48 -08003641. Update the version listed in `frameworks/support/libraryversions.toml`
AndroidX Core Team95cd3da2021-01-14 11:47:43 -05003651. If your library is a `beta` or `rc01` version, run `./gradlew
366 <your-lib>:updateApi`. This will create an API txt file for the new version
AndroidX Core Team21ccf652022-04-01 14:53:07 +0000367 of your library. For other versions, this step is not required
AndroidX Core Team2e416b22020-12-03 22:58:07 +00003681. Verify changes with `./gradlew checkApi verifyDependencyVersions`.
3691. Commit these change as one commit.
3701. Upload these changes to Gerrit for review.
371
372An example of a version bump can be found here:
373[aosp/833800](https://android-review.googlesource.com/c/platform/frameworks/support/+/833800)
374
375## `-ktx` Modules {#ktx}
376
AndroidX Core Team5fa61982023-01-13 10:43:41 -0500377[Kotlin extension libraries](/company/teams/androidx/api_guidelines/index.md#module-ktx)
378(`-ktx`) follow the same versioning requirements as other libraries, but with
379one exception: they must match the version of the Java libraries that they
380extend.
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000381
AndroidX Core Team21ccf652022-04-01 14:53:07 +0000382For example, let's say you are developing a Java library
383`androidx.foo:foo-bar:1.1.0-alpha01` and you want to add a Kotlin extension
384library `androidx.foo:foo-bar-ktx`. Your new `androidx.foo:foo-bar-ktx` library
385will start at version `1.1.0-alpha01` instead of `1.0.0-alpha01`.
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000386
387If your `androidx.foo:foo-bar` module was in version `1.0.0-alpha06`, then the
AndroidX Core Team21ccf652022-04-01 14:53:07 +0000388Kotlin extension module would start in version `1.0.0-alpha06`.
alanv842f5e02022-10-11 07:25:45 -0700389
390## FAQ
391
392### When does an alpha ship?
393
394For public releases, an alpha ships when the library lead believes it is ready.
395Generally, these occur during the batched bi-weekly (every 2 weeks) release
396because all tip-of-tree dependencies will need to be released too.
397
alanv842f5e02022-10-11 07:25:45 -0700398### Can alpha work (ex. for the next Minor release) occur in the primary development branch during beta API lockdown?
399
400No. This is by design. Focus should be spent on improving the Beta version and
401adding documentation/samples/blog posts for usage!
402
403### Is there an API freeze window between alpha and beta while API surface is reviewed and tests are added, but before the beta is released?
404
405Yes. If any new APIs are added in this window, the beta release will be blocked
406until API review is complete and addressed.
407
408### How often can a beta release?
409
AndroidX Core Team5fa61982023-01-13 10:43:41 -0500410As often as needed; however, releases outside of the bi-weekly (every 2 weeks)
alanv842f5e02022-10-11 07:25:45 -0700411release will need to get approval from the TPM (natnaelbelay@).