1# Making a new SDK release
2
3This guide shows how to make a new Perfetto SDK release.
4
5Before snapshotting a release, check that no [release-blockers](http://b/savedsearches/5776355) are
6open.
7
8Check out the code:
9
10```bash
11git clone https://android.googlesource.com/platform/external/perfetto
12cd perfetto
13```
14
15Next, decide the version number for the new release (vX.Y).
16The major version number (X) is incremented on every release (monthly).
17The minor version number is incremented only for minor changes / fixes on top of the monthly
18release (cherry-picks on the releases/vN.x branch).
19
20Continue with the appropriate section below.
21
22## a) Creating a new major version
23
24Create a release branch for the new major version ("v16.x" here):
25
26```bash
27git fetch origin
28git push origin origin/master:refs/heads/releases/v16.x
29git fetch origin
30git checkout -b releases/v16.x -t origin/releases/v16.x
31```
32
33Continue with [building the release](#building-and-tagging-the-release).
34
35## b) Bumping the minor version
36
37Check out the existing release branch ("5.x" here) and merge in the desired
38revision for the new release, resolving any conflicts you may encounter.
39
40```bash
41git checkout -b releases/v16.x -t origin/releases/v16.x
42```
43
44If you only want to introduce one or two patches in the new release, consider
45cherry-picking them individually:
46
47```bash
48git cherry-pick <sha1>
49```
50
51Otherwise, you can do a full merge:
52
53```bash
54git merge <sha1>
55```
56
57## Building and tagging the release
58
591. Generate and commit the amalgamated source files.
60
61```bash
62tools/gen_amalgamated --output sdk/perfetto
63git add sdk/perfetto.{cc,h}
64git commit -m "Amalgamated source for vX.Y"
65```
66
672. Check that the SDK example code works with the new release.
68
69```bash
70cd examples/sdk
71cmake -B build
72cmake --build build
73```
74
753. Upload the new release for review.
76
77```bash
78git cl upload --no-squash
79```
80
81If you get an error about a missing Change-Id field (`remote: ERROR: commit
82a7c7c4c: missing Change-Id in message footer`), install the commit-msg hook
83script and amend the change to make sure that field is present:
84
85```bash
86curl -Lo .git/hooks/commit-msg http://android-review.googlesource.com/tools/hooks/commit-msg
87chmod u+x .git/hooks/commit-msg
88git commit --amend
89```
90
914. Once the release has been reviewed and landed, create and push the tag for
92   it ("vX.Y" being the new version).
93
94```bash
95# This brings the branch up to date with the CL landed in the step above.
96git pull
97
98git status
99# Should print: Your branch is up to date with 'origin/releases/v16.x'.
100# Do NOT proceed if your branch has diverged from origin/releases/vX.X
101
102git tag -a -m "Perfetto vX.Y" vX.Y
103git push origin vX.Y
104```
105
1065. Update the documentation to point to the latest release.
107
108   - [docs/instrumentation/tracing-sdk.md](/docs/instrumentation/tracing-sdk.md)
109   - [examples/sdk/README.md](/examples/sdk/README.md)
110
1116. Send an email with the CHANGELOG to perfetto-dev@ (internal) and perfetto-dev@googlegroups.com.
112
113Phew, you're done!
114