17SRC_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
18ENGINE_DIR = os.path.join(SRC_ROOT,
'flutter')
21 os.path.join(ENGINE_DIR,
'ci'),
22 os.path.join(ENGINE_DIR,
'flutter_frontend_server'),
23 os.path.join(ENGINE_DIR,
'impeller',
'tessellator',
'dart'),
24 os.path.join(ENGINE_DIR,
'shell',
'vmservice'),
25 os.path.join(ENGINE_DIR,
'testing',
'benchmark'),
26 os.path.join(ENGINE_DIR,
'testing',
'dart'),
27 os.path.join(ENGINE_DIR,
'testing',
'litetest'),
28 os.path.join(ENGINE_DIR,
'testing',
'pkg_test_demo'),
29 os.path.join(ENGINE_DIR,
'testing',
'scenario_app'),
30 os.path.join(ENGINE_DIR,
'testing',
'skia_gold_client'),
31 os.path.join(ENGINE_DIR,
'testing',
'smoke_test_failure'),
32 os.path.join(ENGINE_DIR,
'testing',
'symbols'),
33 os.path.join(ENGINE_DIR,
'tools',
'android_lint'),
34 os.path.join(ENGINE_DIR,
'tools',
'api_check'),
35 os.path.join(ENGINE_DIR,
'tools',
'build_bucket_golden_scraper'),
36 os.path.join(ENGINE_DIR,
'tools',
'clang_tidy'),
37 os.path.join(ENGINE_DIR,
'tools',
'clangd_check'),
38 os.path.join(ENGINE_DIR,
'tools',
'compare_goldens'),
39 os.path.join(ENGINE_DIR,
'tools',
'const_finder'),
40 os.path.join(ENGINE_DIR,
'tools',
'dir_contents_diff'),
41 os.path.join(ENGINE_DIR,
'tools',
'engine_tool'),
42 os.path.join(ENGINE_DIR,
'tools',
'gen_web_locale_keymap'),
43 os.path.join(ENGINE_DIR,
'tools',
'githooks'),
44 os.path.join(ENGINE_DIR,
'tools',
'golden_tests_harvester'),
45 os.path.join(ENGINE_DIR,
'tools',
'header_guard_check'),
46 os.path.join(ENGINE_DIR,
'tools',
'licenses'),
47 os.path.join(ENGINE_DIR,
'tools',
'path_ops',
'dart'),
48 os.path.join(ENGINE_DIR,
'tools',
'pkg',
'engine_build_configs'),
49 os.path.join(ENGINE_DIR,
'tools',
'pkg',
'engine_repo_tools'),
50 os.path.join(ENGINE_DIR,
'tools',
'pkg',
'git_repo_tools'),
51 os.path.join(ENGINE_DIR,
'tools',
'pkg',
'process_fakes'),
57 subprocess.check_output(pub, cwd=package, stderr=subprocess.STDOUT)
58 except subprocess.CalledProcessError
as err:
60 '"%s" failed in "%s" with status %d:\n%s' %
61 (
' '.
join(pub), package, err.returncode, err.output)
68 package_config = os.path.join(package,
'.dart_tool',
'package_config.json')
70 with open(package_config)
as config_file:
71 data_dict = json.load(config_file)
72 packages_data = data_dict[
'packages']
73 for package_data
in packages_data:
74 package_uri = package_data[
'rootUri']
75 package_name = package_data[
'name']
76 if '.pub-cache' in package_uri
and (
'pub.dartlang.org' in package_uri
or
77 'pub.dev' in package_uri):
78 print(
'Error: package "%s" was fetched from pub' % package_name)
79 pub_count = pub_count + 1
81 print(
'Error: %d packages were fetched from pub for %s' % (pub_count, package))
83 'Please fix the pubspec.yaml for %s '
84 'so that all dependencies are path dependencies' % package
90 os.path.join(ENGINE_DIR,
'lib'),
91 os.path.join(ENGINE_DIR,
'prebuilts'),
92 os.path.join(ENGINE_DIR,
'shell',
'platform',
'fuchsia'),
93 os.path.join(ENGINE_DIR,
'shell',
'vmservice'),
94 os.path.join(ENGINE_DIR,
'sky',
'packages'),
95 os.path.join(ENGINE_DIR,
'testing',
'pkg_test_demo'),
96 os.path.join(ENGINE_DIR,
'third_party'),
97 os.path.join(ENGINE_DIR,
'web_sdk'),
106 for root, dirs, files
in os.walk(ENGINE_DIR):
109 full_dirname = os.path.join(root, dirname)
110 if full_dirname
in EXCLUDED_DIRS:
111 excluded.append(dirname)
112 for exclude
in excluded:
114 for filename
in files:
115 if filename ==
'pubspec.yaml':
116 if root
not in ALL_PACKAGES:
117 unlisted.append(root)
122 dart_sdk_bin = os.path.join(
123 SRC_ROOT,
'flutter',
'third_party',
'dart',
'tools',
'sdks',
'dart-sdk',
'bin'
128 if len(unlisted) > 0:
130 print(
'The Dart package "%s" must be checked in flutter/tools/pub_get_offline.py' % pkg)
136 pubcmd = [os.path.join(dart_sdk_bin, dart),
'pub',
'--suppress-analytics',
'get',
'--offline']
139 for package
in ALL_PACKAGES:
150if __name__ ==
'__main__':
def check_package(package)
def find_unlisted_packages()
def fetch_package(pub, package)
def print(*args, **kwargs)
static SkString join(const CommandLineFlags::StringArray &)