diff options
author | Michal Klocek <michal.klocek@qt.io> | 2019-12-06 20:30:18 +0100 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2020-01-16 13:19:55 +0000 |
commit | e687bc69cdc906439cfb257aed3af3eae5d92f52 (patch) | |
tree | 5245bb01b11004c8f6f98845a06633b5344e8364 | |
parent | fb54428bc4c972b53242eb2e6b3a08d02cd6697e (diff) | |
download | qtwebengine-chromium-e687bc69cdc906439cfb257aed3af3eae5d92f52.tar.gz |
Fix properly not working about_credits target
Our licenses python script was out of date and
did not support new arguments like depfile, which
caused constant rebuilds. Use the script
from 77 chromium branch.
Change-Id: Icd18c8fea61a38f8d0884a15606a64b34da4e19e
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
-rw-r--r-- | chromium/components/resources/BUILD.gn | 4 | ||||
-rwxr-xr-x | chromium/tools/licenses.py | 26 |
2 files changed, 22 insertions, 8 deletions
diff --git a/chromium/components/resources/BUILD.gn b/chromium/components/resources/BUILD.gn index 751a92d3bb1..93c70d74ad1 100644 --- a/chromium/components/resources/BUILD.gn +++ b/chromium/components/resources/BUILD.gn @@ -65,7 +65,7 @@ grit("components_scaled_resources") { action("about_credits") { script = "//tools/licenses.py" -# depfile = "$target_gen_dir/$target_name.d" + depfile = "$target_gen_dir/$target_name.d" inputs = [ "../about_ui/resources/about_credits.tmpl", @@ -78,7 +78,7 @@ action("about_credits") { args = [ "--target-os=$target_os", -# "--depfile=" + rebase_path(depfile, root_build_dir), + "--depfile=" + rebase_path(depfile, root_build_dir), "credits", rebase_path(about_credits_file, root_build_dir), ] diff --git a/chromium/tools/licenses.py b/chromium/tools/licenses.py index 9b02dcdd096..791efb55b47 100755 --- a/chromium/tools/licenses.py +++ b/chromium/tools/licenses.py @@ -27,7 +27,11 @@ import subprocess import sys import tempfile +# TODO(agrieve): Move build_utils.WriteDepFile into a non-android directory. _REPOSITORY_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) +sys.path.insert(0, os.path.join(_REPOSITORY_ROOT, 'build/android/gyp')) +from util import build_utils + # Paths from the root of the tree to directories to skip. PRUNE_PATHS = set([ @@ -609,18 +613,15 @@ def GenerateCredits( for key, val in env.items(): if escape: val = cgi.escape(val) - val = val.replace("*/", "* /") template = template.replace('{{%s}}' % key, val) return template def MetadataToTemplateEntry(metadata, entry_template): env = { 'name': metadata['Name'], - 'name-sanitized': metadata['Name'].replace(' ', '-'), 'url': metadata['URL'], 'license': open(metadata['License File'], 'rb').read(), - 'license-type': metadata['License'] - } + } return { 'name': metadata['Name'], 'content': EvaluateTemplate(entry_template, env), @@ -652,7 +653,6 @@ def GenerateCredits( chromium_license_metadata = { 'Name': 'The Chromium Project', 'URL': 'http://www.chromium.org', - 'License': 'BSD 3-clause "New" or "Revised" License', 'License File': os.path.join(_REPOSITORY_ROOT, 'LICENSE') } entries.append(MetadataToTemplateEntry(chromium_license_metadata, entry_template)) @@ -700,6 +700,19 @@ def GenerateCredits( else: print(template_contents) + if depfile: + assert output_file + # Add in build.ninja so that the target will be considered dirty whenever + # gn gen is run. Otherwise, it will fail to notice new files being added. + # This is still no perfect, as it will fail if no build files are changed, + # but a new README.chromium / LICENSE is added. This shouldn't happen in + # practice however. + license_file_list = (entry['license_file'] for entry in entries) + license_file_list = (os.path.relpath(p) for p in license_file_list) + license_file_list = sorted(set(license_file_list)) + build_utils.WriteDepfile(depfile, output_file, + license_file_list + ['build.ninja']) + return True @@ -764,6 +777,7 @@ def main(): parser.add_argument('command', choices=['help', 'scan', 'credits', 'license_file']) parser.add_argument('output_file', nargs='?') + build_utils.AddDepfileOption(parser) args = parser.parse_args() if args.command == 'scan': @@ -772,7 +786,7 @@ def main(): elif args.command == 'credits': if not GenerateCredits(args.file_template, args.entry_template, args.output_file, args.target_os, - args.gn_out_dir, args.gn_target): + args.gn_out_dir, args.gn_target, args.depfile): return 1 elif args.command == 'license_file': try: |