diff --git a/ci/licenses_golden/excluded_files b/ci/licenses_golden/excluded_files index 2ab9d444732bc..ec6f5f08de71d 100644 --- a/ci/licenses_golden/excluded_files +++ b/ci/licenses_golden/excluded_files @@ -343,9 +343,6 @@ ../../../flutter/sky/tools/dist_dart_pkg.py ../../../flutter/sky/tools/install_framework_headers.py ../../../flutter/sky/tools/objcopy.py -../../../flutter/sky/tools/roll/patch.py -../../../flutter/sky/tools/roll/roll.py -../../../flutter/sky/tools/roll/utils.py ../../../flutter/testing ../../../flutter/third_party/accessibility/README.md ../../../flutter/third_party/accessibility/ax/ax_enum_util_unittest.cc diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index fb068a796a759..45673365f5ef5 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -5571,7 +5571,6 @@ FILE: ../../../flutter/shell/profiling/sampling_profiler.h FILE: ../../../flutter/shell/version/version.cc FILE: ../../../flutter/shell/version/version.h FILE: ../../../flutter/shell/vmservice/empty.dart -FILE: ../../../flutter/sky/tools/roll/patches/chromium/android_build.patch FILE: ../../../flutter/third_party/accessibility/base/color_utils.h FILE: ../../../flutter/third_party/accessibility/base/compiler_specific.h FILE: ../../../flutter/third_party/accessibility/base/container_utils.h diff --git a/ci/lint.sh b/ci/lint.sh index 05c6d94e87b79..adfc2be39c8f9 100755 --- a/ci/lint.sh +++ b/ci/lint.sh @@ -74,6 +74,7 @@ pylint-2.7 --rcfile=.pylintrc \ "build/" \ "ci/" \ "impeller/" \ + "sky/" \ "tools/gn" \ "testing/" diff --git a/sky/tools/create_full_ios_framework.py b/sky/tools/create_full_ios_framework.py index 3d46fc45850e9..6594b0f6d573d 100644 --- a/sky/tools/create_full_ios_framework.py +++ b/sky/tools/create_full_ios_framework.py @@ -13,7 +13,7 @@ import subprocess import sys -from create_xcframework import create_xcframework +from create_xcframework import create_xcframework # pylint: disable=import-error DSYMUTIL = os.path.join( os.path.dirname(__file__), '..', '..', '..', 'buildtools', 'mac-x64', @@ -39,8 +39,8 @@ def main(): parser.add_argument('--arm64-out-dir', type=str, required=True) parser.add_argument('--simulator-x64-out-dir', type=str, required=True) parser.add_argument('--simulator-arm64-out-dir', type=str, required=False) - parser.add_argument('--strip', action="store_true", default=False) - parser.add_argument('--dsym', action="store_true", default=False) + parser.add_argument('--strip', action='store_true', default=False) + parser.add_argument('--dsym', action='store_true', default=False) args = parser.parse_args() @@ -108,9 +108,10 @@ def main(): process_framework(args, dst, framework, framework_binary) generate_gen_snapshot(args, dst, x64_out_dir, arm64_out_dir) zip_archive(dst) + return 0 -def create_framework( +def create_framework( # pylint: disable=too-many-arguments args, dst, framework, arm64_framework, simulator_framework, simulator_x64_framework, simulator_arm64_framework ): @@ -122,7 +123,7 @@ def create_framework( return 1 if not os.path.isfile(simulator_x64_dylib): - print('Cannot find iOS simulator dylib at %s' % simulator_dylib) + print('Cannot find iOS simulator dylib at %s' % simulator_x64_dylib) return 1 shutil.rmtree(framework, True) @@ -143,12 +144,12 @@ def create_framework( process_framework( args, dst, simulator_framework, simulator_framework_binary ) - simulator_framework = simulator_framework else: simulator_framework = simulator_x64_framework - # Create XCFramework from the arm-only fat framework and the arm64/x64 simulator frameworks, or just the - # x64 simulator framework if only that one exists. + # Create XCFramework from the arm-only fat framework and the arm64/x64 + # simulator frameworks, or just the x64 simulator framework if only that one + # exists. xcframeworks = [simulator_framework, framework] create_xcframework(location=dst, name='Flutter', frameworks=xcframeworks) @@ -158,10 +159,12 @@ def create_framework( framework_binary ]) + return 0 + def embed_codesign_configuration(config_path, contents): - with open(config_path, 'w') as f: - f.write('\n'.join(contents) + '\n') + with open(config_path, 'w') as file: + file.write('\n'.join(contents) + '\n') def zip_archive(dst): @@ -189,7 +192,7 @@ def zip_archive(dst): 'without_entitlements.txt', ], cwd=dst) - if (os.path.exists(os.path.join(dst, 'Flutter.dSYM'))): + if os.path.exists(os.path.join(dst, 'Flutter.dSYM')): subprocess.check_call(['zip', '-r', 'Flutter.dSYM.zip', 'Flutter.dSYM'], cwd=dst) @@ -204,7 +207,7 @@ def process_framework(args, dst, framework, framework_binary): unstripped_out = os.path.join(dst, 'Flutter.unstripped') shutil.copyfile(framework_binary, unstripped_out) - subprocess.check_call(["strip", "-x", "-S", framework_binary]) + subprocess.check_call(['strip', '-x', '-S', framework_binary]) def generate_gen_snapshot(args, dst, x64_out_dir, arm64_out_dir): diff --git a/sky/tools/create_ios_framework.py b/sky/tools/create_ios_framework.py index e20c010656037..f0815df23d745 100755 --- a/sky/tools/create_ios_framework.py +++ b/sky/tools/create_ios_framework.py @@ -10,7 +10,7 @@ import sys import os -from create_xcframework import create_xcframework +from create_xcframework import create_xcframework # pylint: disable=import-error DSYMUTIL = os.path.join( os.path.dirname(__file__), '..', '..', '..', 'buildtools', 'mac-x64', @@ -31,8 +31,8 @@ def main(): '--simulator-x64-out-dir', '--simulator-out-dir', type=str, required=True ) parser.add_argument('--simulator-arm64-out-dir', type=str, required=False) - parser.add_argument('--strip', action="store_true", default=False) - parser.add_argument('--dsym', action="store_true", default=False) + parser.add_argument('--strip', action='store_true', default=False) + parser.add_argument('--dsym', action='store_true', default=False) args = parser.parse_args() @@ -64,7 +64,7 @@ def main(): return 1 if not os.path.isfile(simulator_x64_dylib): - print('Cannot find iOS simulator dylib at %s' % simulator_dylib) + print('Cannot find iOS simulator dylib at %s' % simulator_x64_dylib) return 1 if not os.path.isfile(DSYMUTIL): @@ -88,12 +88,12 @@ def main(): '-output', simulator_framework_binary ]) process_framework(args, simulator_framework, simulator_framework_binary) - simulator_framework = simulator_framework else: simulator_framework = simulator_x64_framework - # Create XCFramework from the arm-only fat framework and the arm64/x64 simulator frameworks, or just the - # x64 simulator framework if only that one exists. + # Create XCFramework from the arm-only fat framework and the arm64/x64 + # simulator frameworks, or just the x64 simulator framework if only that one + # exists. xcframeworks = [simulator_framework, framework] create_xcframework(location=args.dst, name='Flutter', frameworks=xcframeworks) @@ -104,6 +104,7 @@ def main(): ]) process_framework(args, framework, framework_binary) + return 0 def process_framework(args, framework, framework_binary): @@ -116,7 +117,7 @@ def process_framework(args, framework, framework_binary): unstripped_out = os.path.join(args.dst, 'Flutter.unstripped') shutil.copyfile(framework_binary, unstripped_out) - subprocess.check_call(["strip", "-x", "-S", framework_binary]) + subprocess.check_call(['strip', '-x', '-S', framework_binary]) if __name__ == '__main__': diff --git a/sky/tools/create_macos_framework.py b/sky/tools/create_macos_framework.py index dedd2d7237296..a354626ddc9e2 100755 --- a/sky/tools/create_macos_framework.py +++ b/sky/tools/create_macos_framework.py @@ -10,8 +10,6 @@ import sys import os -from create_xcframework import create_xcframework - buildroot_dir = os.path.abspath( os.path.join(os.path.realpath(__file__), '..', '..', '..', '..') ) @@ -32,10 +30,10 @@ def main(): parser.add_argument('--dst', type=str, required=True) parser.add_argument('--arm64-out-dir', type=str, required=True) parser.add_argument('--x64-out-dir', type=str, required=True) - parser.add_argument('--strip', action="store_true", default=False) - parser.add_argument('--dsym', action="store_true", default=False) + parser.add_argument('--strip', action='store_true', default=False) + parser.add_argument('--dsym', action='store_true', default=False) # TODO(godofredoc): Remove after recipes v2 have landed. - parser.add_argument('--zip', action="store_true", default=False) + parser.add_argument('--zip', action='store_true', default=False) args = parser.parse_args() @@ -93,6 +91,8 @@ def main(): ]) process_framework(dst, args, fat_framework, fat_framework_binary) + return 0 + def regenerate_symlinks(fat_framework): """Regenerates the symlinks structure. @@ -142,7 +142,7 @@ def process_framework(dst, args, fat_framework, fat_framework_binary): unstripped_out = os.path.join(dst, 'FlutterMacOS.unstripped') shutil.copyfile(fat_framework_binary, unstripped_out) - subprocess.check_call(["strip", "-x", "-S", fat_framework_binary]) + subprocess.check_call(['strip', '-x', '-S', fat_framework_binary]) # Zip FlutterMacOS.framework. if args.zip: diff --git a/sky/tools/create_macos_gen_snapshots.py b/sky/tools/create_macos_gen_snapshots.py index 4603bcd1c2abe..7bd1c6d0e8f8a 100755 --- a/sky/tools/create_macos_gen_snapshots.py +++ b/sky/tools/create_macos_gen_snapshots.py @@ -24,7 +24,7 @@ def main(): parser.add_argument('--x64-out-dir', type=str) parser.add_argument('--arm64-out-dir', type=str) parser.add_argument('--armv7-out-dir', type=str) - parser.add_argument('--zip', action="store_true", default=False) + parser.add_argument('--zip', action='store_true', default=False) args = parser.parse_args() diff --git a/sky/tools/create_xcframework.py b/sky/tools/create_xcframework.py index 889dea35d84a8..cfc389c2e77b4 100755 --- a/sky/tools/create_xcframework.py +++ b/sky/tools/create_xcframework.py @@ -5,7 +5,6 @@ # found in the LICENSE file. import argparse -import errno import os import shutil import subprocess @@ -46,7 +45,8 @@ def create_xcframework(location, name, frameworks): # Remove old xcframework. shutil.rmtree(output_xcframework) - # xcrun xcodebuild -create-xcframework -framework foo/baz.framework -framework bar/baz.framework -output output/ + # xcrun xcodebuild -create-xcframework -framework foo/baz.framework \ + # -framework bar/baz.framework -output output/ command = ['xcrun', 'xcodebuild', '-quiet', '-create-xcframework'] for framework in frameworks: diff --git a/sky/tools/install_framework_headers.py b/sky/tools/install_framework_headers.py index 4cc631d0e47f3..ab593930dcbe3 100755 --- a/sky/tools/install_framework_headers.py +++ b/sky/tools/install_framework_headers.py @@ -8,7 +8,6 @@ import errno import os import shutil -import subprocess import sys @@ -31,10 +30,10 @@ def main(): # Remove old headers. try: shutil.rmtree(os.path.normpath(args.location)) - except OSError as e: + except OSError as err: # Ignore only "not found" errors. - if e.errno != errno.ENOENT: - raise e + if err.errno != errno.ENOENT: + raise err # Create the directory to copy the files to. if not os.path.isdir(args.location): diff --git a/sky/tools/roll/patch.py b/sky/tools/roll/patch.py deleted file mode 100755 index 651f187f25b28..0000000000000 --- a/sky/tools/roll/patch.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright 2013 The Flutter Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import os -import subprocess -import utils - - -def patch_and_filter(dest_dir, relative_patches_dir): - os.chdir(dest_dir) - - utils.filter_file( - "build/landmines.py", lambda line: not "gyp_environment" in line - ) - utils.commit("filter gyp_environment out of build/landmines.py") - - patch(dest_dir, relative_patches_dir) - - -def patch(dest_dir, relative_patches_dir=os.curdir): - """Applies the *.patch files in |relative_patches_dir|. - - Args: - relative_patches_dir: A directory path relative to the current directory. - Defaults to the directory of this file. - - Raises: - subprocess.CalledProcessError if the patch couldn't be applied. - """ - patches_dir = os.path.join( - os.path.dirname(os.path.realpath(__file__)), relative_patches_dir - ) - assert os.path.isdir(patches_dir) - - os.chdir(dest_dir) - for p in utils.find(["*.patch"], patches_dir): - print("applying patch %s" % os.path.basename(p)) - try: - utils.system(["git", "apply", p]) - utils.commit("applied patch %s" % os.path.basename(p)) - except subprocess.CalledProcessError: - print("ERROR: patch %s failed to apply" % os.path.basename(p)) - raise diff --git a/sky/tools/roll/patches/chromium/android_build.patch b/sky/tools/roll/patches/chromium/android_build.patch deleted file mode 100644 index bd73b9e009c59..0000000000000 --- a/sky/tools/roll/patches/chromium/android_build.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- a/build/android/pylib/constants/__init__.py -+++ b/build/android/pylib/constants/__init__.py -@@ -184,7 +184,7 @@ class ANDROID_SDK_VERSION_CODES(object): - LOLLIPOP_MR1 = 22 - - ANDROID_SDK_VERSION = ANDROID_SDK_VERSION_CODES.LOLLIPOP_MR1 --ANDROID_SDK_BUILD_TOOLS_VERSION = '22.0.0' -+ANDROID_SDK_BUILD_TOOLS_VERSION = '22.0.1' - ANDROID_SDK_ROOT = os.path.join(DIR_SOURCE_ROOT, - 'third_party/android_tools/sdk') - ANDROID_SDK_TOOLS = os.path.join(ANDROID_SDK_ROOT, ---- a/build/common.gypi -+++ b/build/common.gypi -@@ -1682,7 +1682,7 @@ - 'android_host_arch%': '