1# Making a new SDK release 2 3This guide shows how to make a new Perfetto SDK release. 4 5First, check out the code: 6 7```bash 8git clone https://android.googlesource.com/platform/external/perfetto 9cd perfetto 10``` 11 12Next, decide the version number for the new release (vX.Y). In general minor 13updates should increment the minor version number (Y) while larger, more 14significant behavioral changes should be reflected in the major version 15number (X). 16 17Continue with the appropriate section below. 18 19## a) Creating a new major version 20 21Create a release branch for the new major version ("5.x" here) and merge in 22the code for the new release: 23 24```bash 25git fetch origin 26git push origin origin/master:refs/heads/releases/v5.x 27git fetch origin 28git checkout -b releases/v5.x -t origin/master 29git merge <sha1> 30``` 31 32Continue with [building the release](#building-and-tagging-the-release). 33 34## b) Bumping the minor version 35 36Check out the existing release branch ("4.x" here) and merge in the desired 37revision for the new release, resolving any conflicts you may encounter. 38 39```bash 40git checkout -b releases/v4.x -t origin/releases/v4.x 41``` 42 43If you only want to introduce one or two patches in the new release, consider 44cherry-picking them individually: 45 46```bash 47git cherry-pick <sha1> 48``` 49 50Otherwise, you can do a full merge: 51 52```bash 53git merge <sha1> 54``` 55 56## Building and tagging the release 57 581. Generate and commit the amalgamated source files. 59 60```bash 61tools/gen_amalgamated --output sdk/perfetto 62git add sdk/perfetto.{cc,h} 63git commit -m "Amalgamated source for vX.Y" 64``` 65 662. Check that the SDK example code works with the new release. 67 68```bash 69cd examples/sdk 70cmake -B build 71cmake --build build 72``` 73 743. Upload the new release for review. 75 76```bash 77git cl upload --no-squash 78``` 79 80If you get an error about a missing Change-Id field (`remote: ERROR: commit 81a7c7c4c: missing Change-Id in message footer`), install the commit-msg hook 82script and amend the change to make sure that field is present: 83 84```bash 85curl -Lo .git/hooks/commit-msg http://android-review.googlesource.com/tools/hooks/commit-msg 86chmod u+x .git/hooks/commit-msg 87git commit --amend 88``` 89 904. Once the release has been reviewed and landed, create and push the tag for 91 it ("vX.Y" being the new version). 92 93```bash 94git tag -a -m "Perfetto vX.Y" vX.Y 95git push origin vX.Y 96``` 97 985. Update the documentation to point to the latest release. 99 100 - [docs/instrumentation/tracing-sdk.md](/docs/instrumentation/tracing-sdk.md) 101 - [examples/sdk/README.md](/examples/sdk/README.md) 102 103Phew, you're done! 104