Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
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
24 changes: 5 additions & 19 deletions build/copy_info_plist.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@

def get_clang_version():
clang_executable = str(
os.path.join(
'..', '..', 'buildtools', 'mac-x64', 'clang', 'bin', 'clang++'
)
os.path.join('..', '..', 'buildtools', 'mac-x64', 'clang', 'bin', 'clang++')
)
version = subprocess.check_output([clang_executable, '--version'])
return version.splitlines()[0]
Expand All @@ -39,32 +37,20 @@ def main():
)

parser.add_argument(
'--source',
help='Path to Info.plist source template',
type=str,
required=True
'--source', help='Path to Info.plist source template', type=str, required=True
)
parser.add_argument(
'--destination',
help='Path to destination Info.plist',
type=str,
required=True
)
parser.add_argument(
'--minversion', help='Minimum device OS version like "9.0"', type=str
'--destination', help='Path to destination Info.plist', type=str, required=True
)
parser.add_argument('--minversion', help='Minimum device OS version like "9.0"', type=str)

args = parser.parse_args()

text = open(args.source).read()
engine_path = os.path.join(os.getcwd(), '..', '..', 'flutter')
revision = git_revision.get_repository_version(engine_path)
clang_version = get_clang_version()
text = text.format(
revision=revision,
clang_version=clang_version,
min_version=args.minversion
)
text = text.format(revision=revision, clang_version=clang_version, min_version=args.minversion)

with open(args.destination, 'w') as outfile:
outfile.write(text)
Expand Down
43 changes: 9 additions & 34 deletions build/dart/tools/dart_pkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

USE_LINKS = sys.platform != 'win32'

DART_ANALYZE = os.path.join(
os.path.dirname(os.path.abspath(__file__)), 'dart_analyze.py'
)
DART_ANALYZE = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'dart_analyze.py')


def dart_filter(path):
Expand Down Expand Up @@ -164,10 +162,7 @@ def analyze_entrypoints(dart_sdk, package_root, entrypoints):
def main():
parser = argparse.ArgumentParser(description='Generate a dart-pkg')
parser.add_argument(
'--dart-sdk',
action='store',
metavar='dart_sdk',
help='Path to the Dart SDK.'
'--dart-sdk', action='store', metavar='dart_sdk', help='Path to the Dart SDK.'
)
parser.add_argument(
'--package-name',
Expand All @@ -183,28 +178,14 @@ def main():
required=True
)
parser.add_argument(
'--package-root',
metavar='package_root',
help='packages/ directory',
required=True
)
parser.add_argument(
'--stamp-file',
metavar='stamp_file',
help='timestamp file',
required=True
'--package-root', metavar='package_root', help='packages/ directory', required=True
)
parser.add_argument('--stamp-file', metavar='stamp_file', help='timestamp file', required=True)
parser.add_argument(
'--entries-file',
metavar='entries_file',
help='script entries file',
required=True
'--entries-file', metavar='entries_file', help='script entries file', required=True
)
parser.add_argument(
'--package-sources',
metavar='package_sources',
help='Package sources',
nargs='+'
'--package-sources', metavar='package_sources', help='Package sources', nargs='+'
)
parser.add_argument(
'--package-entrypoints',
Expand Down Expand Up @@ -259,16 +240,12 @@ def main():
sdkext_path = os.path.join(lib_path, '_sdkext')
if mappings:
with open(sdkext_path, 'w') as stream:
json.dump(
mappings, stream, sort_keys=True, indent=2, separators=(',', ': ')
)
json.dump(mappings, stream, sort_keys=True, indent=2, separators=(',', ': '))
else:
remove_if_exists(sdkext_path)

# Copy or symlink package sources into pkg directory.
common_source_prefix = os.path.dirname(
os.path.commonprefix(args.package_sources)
)
common_source_prefix = os.path.dirname(os.path.commonprefix(args.package_sources))
for source in args.package_sources:
relative_source = os.path.relpath(source, common_source_prefix)
target = os.path.join(target_dir, relative_source)
Expand All @@ -291,9 +268,7 @@ def main():
target = os.path.join(sdk_ext_dir, relative_source)
copy_or_link(source, target)

common_source_prefix = os.path.dirname(
os.path.commonprefix(args.sdk_ext_files)
)
common_source_prefix = os.path.dirname(os.path.commonprefix(args.sdk_ext_files))
for source in args.sdk_ext_files:
relative_source = os.path.relpath(source, common_source_prefix)
target = os.path.join(sdk_ext_dir, relative_source)
Expand Down
20 changes: 5 additions & 15 deletions build/generate_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,15 @@


def get_llvm_bin_directory():
buildtool_dir = os.path.join(
os.path.dirname(os.path.realpath(__file__)), '../../buildtools'
)
buildtool_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../buildtools')
platform_dir = ''
if sys.platform.startswith('linux'):
platform_dir = 'linux-x64'
elif sys.platform == 'darwin':
platform_dir = 'mac-x64'
else:
raise Exception('Unknown/Unsupported platform.')
llvm_bin_dir = os.path.abspath(
os.path.join(buildtool_dir, platform_dir, 'clang/bin')
)
llvm_bin_dir = os.path.abspath(os.path.join(buildtool_dir, platform_dir, 'clang/bin'))
if not os.path.exists(llvm_bin_dir):
raise Exception('LLVM directory %s double not be located.' % llvm_bin_dir)
return llvm_bin_dir
Expand Down Expand Up @@ -61,9 +57,7 @@ def collect_profiles(args):
print('Path %s does not exist.' % absolute_test_path)
return -1

unstripped_test_path = os.path.join(
absolute_test_dir, 'exe.unstripped', test_name
)
unstripped_test_path = os.path.join(absolute_test_dir, 'exe.unstripped', test_name)

if os.path.exists(unstripped_test_path):
binaries.append(unstripped_test_path)
Expand All @@ -74,10 +68,7 @@ def collect_profiles(args):

remove_if_exists(raw_profile)

print(
'Running test %s to gather profile.' %
os.path.basename(absolute_test_path)
)
print('Running test %s to gather profile.' % os.path.basename(absolute_test_path))

test_command = [absolute_test_path]

Expand Down Expand Up @@ -105,8 +96,7 @@ def merge_profiles(llvm_bin_dir, raw_profiles, output):
print('Merging %d raw profile(s) into single profile.' % len(raw_profiles))
merged_profile_path = os.path.join(output, 'all.profile')
remove_if_exists(merged_profile_path)
merge_command = [profdata_binary, 'merge', '-sparse'
] + raw_profiles + ['-o', merged_profile_path]
merge_command = [profdata_binary, 'merge', '-sparse'] + raw_profiles + ['-o', merged_profile_path]
subprocess.check_call(merge_command)
print('Done.')
return merged_profile_path
Expand Down
5 changes: 1 addition & 4 deletions build/git_revision.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ def main():
parser = argparse.ArgumentParser()

parser.add_argument(
'--repository',
action='store',
help='Path to the Git repository.',
required=True
'--repository', action='store', help='Path to the Git repository.', required=True
)

args = parser.parse_args()
Expand Down
20 changes: 4 additions & 16 deletions build/zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,10 @@ def _zip_dir(path, zip_file, prefix):
for file in files:
if os.path.islink(os.path.join(root, file)):
add_symlink(
zip_file, os.path.join(root, file),
os.path.join(root.replace(path, prefix), file)
zip_file, os.path.join(root, file), os.path.join(root.replace(path, prefix), file)
)
continue
zip_file.write(
os.path.join(root, file),
os.path.join(root.replace(path, prefix), file)
)
zip_file.write(os.path.join(root, file), os.path.join(root.replace(path, prefix), file))


def add_symlink(zip_file, source, target):
Expand Down Expand Up @@ -80,12 +76,7 @@ def main(args):

if __name__ == '__main__':
parser = argparse.ArgumentParser(description='This script creates zip files.')
parser.add_argument(
'-o',
dest='output',
action='store',
help='The name of the output zip file.'
)
parser.add_argument('-o', dest='output', action='store', help='The name of the output zip file.')
parser.add_argument(
'-i',
dest='input_pairs',
Expand All @@ -94,9 +85,6 @@ def main(args):
help='The input file and its destination location in the zip archive.'
)
parser.add_argument(
'-f',
dest='source_file',
action='store',
help='The path to the file list to zip.'
'-f', dest='source_file', action='store', help='The path to the file list to zip.'
)
sys.exit(main(parser.parse_args()))
9 changes: 7 additions & 2 deletions ci/builders/linux_unopt.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@
},
"tests": [
{
"name": "test:format_and_dart_test",
"script": "flutter/ci/format.sh"
"name": "test: Check formatting",
"script": "flutter/bin/et",
"parameters": [
"format",
"--dry-run",
"--all"
]
},
{
"nane": "test:GeneratedPluginRegistant.java omitted",
Expand Down
3 changes: 1 addition & 2 deletions ci/compatibility_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ def byte_str_decode(str_or_bytes):
the possible value changes depending on the version of python
used.
"""
return str_or_bytes if isinstance(str_or_bytes,
str) else str_or_bytes.decode(ENCODING)
return str_or_bytes if isinstance(str_or_bytes, str) else str_or_bytes.decode(ENCODING)
8 changes: 2 additions & 6 deletions ci/impeller_cmake_build_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
# out/impeller-cmake-example, so the build can then be performed with
# e.g. ninja -C out/impeller-cmake-example-out.

SRC_ROOT = os.path.dirname(
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
)
SRC_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))


def parse_args(argv):
Expand Down Expand Up @@ -122,9 +120,7 @@ def main(argv):
return 0

if args.cmake:
cmake_path = os.path.join(
SRC_ROOT, 'buildtools', 'mac-x64', 'cmake', 'bin', 'cmake'
)
cmake_path = os.path.join(SRC_ROOT, 'buildtools', 'mac-x64', 'cmake', 'bin', 'cmake')
cmake_command = [
cmake_path,
'--preset',
Expand Down
40 changes: 11 additions & 29 deletions ci/scan_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,20 @@ def extract_deps(deps_file):
continue

dep_split = dep.rsplit('@', 1)
ancestor_result = get_common_ancestor([dep_split[0], dep_split[1]],
deps_list)
ancestor_result = get_common_ancestor([dep_split[0], dep_split[1]], deps_list)
if ancestor_result:
filtered_osv_deps.append({
'package': {'name': ancestor_result[1], 'commit': ancestor_result[0]}
})

try:
# Clean up cloned upstream dependency directory.
shutil.rmtree(
DEP_CLONE_DIR
) # Use shutil.rmtree since dir could be non-empty.
shutil.rmtree(DEP_CLONE_DIR) # Use shutil.rmtree since dir could be non-empty.
except OSError as clone_dir_error:
print(
'Error cleaning up clone directory: %s : %s' %
(DEP_CLONE_DIR, clone_dir_error.strerror)
)
print('Error cleaning up clone directory: %s : %s' % (DEP_CLONE_DIR, clone_dir_error.strerror))

osv_result = {
'packageSource': {'path': deps_file, 'type': 'lockfile'},
'packages': filtered_osv_deps
'packageSource': {'path': deps_file, 'type': 'lockfile'}, 'packages': filtered_osv_deps
}
return osv_result

Expand Down Expand Up @@ -150,19 +143,12 @@ def get_common_ancestor(dep, deps_list):
upstream = deps_list.get(UPSTREAM_PREFIX + dep_name)
temp_dep_dir = DEP_CLONE_DIR + '/' + dep_name
# Clone dependency from mirror.
subprocess.check_output(['git', 'clone', '--quiet', '--', dep[0], dep_name],
cwd=DEP_CLONE_DIR)
subprocess.check_output(['git', 'clone', '--quiet', '--', dep[0], dep_name], cwd=DEP_CLONE_DIR)

# Create branch that will track the upstream dep.
print(
'attempting to add upstream remote from: {upstream}'.format(
upstream=upstream
)
)
subprocess.check_output(['git', 'remote', 'add', 'upstream', upstream],
cwd=temp_dep_dir)
subprocess.check_output(['git', 'fetch', '--quiet', 'upstream'],
cwd=temp_dep_dir)
print('attempting to add upstream remote from: {upstream}'.format(upstream=upstream))
subprocess.check_output(['git', 'remote', 'add', 'upstream', upstream], cwd=temp_dep_dir)
subprocess.check_output(['git', 'fetch', '--quiet', 'upstream'], cwd=temp_dep_dir)
# Get name of the default branch for upstream (e.g. main/master/etc.).
default_branch = subprocess.check_output(
'git remote show upstream ' + "| sed -n \'/HEAD branch/s/.*: //p\'",
Expand All @@ -174,14 +160,12 @@ def get_common_ancestor(dep, deps_list):

# Make upstream branch track the upstream dep.
subprocess.check_output([
'git', 'checkout', '--force', '-b', 'upstream', '--track',
'upstream/' + default_branch
'git', 'checkout', '--force', '-b', 'upstream', '--track', 'upstream/' + default_branch
],
cwd=temp_dep_dir)
# Get the most recent commit from default branch of upstream.
commit = subprocess.check_output(
'git for-each-ref ' +
"--format=\'%(objectname:short)\' refs/heads/upstream",
'git for-each-ref ' + "--format=\'%(objectname:short)\' refs/heads/upstream",
cwd=temp_dep_dir,
shell=True
)
Expand Down Expand Up @@ -211,9 +195,7 @@ def get_common_ancestor(dep, deps_list):

def parse_args(args):
args = args[1:]
parser = argparse.ArgumentParser(
description='A script to find common ancestor commit SHAs'
)
parser = argparse.ArgumentParser(description='A script to find common ancestor commit SHAs')

parser.add_argument(
'--deps',
Expand Down
4 changes: 2 additions & 2 deletions display_list/skia/dl_sk_conversions_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ TEST(DisplayListSkConversions, ToSkSamplingOptions) {
FUNC(kLastSeparableMode) \
FUNC(kLastMode)

TEST(DisplayListSkConversions, ToSkBlendMode) {
TEST(DisplayListSkConversions, ToSkBlendMode){
#define CHECK_TO_SKENUM(V) ASSERT_EQ(ToSk(DlBlendMode::V), SkBlendMode::V);
FOR_EACH_BLEND_MODE_ENUM(CHECK_TO_SKENUM)
FOR_EACH_BLEND_MODE_ENUM(CHECK_TO_SKENUM)
#undef CHECK_TO_SKENUM
}

Expand Down
4 changes: 2 additions & 2 deletions display_list/testing/dl_rendering_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2232,8 +2232,8 @@ class CanvasCompareTester {
return DirectoryStatus::kCreated;
}
FML_LOG(ERROR) << "Could not create directory (" << dir
<< ") for impeller failure images"
<< ", ret = " << ret.get() << ", errno = " << errno;
<< ") for impeller failure images" << ", ret = " << ret.get()
<< ", errno = " << errno;
return DirectoryStatus::kFailed;
}

Expand Down
Loading