blob: 8d43535eee0d788feceba804e74faf04d2b0b535 [file] [log] [blame]
Serge Bazanski417d7f62023-11-20 12:57:20 +01001syntax = "proto3";
2package version.spec;
3option go_package = "source.monogon.dev/version/spec";
4
5// Version of an artifact released from the Monogon monorepo.
6//
7// A few assumptions are made here:
8// 1. The version can be serialized to a SemVer 2.0.0 version string, which can
9// then be deserialized back to this proto.
10// 2. Not every SemVer 2.0.0 version string can be deserialized back into a
11// Version, notably only a subset of prerelease labels are supported, and no
12// build metadata is supported.
13// 3. A Version is valid for a given 'product' built by the monorepo build
14// system - there's no single Version for the entire repository.
15message Version {
16 // Last release for this artifact. If unset, 0.0.0 is assumed. SemVer
17 // major/minor/patch semantics are observed.
18 message Release {
19 int64 major = 1;
20 int64 minor = 2;
21 int64 patch = 3;
22 repeated string prerelease = 4;
23 }
24 Release release = 1;
25
26 // Information gathered from Git at time of build.
27 message GitInformation {
28 // Hex-encoded commit short hash of the monorepo checked out during
29 // build.
30 //
31 // This will be used to populate the -gXXXXXX prerelease field in the
32 // serialized SemVer format.
33 string commit_hash = 1;
34 // Number of commits since the given Release.
35 //
36 // If non-zero, this will be used to populate the -devY prerelease field
37 // in the serialized SemVer format.
38 uint64 commits_since_release = 2;
39
40 // State of the Git checkout during the build.
41 //
42 // If dirty, this will set the -dirty prerelease field in the serialized
43 // SemVer format.
44 enum BuildTreeState {
45 BUILD_TREE_STATE_INVALID = 0;
46 BUILD_TREE_STATE_CLEAN = 1;
47 BUILD_TREE_STATE_DIRTY = 2;
48 };
49 BuildTreeState build_tree_state = 3;
50 }
51 GitInformation git_information = 2;
52}