@@ -21,7 +21,7 @@ unset CDPATH
2121function follow_links() (
2222 cd -P " $( dirname -- " $1 " ) "
2323 file=" $PWD /$( basename -- " $1 " ) "
24- while [[ -h " $file " ]]; do
24+ while [[ -L " $file " ]]; do
2525 cd -P " $( dirname -- " $file " ) "
2626 file=" $( readlink -- " $file " ) "
2727 cd -P " $( dirname -- " $file " ) "
@@ -31,7 +31,10 @@ function follow_links() (
3131)
3232
3333SCRIPT_DIR=$( follow_links " $( dirname -- " ${BASH_SOURCE[0]} " ) " )
34- SRC_DIR=" $( cd " $SCRIPT_DIR /../.." ; pwd -P) "
34+ SRC_DIR=" $(
35+ cd " $SCRIPT_DIR /../.."
36+ pwd -P
37+ ) "
3538DART_BIN=" $SRC_DIR /third_party/dart/tools/sdks/dart-sdk/bin"
3639PATH=" $DART_BIN :$PATH "
3740
5053echo " Verifying license script is still happy..."
5154echo " Using dart from: $( command -v dart) "
5255
53- untracked_files=" $( cd " $SRC_DIR /flutter" ; git status --ignored --short | grep -E " ^!" | awk " {print\$ 2}" ) "
56+ untracked_files=" $(
57+ cd " $SRC_DIR /flutter"
58+ git status --ignored --short | grep -E " ^!" | awk " {print\$ 2}"
59+ ) "
5460untracked_count=" $( echo " $untracked_files " | wc -l) "
5561if [[ $untracked_count -gt 0 ]]; then
5662 echo " "
@@ -80,9 +86,9 @@ function collect_licenses() (
8086 # interpreter is faster than using unoptimized machine code, which has
8187 # no chance of being optimized(due to its size).
8288 dart --enable-asserts --interpret_irregexp lib/main.dart \
83- --src ../../.. \
84- --out ../../../out/license_script_output \
85- --golden ../../ci/licenses_golden \
89+ --src ../../.. \
90+ --out ../../../out/license_script_output \
91+ --golden ../../ci/licenses_golden \
8692 " ${QUIET} "
8793)
8894
@@ -98,80 +104,80 @@ function verify_licenses() (
98104 collect_licenses
99105
100106 for f in out/license_script_output/licenses_* ; do
101- if ! cmp -s " flutter/ci/licenses_golden/$( basename " $f " ) " " $f " ; then
102- echo " ============================= ERROR ============================="
103- echo " License script got different results than expected for $f ."
104- echo " Please rerun the licenses script locally to verify that it is"
105- echo " correctly catching any new licenses for anything you may have"
106- echo " changed, and then update this file:"
107- echo " flutter/sky/packages/sky_engine/LICENSE"
108- echo " For more information, see the script in:"
109- echo " https://github.com/flutter/engine/tree/main/tools/licenses"
110- echo " "
111- diff -U 6 " flutter/ci/licenses_golden/$( basename " $f " ) " " $f "
112- echo " ================================================================="
113- echo " "
114- exitStatus=1
115- fi
116- done
117-
118- echo " Verifying license tool signature..."
119- if ! cmp -s " flutter/ci/licenses_golden/tool_signature" " out/license_script_output/tool_signature" ; then
107+ if ! cmp -s " flutter/ci/licenses_golden/$( basename " $f " ) " " $f " ; then
120108 echo " ============================= ERROR ============================="
121- echo " The license tool signature has changed. This is expected when"
122- echo " there have been changes to the license tool itself. Licenses have"
123- echo " been re-computed for all components. If only the license script has"
124- echo " changed, no diffs are typically expected in the output of the"
125- echo " script. Verify the output, and if it looks correct, update the"
126- echo " license tool signature golden file:"
127- echo " ci/licenses_golden/tool_signature"
109+ echo " License script got different results than expected for $f ."
110+ echo " Please rerun the licenses script locally to verify that it is"
111+ echo " correctly catching any new licenses for anything you may have"
112+ echo " changed, and then update this file:"
113+ echo " flutter/sky/packages/sky_engine/LICENSE"
128114 echo " For more information, see the script in:"
129115 echo " https://github.com/flutter/engine/tree/main/tools/licenses"
130116 echo " "
131- diff -U 6 " flutter/ci/licenses_golden/tool_signature " " out/license_script_output/tool_signature "
117+ diff -U 6 " flutter/ci/licenses_golden/$( basename " $f " ) " " $f "
132118 echo " ================================================================="
133119 echo " "
134120 exitStatus=1
121+ fi
122+ done
123+
124+ echo " Verifying license tool signature..."
125+ if ! cmp -s " flutter/ci/licenses_golden/tool_signature" " out/license_script_output/tool_signature" ; then
126+ echo " ============================= ERROR ============================="
127+ echo " The license tool signature has changed. This is expected when"
128+ echo " there have been changes to the license tool itself. Licenses have"
129+ echo " been re-computed for all components. If only the license script has"
130+ echo " changed, no diffs are typically expected in the output of the"
131+ echo " script. Verify the output, and if it looks correct, update the"
132+ echo " license tool signature golden file:"
133+ echo " ci/licenses_golden/tool_signature"
134+ echo " For more information, see the script in:"
135+ echo " https://github.com/flutter/engine/tree/main/tools/licenses"
136+ echo " "
137+ diff -U 6 " flutter/ci/licenses_golden/tool_signature" " out/license_script_output/tool_signature"
138+ echo " ================================================================="
139+ echo " "
140+ exitStatus=1
135141 fi
136142
137143 echo " Verifying excluded files list..."
138144 if ! cmp -s " flutter/ci/licenses_golden/excluded_files" " out/license_script_output/excluded_files" ; then
139- echo " ============================= ERROR ============================="
140- echo " The license is excluding a different number of files than previously."
141- echo " This is only expected when new non-source files have been introduced."
142- echo " Verify that all the newly ignored files are definitely not shipped with"
143- echo " any binaries that we compile (including impellerc and Wasm)."
144- echo " If the changes look correct, update this file:"
145- echo " ci/licenses_golden/excluded_files"
146- echo " For more information, see the script in:"
147- echo " https://github.com/flutter/engine/tree/main/tools/licenses"
148- echo " "
149- diff -U 6 " flutter/ci/licenses_golden/excluded_files" " out/license_script_output/excluded_files"
150- echo " ================================================================="
151- echo " "
152- exitStatus=1
145+ echo " ============================= ERROR ============================="
146+ echo " The license is excluding a different number of files than previously."
147+ echo " This is only expected when new non-source files have been introduced."
148+ echo " Verify that all the newly ignored files are definitely not shipped with"
149+ echo " any binaries that we compile (including impellerc and Wasm)."
150+ echo " If the changes look correct, update this file:"
151+ echo " ci/licenses_golden/excluded_files"
152+ echo " For more information, see the script in:"
153+ echo " https://github.com/flutter/engine/tree/main/tools/licenses"
154+ echo " "
155+ diff -U 6 " flutter/ci/licenses_golden/excluded_files" " out/license_script_output/excluded_files"
156+ echo " ================================================================="
157+ echo " "
158+ exitStatus=1
153159 fi
154160
155161 echo " Checking license count in licenses_flutter..."
156162
157163 local actualLicenseCount
158164 actualLicenseCount=" $( tail -n 1 flutter/ci/licenses_golden/licenses_flutter | tr -dc ' 0-9' ) "
159- local expectedLicenseCount=112 # When changing this number: Update the error message below as well describing the newly expected license types.
165+ local expectedLicenseCount=113 # When changing this number: Update the error message below as well describing the newly expected license types.
160166
161167 if [[ $actualLicenseCount -ne $expectedLicenseCount ]]; then
162- echo " =============================== ERROR ==============================="
163- echo " The total license count in flutter/ci/licenses_golden/licenses_flutter"
164- echo " changed from $expectedLicenseCount to $actualLicenseCount ."
165- echo " It's very likely that this is an unintentional change. Please"
166- echo " double-check that all newly added files have a BSD-style license"
167- echo " header with the following copyright:"
168- echo " Copyright 2013 The Flutter Authors. All rights reserved."
169- echo " Files in 'third_party/txt' may have an Apache license header instead."
170- echo " If you're absolutely sure that the change in license count is"
171- echo " intentional, update 'flutter/ci/licenses.sh' with the new count."
172- echo " ================================================================="
173- echo " "
174- exitStatus=1
168+ echo " =============================== ERROR ==============================="
169+ echo " The total license count in flutter/ci/licenses_golden/licenses_flutter"
170+ echo " changed from $expectedLicenseCount to $actualLicenseCount ."
171+ echo " It's very likely that this is an unintentional change. Please"
172+ echo " double-check that all newly added files have a BSD-style license"
173+ echo " header with the following copyright:"
174+ echo " Copyright 2013 The Flutter Authors. All rights reserved."
175+ echo " Files in 'third_party/txt' may have an Apache license header instead."
176+ echo " If you're absolutely sure that the change in license count is"
177+ echo " intentional, update 'flutter/ci/licenses.sh' with the new count."
178+ echo " ================================================================="
179+ echo " "
180+ exitStatus=1
175181 fi
176182
177183 if [[ $exitStatus -eq 0 ]]; then
0 commit comments