[go: nahoru, domu]

Skip to content

Commit

Permalink
License script improvements (flutter#38148)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hixie committed Dec 15, 2022
1 parent a04997c commit fc71faa
Show file tree
Hide file tree
Showing 26 changed files with 82,295 additions and 24,757 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ vars = {
'dart_revision': '358d0d1aa3e7ebe550ebc343aa795c7f4c136342',

# WARNING: DO NOT EDIT MANUALLY
# The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
# The lines between blank lines above and below are generated by a script. See ../tools/dart/create_updated_flutter_deps.py
'dart_binaryen_rev': '7769139efbe818c7ba36d1a382db5114ebee9df8',
'dart_boringssl_gen_rev': 'ced85ef0a00bbca77ce5a91261a5f2ae61b1e62f',
'dart_boringssl_rev': '87f316d7748268eb56f2dc147bd593254ae93198',
Expand Down
35 changes: 32 additions & 3 deletions ci/licenses.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,18 @@ PATH="$DART_BIN:$PATH"

# Use:
# env VERBOSE=1 ./ci/licenses.sh
# to turn on verbose progress report printing.
# to turn on verbose progress report printing. Set it to 2 to also output
# information about which patterns are taking the most time.
QUIET="--quiet"
if [[ "${VERBOSE}" == "1" ]]; then
QUIET=""
fi
if [[ "${VERBOSE}" == "2" ]]; then
QUIET="--verbose"
fi

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

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

dart --version

# Runs the tests for the license script.
function run_tests() (
cd "$SRC_DIR/flutter/tools/licenses"
find -name "*_test.dart" | xargs -n 1 dart --enable-asserts
)

# Collects the license information from the repo.
# Runs in a subshell.
function collect_licenses() (
Expand Down Expand Up @@ -117,11 +127,29 @@ function verify_licenses() (
exitStatus=1
fi

echo "Verifying excluded files list..."
if ! cmp -s "flutter/ci/licenses_golden/excluded_files" "out/license_script_output/excluded_files"; then
echo "============================= ERROR ============================="
echo "The license is excluding a different number of files than previously."
echo "This is only expected when new non-source files have been introduced."
echo "Verify that all the newly ignored files are definitely not shipped with"
echo "any binaries that we compile (including impellerc and Wasm)."
echo "If the changes look correct, update this file:"
echo " ci/licenses_golden/excluded_files"
echo "For more information, see the script in:"
echo " https://github.com/flutter/engine/tree/main/tools/licenses"
echo ""
diff -U 6 "flutter/ci/licenses_golden/excluded_files" "out/license_script_output/excluded_files"
echo "================================================================="
echo ""
exitStatus=1
fi

echo "Checking license count in licenses_flutter..."

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

if [[ $actualLicenseCount -ne $expectedLicenseCount ]]; then
echo "=============================== ERROR ==============================="
Expand All @@ -145,4 +173,5 @@ function verify_licenses() (
return $exitStatus
)

run_tests
verify_licenses
2,913 changes: 2,913 additions & 0 deletions ci/licenses_golden/excluded_files

Large diffs are not rendered by default.

3,135 changes: 2,797 additions & 338 deletions ci/licenses_golden/licenses_flutter

Large diffs are not rendered by default.

6,350 changes: 3,482 additions & 2,868 deletions ci/licenses_golden/licenses_fuchsia

Large diffs are not rendered by default.

12 changes: 4 additions & 8 deletions ci/licenses_golden/licenses_gpu
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
Signature: ffe64a3daaf0ad982854594ad155dd56

UNUSED LICENSES:


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
USED LICENSES:

====================================================================================================
LIBRARY: gpu
ORIGIN: ../../../flutter/LICENSE
LIBRARY: engine
ORIGIN: ../../../gpu/GLES2/gl2chromium.h + ../../../gpu/LICENSE
ORIGIN: ../../../gpu/command_buffer/client/gles2_c_lib_export.h + ../../../gpu/LICENSE
TYPE: LicenseType.bsd
FILE: ../../../gpu/GLES2/gl2chromium.h
FILE: ../../../gpu/command_buffer/client/gles2_c_lib_export.h
Expand Down Expand Up @@ -39,4 +34,5 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
====================================================================================================

Total license count: 1
5,664 changes: 3,261 additions & 2,403 deletions ci/licenses_golden/licenses_skia

Large diffs are not rendered by default.

54,903 changes: 45,190 additions & 9,713 deletions ci/licenses_golden/licenses_third_party

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ci/licenses_golden/tool_signature
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Signature: 9d0f7a4c4f53b80e33da848062bef937
Signature: 2aaa7d1662adb75aac43db23f4bd5d97

20 changes: 1 addition & 19 deletions impeller/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ impeller_component("compiler_lib") {
"../runtime_stage",
"//flutter/fml",

# All third_party deps must be reflected below in the impellerc_license
# target.
# All third_party deps must be included by the global license script.
"//third_party/inja",
"//third_party/shaderc_flutter",
"//third_party/spirv_cross_flutter",
Expand All @@ -86,23 +85,6 @@ generated_file("impellerc_license") {
"",
read_file("//flutter/sky/packages/sky_engine/LICENSE", "string"),
"",

# These licenses are ignored by the main license checker, since they are not
# shipped to end-application binaries and only shipped as part of developer
# tooling in impellerc. Add them here.
"## Additional open source licenses",
"",
"### inja",
"",
read_file("//third_party/inja/LICENSE", "string"),
"",
"### shaderc",
"",
read_file("//third_party/shaderc/LICENSE", "string"),
"",
"### spirv_cross",
"",
read_file("//third_party/vulkan-deps/spirv-cross/src/LICENSE", "string"),
]
}

Expand Down
Loading

0 comments on commit fc71faa

Please sign in to comment.