|
| 1 | +// Copyright 2026 Google LLC |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +edition = "2024"; |
| 16 | + |
| 17 | +package ink.proto; |
| 18 | + |
| 19 | +import "net/proto2/proto/descriptor.proto"; |
| 20 | + |
| 21 | +option java_package = "com.google.ink.proto"; |
| 22 | +option java_outer_classname = "OptionsProto"; |
| 23 | + |
| 24 | +message Version { |
| 25 | + // Version represents a Jetpack release of Ink, mapping directly to the |
| 26 | + // values associated with releases at: |
| 27 | + // https://developer.android.com/jetpack/androidx/releases/ink |
| 28 | + // |
| 29 | + // For example, Ink 1.0.0-alpha04 would be represented as: |
| 30 | + // ``` |
| 31 | + // major: 1 |
| 32 | + // minor: 0 |
| 33 | + // bug: 0 |
| 34 | + // cycle: CYCLE_ALPHA |
| 35 | + // release: 4 |
| 36 | + // ``` |
| 37 | + // Ink 1.0.0 would be represented as: |
| 38 | + // ``` |
| 39 | + // major: 1 |
| 40 | + // minor: 0 |
| 41 | + // bug: 0 |
| 42 | + // cycle: CYCLE_STABLE |
| 43 | + // release: 1 |
| 44 | + // ``` |
| 45 | + // Note that the release value is 1-based, to stay consistent with the |
| 46 | + // Jetpack release values. Stable releases should always have a release value |
| 47 | + // of 1, since we don't release multiple iterations of a stable build for a |
| 48 | + // given version (there is no 1.0.0-stable01, 1.0.0-stable02, etc. |
| 49 | + // only 1.0.0). |
| 50 | + // |
| 51 | + // Version must be compared in lexicographical order, including all 5 fields |
| 52 | + // (major, minor, bug, cycle, release) in that order, to establish version |
| 53 | + // precedence. |
| 54 | + // |
| 55 | + // Cycle and release are used to couch against instability between various |
| 56 | + // alpha and beta releases which change the custom brush API. Earlier releases |
| 57 | + // provide a guarantee that they will not load a brush containing a feature |
| 58 | + // from a later release. Cycle and release are necessary for this guarantee |
| 59 | + // to work between builds of the same major, minor, and bug valued version. |
| 60 | + // |
| 61 | + // The reverse guarantee, however, is not provided. If a brush feature is |
| 62 | + // introduced in an alpha release, and removed in a beta release, the beta |
| 63 | + // release will not reject the brush on the basis of version, instead it |
| 64 | + // will attempt to load the brush as-is, making a best effort with the code |
| 65 | + // that it has to deserialize the brush. |
| 66 | + int32 major = 1; |
| 67 | + int32 minor = 2; |
| 68 | + int32 bug = 3; |
| 69 | + |
| 70 | + enum Cycle { |
| 71 | + CYCLE_UNSPECIFIED = 0; |
| 72 | + CYCLE_ALPHA = 1; |
| 73 | + CYCLE_BETA = 2; |
| 74 | + CYCLE_RELEASE_CANDIDATE = 3; |
| 75 | + CYCLE_STABLE = 4; |
| 76 | + } |
| 77 | + |
| 78 | + Cycle cycle = 4; |
| 79 | + int32 release = 5; |
| 80 | +} |
| 81 | + |
| 82 | +// Extend FieldOptions, MessageOptions, EnumOptions, and EnumValueOptions to |
| 83 | +// include Version. |
| 84 | +extend proto2.FieldOptions { |
| 85 | + Version field_min_version = 525000068; |
| 86 | +} |
| 87 | +extend proto2.MessageOptions { |
| 88 | + Version message_min_version = 525000037; |
| 89 | +} |
| 90 | +extend proto2.EnumValueOptions { |
| 91 | + Version enum_value_min_version = 525000143; |
| 92 | +} |
0 commit comments