blob: b54025f1977240a6e8d41f32d569c5cdbf47c6df [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
alanve54cc242021-02-11 13:49:33 -08009## Semantic versioning
AndroidX Core Team2e416b22020-12-03 22:58:07 +000010
AndroidX Core Team21ccf652022-04-01 14:53:07 +000011Artifacts follow strict [semantic versioning](http://semver.org) with an added
12inter-version sequence of pre-release revisions. The version for a finalized
13release will follow the format `<major>.<minor>.<bugfix>` with an optional
14`-<alpha|beta|rc><nn>` suffix. Internal or nightly releases (via
15[androidx.dev](http://androidx.dev)) should use the `-SNAPSHOT` suffix.
AndroidX Core Team2e416b22020-12-03 22:58:07 +000016
alanve048d1c2021-02-11 08:46:57 -080017### Notation
AndroidX Core Team5c914c42021-02-08 17:22:57 +000018
19Major (`x.0.0`)
20: An artifact's major version indicates a guaranteed forward-compatibility
AndroidX Core Team21ccf652022-04-01 14:53:07 +000021 window. The number is incremented only when introducing breaking API or
22 behavioral changes.
AndroidX Core Team5c914c42021-02-08 17:22:57 +000023
24Minor (`1.x.0`)
25: Minor indicates compatible public API changes. This number is incremented
AndroidX Core Team21ccf652022-04-01 14:53:07 +000026 when APIs are added, including the addition of
27 [`@Deprecated` annotations](api_guidelines.md#deprecation-and-removal).
AndroidX Core Team5c914c42021-02-08 17:22:57 +000028 Binary compatibility must be preserved between minor version changes.
29
30Bugfix (`1.0.x`)
31: Bugfix indicates internal changes to address broken behavior. Care should be
32 taken to ensure that existing clients are not broken, including clients that
33 may have been working around long-standing broken behavior.
34
alanve048d1c2021-02-11 08:46:57 -080035#### Pre-release cycles
AndroidX Core Team5c914c42021-02-08 17:22:57 +000036
alanve048d1c2021-02-11 08:46:57 -080037Alpha (`1.0.0-alphaXX`)
AndroidX Core Team5c914c42021-02-08 17:22:57 +000038: Feature development and API stabilization phase.
39
alanve048d1c2021-02-11 08:46:57 -080040Beta (`1.0.0-betaXX`)
AndroidX Core Team21ccf652022-04-01 14:53:07 +000041: Functional stabilization phase. Suitable for production use.
AndroidX Core Team5c914c42021-02-08 17:22:57 +000042
alanve048d1c2021-02-11 08:46:57 -080043RC (`1.0.0-rcXX`)
AndroidX Core Team5c914c42021-02-08 17:22:57 +000044: Verification phase.
45
46Stable (no-suffix)
AndroidX Core Team21ccf652022-04-01 14:53:07 +000047: Recommended for production use.
AndroidX Core Team5c914c42021-02-08 17:22:57 +000048
AndroidX Core Team2e416b22020-12-03 22:58:07 +000049### Major (`x.0.0`) {#major}
50
51An artifact's major version indicates a guaranteed forward-compatibility window.
52For example, a developer could update an artifact versioned `2.0.0` to `2.7.3`
alanve048d1c2021-02-11 08:46:57 -080053without taking any additional action; however, updating from `2.7.3` to `3.0.0`
54may require a complete rewrite of their application or cause conflicts with
AndroidX Core Team21ccf652022-04-01 14:53:07 +000055their dependencies. Major version bumps are
56[strongly discouraged](#major-implications).
AndroidX Core Team2e416b22020-12-03 22:58:07 +000057
alanve54cc242021-02-11 13:49:33 -080058#### When to increment {#major-when}
AndroidX Core Team2e416b22020-12-03 22:58:07 +000059
60An artifact *must* increment its major version number in response to breaking
61changes in binary or behavioral compatibility within the library itself _or_ in
62response to breaking changes within a dependency.
63
64For example, if an artifact updates a SemVer-type dependency from `1.0.0` to
65`2.0.0` then the artifact must also bump its own major version number.
66
67An artifact *may in rare cases* increment its major version number to indicate
68an important but non-breaking change in the library. Note, however, that the
69SemVer implications of incrementing the major version are the same as a breaking
70change -- dependent projects _must_ assume the major version change is breaking
71and update their dependency specifications.
72
alanve54cc242021-02-11 13:49:33 -080073#### Ecosystem implications {#major-implications}
AndroidX Core Team2e416b22020-12-03 22:58:07 +000074
75When an artifact increases its major version, _all_ artifacts that depended on
76the previous major version are no longer considered compatible and must
77explicitly migrate to depend on the new major version.
78
79As a result, if the library ecosystem is slow to adopt a new major version of an
80artifact then developers may end up in a situation where they cannot update an
81artifact because they depend on a library that has not yet adopted the new major
82version.
83
84For this reason, we *strongly* recommend against increasing the major version of
85a “core” artifact that is depended upon by other libraries. “Leaf” artifacts --
86those that apps depend upon directly and are not used by other libraries -- have
87a much easier time increasing their major version.
88
alanve54cc242021-02-11 13:49:33 -080089#### Process requirements {#major-process}
AndroidX Core Team2e416b22020-12-03 22:58:07 +000090
91If the artifact has dependencies within Jetpack, owners *must* complete the
92assessment before implementing any breaking changes to binary or behavioral
93compatibility.
94
95Otherwise, owners are *strongly recommended* to complete the assessment before
96implementing any breaking changes to binary or behavioral compatibility, as such
97changes may negatively impact downstream clients in Android git or Google's
98repository. These clients are not part of our pre-submit workflow, but filling
99out the assessment will provide insight into how they will be affected by a
100major version change.
101
102### Minor (`1.x.0`) {#minor}
103
104Minor indicates compatible public API changes. This number is incremented when
105APIs are added, including the addition of `@Deprecated` annotations. Binary
106compatibility must be preserved between minor version changes.
107
108#### Moving between minor versions:
109
110* A change in the minor revision indicates the addition of binary-compatible
111 APIs. Libraries **must** increment their minor revision when adding APIs.
112 Dependent libraries are not required to update their minimum required
113 version unless they depend on newly-added APIs.
114
115### Bugfix (`1.0.x`) {#bugfix}
116
117Bugfix indicates internal changes to address broken behavior. Care should be
118taken to ensure that existing clients are not broken, including clients that may
119have been working around long-standing broken behavior.
120
121#### Moving between bugfix versions:
122
123* A change in the bugfix revision indicates changes in behavior to fix bugs.
124 The API surface does not change. Changes to the bugfix version may *only*
125 occur in a release branch. The bugfix revision must always be `.0` in a
126 development branch.
127
128### Pre-release suffixes {#pre-release-suffix}
129
130The pre-release suffix indicates stability and feature completeness of a
131release. A typical release will begin as alpha, move to beta after acting on
132feedback from internal and external clients, move to release candidate for final
133verification, and ultimately move to a finalized build.
134
135Alpha, beta, and release candidate releases are versioned sequentially using a
136leading zero (ex. alpha01, beta11, rc01) for compatibility with the
137lexicographic ordering of versions used by SemVer.
138
139### Snapshot {#snapshot}
140
141Snapshot releases are whatever exists at tip-of-tree. They are only subject to
142the constraints placed on the average commit. Depending on when it's cut, a
143snapshot may even be binary-identical to an alpha, beta, or stable release.
144
145Versioning policies are enforced by the following Gradle tasks:
146
147`checkApi`: ensures that changes to public API are intentional and tracked,
148asking the developer to explicitly run updateApi (see below) if any changes are
149detected
150
151`checkApiRelease`: verifies that API changes between previously released and
152currently under-development versions conform to semantic versioning guarantees
153
154`updateApi`: commits API changes to source control in such a way that they can
155be reviewed in pre-submit via Gerrit API+1 and reviewed in post-submit by API
156Council
157
158`SNAPSHOT`: is automatically added to the version string for all builds that
159occur outside the build server for release branches (ex. ub-androidx-release).
160Local release builds may be forced by passing -Prelease to the Gradle command
161line.
162
163## Picking the right version {#picking-the-right-version}
164
165AndroidX follows [Strict Semantic Versioning](https://semver.org), which means
166that the version code is strongly tied to the API surface. A full version
167consists of revision numbers for major, minor, and bugfix as well as a
168pre-release stage and revision. Correct versioning is, for the most part,
169automatically enforced; however, please check for the following:
170
171### Initial version {#initial-version}
172
173If your library is brand new, your version should start at 1.0.0, e.g.
174`1.0.0-alpha01`.
175
176The initial release within a new version always starts at `alpha01`. Note the
177two-digit revision code, which allows us to do up to 99 revisions within a
178pre-release stage.
179
180### Pre-release stages
181
182A single version will typically move through several revisions within each of
183the pre-release stages: alpha, beta, rc, and stable. Subsequent revisions within
184a stage (ex. alpha, beta) are incremented by 1, ex. `alpha01` is followed by
185`alpha02` with no gaps.
186
187### Moving between pre-release stages and revisions
188
189Libraries are expected to go through a number of pre-release stages within a
190version prior to release, with stricter requirements at each stage to ensure a
191high-quality stable release. The owner for a library should typically submit a
192CL to update the stage or revision when they are ready to perform a public
193release.
194
195Libraries are expected to allow >= 2 weeks per pre-release stage. This 'soaking
196period' gives developers time to try/use each version, find bugs, and ensure a
197quality stable release. Therefore, at minimum:
198
199- An `alpha` version must be publically available for 2 weeks before releasing
200 a public `beta`
201- A `beta` version must be publically available for 2 weeks before releasing
202 an public `rc`
AndroidX Core Team39791e52021-06-01 06:53:20 -0700203- A `rc` version must be publically available for 2 weeks before releasing a
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000204 public stable version
205
206Your library must meet the following criteria to move your public release to
207each stage:
208
209### Alpha {#alpha}
210
211Alpha releases are expected to be functionally stable, but may have unstable API
212surface or incomplete features. Typically, alphas have not gone through API
213Council review but are expected to have performed a minimum level of validation.
214
215#### Within the `alphaXX` cycle
216
217* API surface
218 * Prior to `alpha01` release, API tracking **must** be enabled (either
219 `publish=true` or create an `api` directory) and remain enabled
220 * May add/remove APIs within `alpha` cycle, but deprecate/remove cycle is
221 strongly recommended.
222* Testing
223 * All changes **should** be accompanied by a `Test:` stanza
224 * All pre-submit and post-submit tests are passing
225 * Flaky or failing tests **must** be suppressed or fixed within one day
226 (if affecting pre-submit) or three days (if affecting post-submit)
227
228### Beta {#beta}
229
230Beta releases are ready for production use but may contain bugs. They are
231expected to be functionally stable and have highly-stable, feature-complete API
alanve048d1c2021-02-11 08:46:57 -0800232surface. All APIs should have been reviewed by API Council at this stage. Tests
233should have 100% coverage of public API surface and translations must be 100%
234complete.
235
236While beta represents API Freeze, it does not necessarily mean APIs are locked
237down permanently. A limited number of exceptions may be granted by API Council
238in cases where ship-blocking mistakes or significant user experience issues can
239be addressed with minimal changes to the API surface. Exceptions **will not** be
240granted for new features, non-trivial API changes, significant refactorings, or
241any changes likely to introduce additional functional instability. Requests for
242exceptions **must** be accompanied by a justification explaining why the change
AndroidX Core Team0db91f02021-05-06 22:45:18 +0000243cannot be made in a future minor version. This policy does not apply to
244additions of `@Experimental` APIs or changes to `@Experimental` APIs.
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000245
AndroidX Core Teamee9c1aa2021-04-06 17:29:05 +0000246#### Checklist for moving to `beta01` {#beta-checklist}
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000247
248* API surface
249 * Entire API surface has been reviewed by API Council
250 * All APIs from alpha undergoing deprecate/remove cycle must be removed
AndroidX Core Team0db91f02021-05-06 22:45:18 +0000251 * The final removal of a `@Deprecated` API must occur in alpha, not in
252 Beta.
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000253* Testing
254 * All public APIs are tested
255 * All pre-submit and post-submit tests are enabled (e.g. all suppressions
256 are removed) and passing
257 * Your library passes `./gradlew library:checkReleaseReady`
258* No experimental features (e.g. `@UseExperimental`) may be used
259* All dependencies are `beta`, `rc`, or stable
260* Be able to answer the question "How will developers test their apps against
261 your library?"
262 * Ideally, this is an integration app with automated tests that cover the
263 main features of the library and/or a `-testing` artifact as seen in
264 other Jetpack libraries
265
266#### Within the `betaXX` cycle
267
268* API surface
alanve54cc242021-02-11 13:49:33 -0800269 * May not add, remove, or change APIs unless granted an exception by API
270 Council following the beta API change exception request process
AndroidX Core Team0db91f02021-05-06 22:45:18 +0000271 * Must go through the full `@Deprecate` and hard-removal cycle in
272 separate `beta` releases for any exception-approved API removals or
273 changes
274 * May not remove `@Experimental` from experimental APIs, as this would
275 amount to an API addition
276 * **May** add new `@Experimental` APIs and change existing `@Experimental`
277 APIs
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000278
279### RC {#rc}
280
281Release candidates are expected to be nearly-identical to the final release, but
282may contain critical last-minute fixes for issues found during integration
283testing.
284
285#### Checklist for moving to `rc01`
286
287* All previous checklists still apply
288* Release branch, e.g. `androidx-<group_id>-release`, is created
289* API surface
290 * Any API changes from `beta` cycle are reviewed by API Council
291* No **known** P0 or P1 (ship-blocking) issues
292* All dependencies are `rc` or stable
293
294#### Within the `rcXX` cycle
295
296* Ship-blocking bug fixes only
297* All changes must have corresponding tests
298* No API changes allowed
299
300### Stable {#stable}
301
302Final releases are well-tested, both by internal tests and external clients, and
303their API surface is reviewed and finalized. While APIs may be deprecated and
304removed in future versions, any APIs added at this stage must remain for at
305least a year.
306
307#### Checklist for moving to stable
308
309* Identical to a previously released `rcXX` (note that this means any bugs
310 that result in a new release candidate will necessarily delay your stable
311 release by a minimum of two weeks)
312* No changes of any kind allowed
313* All dependencies are stable
314
315## Updating your version {#update}
316
317A few notes about version updates:
318
AndroidX Core Team408c27b2020-12-15 15:57:00 +0000319- The version of your library listed in `androidx-main` should *always* be
320 higher than the version publically available on Google Maven. This allows us
321 to do proper version tracking and API tracking.
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000322
323- Version increments must be done before the CL cutoff date (aka the build cut
324 date).
325
326- **Increments to the next stability suffix** (like `alpha` to `beta`) should
327 be handled by the library owner, with the Jetpack TPM (nickanthony@) CC'd
328 for API+1.
329
330- Version increments in release branches will need to follow the guide
331 [How to update your version on a release branch](release_branches.md#update-your-version)
332
333- When you're ready for `rc01`, the increment to `rc01` should be done in
AndroidX Core Team408c27b2020-12-15 15:57:00 +0000334 `androidx-main` and then your release branch should be snapped to that
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000335 build. See the guide [Snap your release branch](release_branches.md#snap) on
336 how to do this. After the release branch is snapped to that build, you will
AndroidX Core Team408c27b2020-12-15 15:57:00 +0000337 need to update your version in `androidx-main` to `alpha01` of the next
338 minor (or major) version.
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000339
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000340
341### How to update your version
342
AndroidX Core Team179f25b2022-02-04 15:20:48 -08003431. Update the version listed in `frameworks/support/libraryversions.toml`
AndroidX Core Team95cd3da2021-01-14 11:47:43 -05003441. If your library is a `beta` or `rc01` version, run `./gradlew
345 <your-lib>:updateApi`. This will create an API txt file for the new version
AndroidX Core Team21ccf652022-04-01 14:53:07 +0000346 of your library. For other versions, this step is not required
AndroidX Core Team2e416b22020-12-03 22:58:07 +00003471. Verify changes with `./gradlew checkApi verifyDependencyVersions`.
3481. Commit these change as one commit.
3491. Upload these changes to Gerrit for review.
350
351An example of a version bump can be found here:
352[aosp/833800](https://android-review.googlesource.com/c/platform/frameworks/support/+/833800)
353
354## `-ktx` Modules {#ktx}
355
AndroidX Core Team21ccf652022-04-01 14:53:07 +0000356[Kotlin extension libraries](api_guidelines.md#module-ktx) (`-ktx`) follow the
357same versioning requirements as other libraries, but with one exception: they
358must match the version of the Java libraries that they extend.
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000359
AndroidX Core Team21ccf652022-04-01 14:53:07 +0000360For example, let's say you are developing a Java library
361`androidx.foo:foo-bar:1.1.0-alpha01` and you want to add a Kotlin extension
362library `androidx.foo:foo-bar-ktx`. Your new `androidx.foo:foo-bar-ktx` library
363will start at version `1.1.0-alpha01` instead of `1.0.0-alpha01`.
AndroidX Core Team2e416b22020-12-03 22:58:07 +0000364
365If your `androidx.foo:foo-bar` module was in version `1.0.0-alpha06`, then the
AndroidX Core Team21ccf652022-04-01 14:53:07 +0000366Kotlin extension module would start in version `1.0.0-alpha06`.