diff --git a/DEPS b/DEPS index 01885710057..4c499021bea 100644 --- a/DEPS +++ b/DEPS @@ -34,7 +34,6 @@ vars = { # channels. This variable is being set when CI is checking out the repository. 'release_candidate': False, - # As Dart does, we use Fuchsia's GN and Clang toolchain. These revision # should be kept up to date with the revisions pulled by Dart. # The list of revisions for these tools comes from Fuchsia, here: @@ -101,6 +100,8 @@ vars = { # Setup Git hooks by default. "setup_githooks": True, + 'download_impeller_cmake_example': False, + # Upstream URLs for third party dependencies, used in # determining common ancestor commit for vulnerability scanning # prefixed with 'upstream_' in order to be identified by parsing tool. @@ -825,9 +826,8 @@ deps = { 'dep_type': 'cipd', }, - # Get the SDK from https://chrome-infra-packages.appspot.com/p/fuchsia/sdk/core at the 'latest' tag - # Get the toolchain from https://chrome-infra-packages.appspot.com/p/fuchsia/clang at the 'goma' tag - + # Get the SDK from https://chrome-infra-packages.appspot.com/p/fuchsia/sdk/core at the 'latest' tag + # Get the toolchain from https://chrome-infra-packages.appspot.com/p/fuchsia/clang at the 'goma' tag 'src/fuchsia/sdk/mac': { 'packages': [ { @@ -848,6 +848,11 @@ deps = { 'condition': 'host_os == "linux" and not download_fuchsia_sdk', 'dep_type': 'cipd', }, + + 'src/third_party/impeller-cmake-example': { + 'url': Var('github_git') + '/bdero/impeller-cmake-example.git' + '@' + '4d728722ac1559f59db28a3ef061fe929d6be4c6', + 'condition': 'download_impeller_cmake_example', + }, } recursedeps = [ @@ -952,5 +957,17 @@ hooks = [ 'python3', 'src/flutter/tools/githooks/setup.py', ] + }, + { + 'name': 'impeller-cmake-example submodules', + 'pattern': '.', + 'condition': 'download_impeller_cmake_example', + 'action': [ + 'python3', + 'src/flutter/ci/impeller_cmake_build_test.py', + '--path', + 'third_party/impeller-cmake-example', + '--setup', + ] } ] diff --git a/engine/src/flutter/.ci.yaml b/engine/src/flutter/.ci.yaml index 97f4a26d143..c89b7890e8d 100644 --- a/engine/src/flutter/.ci.yaml +++ b/engine/src/flutter/.ci.yaml @@ -444,6 +444,21 @@ targets: {"dependency": "jazzy", "version": "0.14.1"} ] + - name: Mac impeller-cmake-example + bringup: true + recipe: engine_v2/engine_v2 + timeout: 60 + properties: + release_build: "true" + config_name: impeller_cmake_build_test + $flutter/osx_sdk : >- + { "sdk_version": "14a5294e" } + dependencies: >- + [ + {"dependency": "cmake", "version": "build_id:8784715802296535313"}, + {"dependency": "jazzy", "version": "0.14.1"} + ] + - name: Windows Android AOT Engine recipe: engine/engine properties: diff --git a/engine/src/flutter/ci/builders/mac_impeller_cmake_example.json b/engine/src/flutter/ci/builders/mac_impeller_cmake_example.json new file mode 100644 index 00000000000..7c16ab94626 --- /dev/null +++ b/engine/src/flutter/ci/builders/mac_impeller_cmake_example.json @@ -0,0 +1,38 @@ +{ + "builds": [ + { + "name": "impeller_cmake_build_test", + "archives": [], + "drone_dimensions": [ + "device_type=none", + "os=Mac-12", + "cpu=x86" + ], + "gclient_custom_vars": { + "download_android_deps": false, + "download_impeller_cmake_example": true + }, + "tests": [ + { + "language": "python3", + "name": "cmake", + "script": "flutter/ci/impeller_cmake_build_test.py", + "parameters": [ + "--cmake" + ], + "type": "local" + }, + { + "language": "python3", + "name": "build", + "script": "flutter/ci/impeller_cmake_build_test.py", + "parameters": [ + "--build" + ], + "type": "local" + } + ] + } + ], + "tests": [] +} diff --git a/engine/src/flutter/ci/impeller_cmake_build_test.py b/engine/src/flutter/ci/impeller_cmake_build_test.py new file mode 100644 index 00000000000..17946c63ffd --- /dev/null +++ b/engine/src/flutter/ci/impeller_cmake_build_test.py @@ -0,0 +1,163 @@ +#!/usr/bin/env vpython3 +# 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 argparse +import os +import subprocess +import sys + +SRC_ROOT = os.path.dirname( + os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +) + + +def parse_args(argv): + parser = argparse.ArgumentParser( + description='A script that tests the impeller-cmake-example build.', + ) + parser.add_argument( + '--build', + '-b', + default=False, + action='store_true', + help='Perform the build for impeller-cmake-example.', + ) + parser.add_argument( + '--cmake', + '-c', + default=False, + action='store_true', + help='Run cmake for impeller-cmake-example.', + ) + parser.add_argument( + '--goma-dir', + '-g', + type=str, + default=os.getenv('GOMA_DIR'), + help=( + 'The path to the Goma install. Defaults to the value of the ' + 'GOMA_DIR environment variable.' + ), + ) + parser.add_argument( + '--path', + '-p', + type=str, + help='The path to the impeller-cmake-example source.', + ) + parser.add_argument( + '--setup', + '-s', + default=False, + action='store_true', + help='Clone the git submodules.', + ) + parser.add_argument( + '--verbose', + '-v', + default=False, + action='store_true', + help='Emit verbose output.', + ) + parser.add_argument( + '--xcode-symlink', + default=False, + action='store_true', + help='Symlink the Xcode sysroot to help Goma be successful.', + ) + return parser.parse_args(argv) + + +def validate_args(args): + if not os.path.isdir(os.path.join(SRC_ROOT, args.path)): + print( + 'The --path argument must be a valid directory relative to the ' + 'engine src/ directory.' + ) + return False + + return True + + +def create_xcode_symlink(): + find_sdk_command = [ + 'python3', + os.path.join(SRC_ROOT, 'build', 'mac', 'find_sdk.py'), + '--print_sdk_path', + '10.15', + '--symlink', + os.path.join(SRC_ROOT, 'out', 'impeller-cmake-example-xcode-sysroot'), + ] + find_sdk_output = subprocess.check_output(find_sdk_command).decode('utf-8') + print(find_sdk_output) + sysroot_path = find_sdk_output.split('\n')[0] + print('sysroot path = {}'.format(sysroot_path)) + return sysroot_path + + +def main(argv): + args = parse_args(argv[1:]) + if not validate_args(args): + return 1 + + impeller_cmake_dir = os.path.join(SRC_ROOT, args.path) + + if args.setup: + print('git submodule update with {} jobs'.format(str(os.cpu_count()))) + git_command = [ + 'git', + '-C', + impeller_cmake_dir, + 'submodule', + 'update', + '--init', + '--recursive', + # '--single-branch', + '--depth', + '1', + '--jobs', + str(os.cpu_count()), + ] + subprocess.check_call(git_command) + + # Run the deps.sh shell script in the repo. + subprocess.check_call(['bash', 'deps.sh'], cwd=impeller_cmake_dir) + return 0 + + if args.cmake: + cmake_command = [ + 'cmake', + '--preset', + 'flutter-ci-mac-debug-x64', + '-B', + os.path.join(SRC_ROOT, 'out', 'impeller-cmake-example-out'), + ] + cmake_env = os.environ.copy() + cmake_env.update({ + 'FLUTTER_ENGINE_SRC_DIR': SRC_ROOT, + 'FLUTTER_GOMA_DIR': args.goma_dir, + }) + if args.xcode_symlink: + xcode_symlink_path = create_xcode_symlink() + cmake_env.update({ + 'FLUTTER_OSX_SYSROOT': xcode_symlink_path, + }) + subprocess.check_call(cmake_command, env=cmake_env, cwd=impeller_cmake_dir) + + if args.build: + ninja_command = [ + 'ninja', + '-C', + os.path.join(SRC_ROOT, 'out', 'impeller-cmake-example-out'), + '-j', + '200', + ] + subprocess.check_call(ninja_command) + + return 0 + + +if __name__ == '__main__': + sys.exit(main(sys.argv))