Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the instructions for updating licenses. #51297

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 36 additions & 13 deletions tools/licenses/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,42 @@
# Update License Files

## Apply patch generated by CI
If you're not working on a Linux box then you can't auto-generate license files. A workaround is provided via CI.

Your 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.
If you're not working on a Linux box then you can't auto-generate license
files. A workaround is provided via CI.

Your 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.

> [!WARNING]
> Do this only if the diff does not change _which_ licenses are being
> included, but affects just the `FILE:` metadata and so forth in the
> golden files. If the actual content of the licenses has changed, you
> will need to rerun the script from a Linux box to update the actual
> LICENSE file, as described below.

```sh
cd flutter/ci/licenses_golden
```

IF (and only if!) the diff does not change _which_ licenses are being included, but only affects the `FILE:` metadata and so forth in the golden files, then you can 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, and then apply the patch to your repo:
If the file is to `my/patch/file` locally. The `-p2` strips two path
components from the file paths in the diff. Adjust as necessary.

```
cd flutter/ci/licenses_golden
```sh
patch -p2 < my/patch/file
```

HOWEVER, if the actual content of the licenses changed then you will need to rerun the script from a Linux box to update the actual LICENSE file, as described below.
If the patch file is copied in your clipboard. On Mac, you may apply the patch from there.

```sh
pbpaste | patch -p2
```

## Check for license changes

## Check for license changes (Only works on Linux)
> [!WARNING]
> Only works on Linux.

This script has two sets of output files: "goldens", which describe
the current license state of the repository, and the actual real
Expand Down Expand Up @@ -46,11 +68,12 @@ cp ../../../out/licenses/* ../../ci/licenses_golden
git diff
```

If the only changes are to what files are included, then you're good
to go. However, if any of the _licenses_ changed, whether new licenses
are added, old ones removed, or any have their content changed in
_any_ way (including, e.g., whitespace changes), or if the affected
libraries change, **you must update the actual license file**.
> [!IMPORTANT]
> If the only changes are to what files are included, then you're good
> to go. However, if any of the _licenses_ changed, whether new licenses
> are added, old ones removed, or any have their content changed in
> _any_ way (including, e.g., whitespace changes), or if the affected
> libraries change, **you must update the actual license file**.

The `sky/packages/sky_engine/LICENSE` file is the one actually
included in product releases and the one that should be updated any
Expand Down