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