• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.android.onboarding.versions.annotations
2 
3 /**
4  * Marker for a change made to an Onboarding component.
5  *
6  * All changes in Onboarding must be marked by a [ChangeId] and fully flagged.
7  *
8  * The value should be the ID of a Buganizer issue related to the change.
9  *
10  * @param bugId The bug this change relates to. This must match the value of the field being
11  *   annotated.
12  * @param owner A username who is responsible for this change
13  * @param breaking Reasons that this change will cause breakages in current callers. Empty if none.
14  * @param changeRadius The radius of impact of this change. See [ChangeRadius] docs for details.
15  * @param dependsOn Another Change ID that must be enabled for this change to work. [DEFAULT] for
16  *   none.
17  * @param expedited A reason that this change may skip the usual rollout process.
18  *   [ExpeditedReason.NOT_EXPEDITED] if none.
19  * @param available The date (in format YYYY-MM-DD) that this change became available for use by
20  *   apps.
21  * @param released The date (in format YYYY-MM-DD) that this change was released (meaning that it is
22  *   present in all active versions of apps and no longer needs to be checked).
23  */
24 @Target(AnnotationTarget.FIELD)
25 @Retention(AnnotationRetention.SOURCE)
26 annotation class ChangeId(
27   val bugId: Long,
28   val owner: String,
29   val breaking: Array<BreakingReason>,
30   val changeRadius: ChangeRadius,
31   val dependsOn: Long = DEFAULT,
32   val expedited: ExpeditedReason = ExpeditedReason.NOT_EXPEDITED,
33   val available: String = NOT_AVAILABLE,
34   val released: String = NOT_RELEASED,
35 ) {
36   companion object {
37     private const val DEFAULT = -1L
38 
39     const val NOT_AVAILABLE = "NOT_AVAILABLE"
40     const val NOT_RELEASED = "NOT_RELEASED"
41 
42     /** Generate the code to represent this change ID in Kotlin. */
generateChangeIdCodenull43     fun generateChangeIdCode(changeId: ChangeId): String {
44       return "ChangeId(bugId=${changeId.bugId}, owner=\"${changeId.owner}\", breaking=arrayOf(${changeId.breaking.joinToString(", ")}), changeRadius=${changeId.changeRadius}, dependsOn=${changeId.dependsOn}, expedited=${changeId.expedited}, available=\"${changeId.available}\", released=\"${changeId.released}\")"
45     }
46   }
47 }
48