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