README.md
1# Update License Files
2
3## Apply patch generated by CI
4If you're not working on a Linux box then you can't auto-generate license files. A workaround is provided via CI.
5
6Your build will fail one or more CI checks if your license files are not correct. Open the failing CI check. In the CI output you will find a patch diff that represents the changes that need to be made to your license files. Click `Download full logs` (Github removes lines with only whitespaces, which invalidates the diff). Copy this patch to a temporary patch file wherever you'd like. Then apply the patch to your repo:
7
8```
9cd flutter/ci/licenses_golden
10patch -p2 < my/patch/file
11```
12
13## Check for license changes (Only works on Linux)
14
15This script has two sets of output files: "goldens", which describe
16the current license state of the repository, and the actual real
17LICENSE file, which is what matters.
18
19We look at changes to the goldens to determine if there are any actual
20changes to the licenses.
21
22To update the goldens, make sure you've rebased your branch to the
23latest upstream master and then run the following in this directory:
24
25```
26pub get
27gclient sync
28rm -rf ../../../out/licenses
29dart lib/main.dart --src ../../.. --out ../../../out/licenses --golden ../../ci/licenses_golden
30```
31
32In order for the license script to work correctly, you need to remove
33any untracked files inside `engine/src` (the buildroot), not just
34`engine/src/flutter`.
35
36Once the script has finished, copy any affected files from
37`../../../out/licenses` to `../../ci/licenses_golden` and add them to
38your change, and examine the diffs to see what changed.
39
40```
41cp ../../../out/licenses/* ../../ci/licenses_golden
42git diff
43```
44
45If the only changes are to what files are included, then you're good
46to go. However, if any of the _licenses_ changed, whether new licenses
47are added, old ones removed, or any have their content changed in
48_any_ way (including, e.g., whitespace changes), or if the affected
49libraries change, **you must update the actual license file**.
50
51The `sky/packages/sky_engine/LICENSE` file is the one actually
52included in product releases and the one that should be updated any
53time the golden file changes in a way that involves changes to
54anything other than the `FILE` lines. To update this file, run:
55
56```
57pub get
58gclient sync
59dart lib/main.dart --release --src ../../.. --out ../../../out/licenses > ../../sky/packages/sky_engine/LICENSE
60```
61
62The bots do not verify that you did this step, it's important that you
63do it! When reviewing patches, if you see a change to the golden
64files, check to see if there's a corresponding change to the LICENSE
65file!
66