Visitar URL original
Roll Dart SDK from e1bdb9ce3327 to 26d723eb89af (3 revisions) by rmacnak-google · Pull Request #188795 · flutter/flutter · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ vars = {
# updated revision list of existing dependencies. You will need to
# gclient sync before and after update deps to ensure all deps are updated.
# updated revision list of existing dependencies.
'dart_revision': 'e1bdb9ce3327c2d43f59edfb051d582a66f4f17f',
'dart_revision': '26d723eb89af5ee548a03dae0ec9fc581024e7e0',

# WARNING: DO NOT EDIT MANUALLY
# The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
Expand Down Expand Up @@ -321,7 +321,7 @@ deps = {
Var('dart_git') + '/leak_tracker.git@f5620600a5ce1c44f65ddaa02001e200b096e14c',

'engine/src/flutter/third_party/dart/third_party/pkg/native':
Var('dart_git') + '/native.git@b814f5393753e0cd752ce3ad733f5e66dd5949ce',
Var('dart_git') + '/native.git@4dab66c9aa059bc730c2fb86c5716eaac3bd9f4b',

'engine/src/flutter/third_party/dart/third_party/pkg/protobuf':
Var('dart_git') + '/protobuf.git' + '@' + Var('dart_protobuf_rev'),
Expand Down
16 changes: 0 additions & 16 deletions engine/src/flutter/shell/platform/fuchsia/dart/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,6 @@ application_snapshot("kernel_compiler") {
"--train",
rebase_path(main_dart),
]

kernel_compiler_files = exec_script("$dart_src/tools/list_dart_files.py",
[
"absolute",
rebase_path("."),
],
"list lines")

kernel_compiler_files += exec_script("$dart_src/tools/list_dart_files.py",
[
"absolute",
rebase_path("$dart_src/pkg"),
],
"list lines")

inputs = kernel_compiler_files

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the training input is the program itself, the depfile for the outer compilation already covers all the training inputs.

}

application_snapshot("_list_libraries_kernel") {
Expand Down
2 changes: 1 addition & 1 deletion engine/src/flutter/sky/packages/sky_engine/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -11194,6 +11194,7 @@ Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
--------------------------------------------------------------------------------
dart
flutter

Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
for details. All rights reserved. Use of this source code is governed by a
Expand Down Expand Up @@ -14253,7 +14254,6 @@ Copyright 2012 The Android Open Source Project
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
--------------------------------------------------------------------------------
dart
zlib

Copyright 2012 The Chromium Authors
Expand Down
2 changes: 1 addition & 1 deletion engine/src/flutter/web_sdk/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import("//flutter/lib/web_ui/flutter_js/sources.gni")
import("//flutter/web_sdk/web_sdk.gni")
import("$dart_src/build/dart/dart_action.gni")

web_ui_sources = exec_script("$dart_src/tools/list_dart_files.py",
web_ui_sources = exec_script("list_dart_files.py",
[
"absolute",
rebase_path("//flutter/lib/web_ui/lib"),
Expand Down
55 changes: 55 additions & 0 deletions engine/src/flutter/web_sdk/list_dart_files.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env python3
# Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.

"""Tool for listing Dart source files.

If the first argument is 'relative', the script produces paths relative to the
current working directory. If the first argument is 'absolute', the script
produces absolute paths.

Usage:
python3 tools/list_dart_files.py {absolute, relative} <directory> <pattern>
"""

import os
import re
import sys


def main(argv):
mode = argv[1]
if mode not in ['absolute', 'relative']:
raise Exception("First argument must be 'absolute' or 'relative'")
directory = argv[2]
Comment on lines +21 to +25

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The script does not check if enough arguments are provided before accessing argv[1] and argv[2]. If run with fewer than 3 arguments, it will crash with an unhandled IndexError. Consider checking len(argv) first and printing a helpful usage message. Additionally, raising a generic Exception is discouraged; using a more specific exception like ValueError is preferred.

Suggested change
def main(argv):
mode = argv[1]
if mode not in ['absolute', 'relative']:
raise Exception("First argument must be 'absolute' or 'relative'")
directory = argv[2]
def main(argv):
if len(argv) < 3:
print("Usage: list_dart_files.py {absolute, relative} <directory> [pattern]", file=sys.stderr)
return 1
mode = argv[1]
if mode not in ['absolute', 'relative']:
raise ValueError("First argument must be 'absolute' or 'relative'")
directory = argv[2]

if mode in 'absolute' and not os.path.isabs(directory):
directory = os.path.realpath(directory)
Comment on lines +26 to +27

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using mode in 'absolute' is non-idiomatic and potentially misleading. Since mode is validated to be either 'absolute' or 'relative', a direct equality check mode == 'absolute' is much clearer and less error-prone.

Suggested change
if mode in 'absolute' and not os.path.isabs(directory):
directory = os.path.realpath(directory)
if mode == 'absolute' and not os.path.isabs(directory):
directory = os.path.realpath(directory)


pattern = None
if len(argv) > 3:
pattern = re.compile(argv[3])

for root, directories, files in os.walk(directory):
# We only care about actual source files, not generated code or tests.
for skip_dir in ['.git', 'gen', 'test']:
if skip_dir in directories:
directories.remove(skip_dir)

# If we are looking at the root directory, filter the immediate
# subdirectories by the given pattern.
if pattern and root == directory:
directories[:] = filter(pattern.match, directories)
Comment on lines +41 to +42

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

According to the Google Python Style Guide (which this repository follows for Python code), list comprehensions are preferred over filter() as they are more concise and easier to read. Consider using a list comprehension here.

Suggested change
if pattern and root == directory:
directories[:] = filter(pattern.match, directories)
if pattern and root == directory:
directories[:] = [d for d in directories if pattern.match(d)]
References
  1. Python code should follow the Google Python Style Guide, which prefers list comprehensions over filter(). (link)


for filename in files:
if filename.endswith('.dart') and not filename.endswith('_test.dart'):
if mode in 'absolute':
fullname = os.path.join(directory, root, filename)
Comment on lines +46 to +47

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

  1. Use mode == 'absolute' instead of mode in 'absolute' for clarity and correctness.
  2. Since directory is converted to an absolute path on line 27, root (yielded by os.walk(directory)) is also an absolute path. Joining directory with root is redundant and can be simplified to os.path.join(root, filename).
Suggested change
if mode in 'absolute':
fullname = os.path.join(directory, root, filename)
if mode == 'absolute':
fullname = os.path.join(root, filename)

else:
fullname = os.path.relpath(os.path.join(root, filename))
fullname = fullname.replace(os.sep, '/')
print(fullname)


if __name__ == '__main__':
sys.exit(main(sys.argv))
Loading