From 66fc33818fa0042235beb6fc9876a256feac8a08 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 8 Mar 2024 13:53:29 -0800 Subject: [PATCH] Update the instructions for updating licenses. * Adds markdown formatting to better highlight the important bits. * Removes the bit about patch files not being valid because they are copied from the GitHub UI (we use LUCI now). * Add a shortcut for Mac to apply the patch from your pasteboard. --- tools/licenses/README.md | 49 +++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/tools/licenses/README.md b/tools/licenses/README.md index fdfbdd53f0690..de9f42f59c4b6 100644 --- a/tools/licenses/README.md +++ b/tools/licenses/README.md @@ -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 @@ -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