Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 6b202b0

Browse files
committed
License script improvements
1 parent 4881fe2 commit 6b202b0

File tree

26 files changed

+82295
-24757
lines changed

26 files changed

+82295
-24757
lines changed

DEPS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ vars = {
5151
'dart_revision': '358d0d1aa3e7ebe550ebc343aa795c7f4c136342',
5252

5353
# WARNING: DO NOT EDIT MANUALLY
54-
# The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
54+
# The lines between blank lines above and below are generated by a script. See ../tools/dart/create_updated_flutter_deps.py
5555
'dart_binaryen_rev': '7769139efbe818c7ba36d1a382db5114ebee9df8',
5656
'dart_boringssl_gen_rev': 'ced85ef0a00bbca77ce5a91261a5f2ae61b1e62f',
5757
'dart_boringssl_rev': '87f316d7748268eb56f2dc147bd593254ae93198',

ci/licenses.sh

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,18 @@ PATH="$DART_BIN:$PATH"
3535

3636
# Use:
3737
# env VERBOSE=1 ./ci/licenses.sh
38-
# to turn on verbose progress report printing.
38+
# to turn on verbose progress report printing. Set it to 2 to also output
39+
# information about which patterns are taking the most time.
3940
QUIET="--quiet"
4041
if [[ "${VERBOSE}" == "1" ]]; then
4142
QUIET=""
4243
fi
44+
if [[ "${VERBOSE}" == "2" ]]; then
45+
QUIET="--verbose"
46+
fi
4347

4448
echo "Verifying license script is still happy..."
45-
echo "Using pub from $(command -v pub), dart from $(command -v dart)"
49+
echo "Using dart from: $(command -v dart)"
4650

4751
untracked_files="$(cd "$SRC_DIR/flutter"; git status --ignored --short | grep -E "^!" | awk "{print\$2}")"
4852
untracked_count="$(echo "$untracked_files" | wc -l)"
@@ -58,6 +62,12 @@ fi
5862

5963
dart --version
6064

65+
# Runs the tests for the license script.
66+
function run_tests() (
67+
cd "$SRC_DIR/flutter/tools/licenses"
68+
find -name "*_test.dart" | xargs -n 1 dart --enable-asserts
69+
)
70+
6171
# Collects the license information from the repo.
6272
# Runs in a subshell.
6373
function collect_licenses() (
@@ -117,11 +127,29 @@ function verify_licenses() (
117127
exitStatus=1
118128
fi
119129

130+
echo "Verifying excluded files list..."
131+
if ! cmp -s "flutter/ci/licenses_golden/excluded_files" "out/license_script_output/excluded_files"; then
132+
echo "============================= ERROR ============================="
133+
echo "The license is excluding a different number of files than previously."
134+
echo "This is only expected when new non-source files have been introduced."
135+
echo "Verify that all the newly ignored files are definitely not shipped with"
136+
echo "any binaries that we compile (including impellerc and Wasm)."
137+
echo "If the changes look correct, update this file:"
138+
echo " ci/licenses_golden/excluded_files"
139+
echo "For more information, see the script in:"
140+
echo " https://github.com/flutter/engine/tree/main/tools/licenses"
141+
echo ""
142+
diff -U 6 "flutter/ci/licenses_golden/excluded_files" "out/license_script_output/excluded_files"
143+
echo "================================================================="
144+
echo ""
145+
exitStatus=1
146+
fi
147+
120148
echo "Checking license count in licenses_flutter..."
121149

122150
local actualLicenseCount
123151
actualLicenseCount="$(tail -n 1 flutter/ci/licenses_golden/licenses_flutter | tr -dc '0-9')"
124-
local expectedLicenseCount=19 # When changing this number: Update the error message below as well describing all expected license types.
152+
local expectedLicenseCount=19 # When changing this number: Update the error message below as well describing the newly expected license types.
125153

126154
if [[ $actualLicenseCount -ne $expectedLicenseCount ]]; then
127155
echo "=============================== ERROR ==============================="
@@ -145,4 +173,5 @@ function verify_licenses() (
145173
return $exitStatus
146174
)
147175

176+
run_tests
148177
verify_licenses

ci/licenses_golden/excluded_files

Lines changed: 2913 additions & 0 deletions
Large diffs are not rendered by default.

ci/licenses_golden/licenses_flutter

Lines changed: 2797 additions & 338 deletions
Large diffs are not rendered by default.

ci/licenses_golden/licenses_fuchsia

Lines changed: 3482 additions & 2868 deletions
Large diffs are not rendered by default.

ci/licenses_golden/licenses_gpu

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
Signature: ffe64a3daaf0ad982854594ad155dd56
22

3-
UNUSED LICENSES:
4-
5-
6-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7-
USED LICENSES:
8-
93
====================================================================================================
10-
LIBRARY: gpu
11-
ORIGIN: ../../../flutter/LICENSE
4+
LIBRARY: engine
5+
ORIGIN: ../../../gpu/GLES2/gl2chromium.h + ../../../gpu/LICENSE
6+
ORIGIN: ../../../gpu/command_buffer/client/gles2_c_lib_export.h + ../../../gpu/LICENSE
127
TYPE: LicenseType.bsd
138
FILE: ../../../gpu/GLES2/gl2chromium.h
149
FILE: ../../../gpu/command_buffer/client/gles2_c_lib_export.h
@@ -39,4 +34,5 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3934
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
4035
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4136
====================================================================================================
37+
4238
Total license count: 1

ci/licenses_golden/licenses_skia

Lines changed: 3261 additions & 2403 deletions
Large diffs are not rendered by default.

ci/licenses_golden/licenses_third_party

Lines changed: 45190 additions & 9713 deletions
Large diffs are not rendered by default.

ci/licenses_golden/tool_signature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Signature: 9d0f7a4c4f53b80e33da848062bef937
1+
Signature: 2aaa7d1662adb75aac43db23f4bd5d97
22

impeller/compiler/BUILD.gn

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ impeller_component("compiler_lib") {
6161
"../runtime_stage",
6262
"//flutter/fml",
6363

64-
# All third_party deps must be reflected below in the impellerc_license
65-
# target.
64+
# All third_party deps must be included by the global license script.
6665
"//third_party/inja",
6766
"//third_party/shaderc_flutter",
6867
"//third_party/spirv_cross_flutter",
@@ -86,23 +85,6 @@ generated_file("impellerc_license") {
8685
"",
8786
read_file("//flutter/sky/packages/sky_engine/LICENSE", "string"),
8887
"",
89-
90-
# These licenses are ignored by the main license checker, since they are not
91-
# shipped to end-application binaries and only shipped as part of developer
92-
# tooling in impellerc. Add them here.
93-
"## Additional open source licenses",
94-
"",
95-
"### inja",
96-
"",
97-
read_file("//third_party/inja/LICENSE", "string"),
98-
"",
99-
"### shaderc",
100-
"",
101-
read_file("//third_party/shaderc/LICENSE", "string"),
102-
"",
103-
"### spirv_cross",
104-
"",
105-
read_file("//third_party/vulkan-deps/spirv-cross/src/LICENSE", "string"),
10688
]
10789
}
10890

0 commit comments

Comments
 (0)