From 194fb81209e1d924cc4fb8667ff7b90cb2b46a0b Mon Sep 17 00:00:00 2001 From: "P.Y. Laligand" Date: Thu, 4 Jan 2018 09:20:41 -0800 Subject: [PATCH] [fuchsia] Removed the flutter_app template. (#4511) It is moving to the Fuchsia codebase. --- BUILD.gn | 1 - build/aot_snapshot.py | 67 ----- build/flutter_app.gni | 413 ------------------------------ build/package.py | 66 ----- build/script_snapshot.py | 68 ----- examples/hello_flutter/BUILD.gn | 25 -- examples/spinning_square/BUILD.gn | 15 -- 7 files changed, 655 deletions(-) delete mode 100755 build/aot_snapshot.py delete mode 100644 build/flutter_app.gni delete mode 100755 build/package.py delete mode 100755 build/script_snapshot.py delete mode 100644 examples/hello_flutter/BUILD.gn delete mode 100644 examples/spinning_square/BUILD.gn diff --git a/BUILD.gn b/BUILD.gn index 9fb92a2befa55..510e4ce1ac0ec 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -25,7 +25,6 @@ group("flutter") { public_deps += [ "$flutter_root/content_handler:aot", "$flutter_root/content_handler:jit", - "$flutter_root/examples", "$flutter_root/flow", ] } diff --git a/build/aot_snapshot.py b/build/aot_snapshot.py deleted file mode 100755 index 51cbaa849e6c7..0000000000000 --- a/build/aot_snapshot.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env python -# Copyright 2016 The Chromium 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 subprocess -import os -import sys - - -def main(): - parser = argparse.ArgumentParser(description='Snapshot a Flutter application') - - parser.add_argument('--snapshotter-path', type=str, required=True, - help='The Flutter snapshotter') - - parser.add_argument('--main-dart', type=str, required=True, - help='The main.dart file to use') - - parser.add_argument('--url-mapping', type=str, action='append', - help='The main.dart file to use') - parser.add_argument('--entry-points-manifest', type=str, action='append', - help='The main.dart file to use') - - parser.add_argument('--packages', type=str, required=True, - help='The package map to use') - parser.add_argument('--assembly', type=str, required=True, - help='Where to output application assembly') - parser.add_argument('--depfile', type=str, required=True, - help='Where to output dependency information') - parser.add_argument('--root-build-dir', type=str, required=True, - help='The root build dir for --depfile and --snapshot') - parser.add_argument('--checked', default=False, action='store_true', - help='Enable checked mode') - - args = parser.parse_args() - - cmd = [ - args.snapshotter_path, - "--enable_mirrors=false", - "--await_is_keyword", - '--snapshot_kind=app-aot-assembly', - '--packages=%s' % args.packages, - '--assembly=%s' % args.assembly, - '--dependencies=%s' % args.depfile, - ] - for url_mapping in args.url_mapping: - cmd.append("--url_mapping=" + url_mapping) - for entry_points_manifest in args.entry_points_manifest: - cmd.append("--embedder_entry_points_manifest=" + entry_points_manifest) - if args.checked: - cmd.append('--enable_asserts') - cmd.append('--enable_type_checks') - cmd.append('--error_on_bad_type') - cmd.append('--error_on_bad_override') - cmd.append(args.main_dart) - - result = subprocess.call(cmd, cwd=args.root_build_dir) - if result != 0: - print("Command failed: '%s'" % (" ".join(cmd))) - - return result - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/build/flutter_app.gni b/build/flutter_app.gni deleted file mode 100644 index b3f74e148b22d..0000000000000 --- a/build/flutter_app.gni +++ /dev/null @@ -1,413 +0,0 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -assert(is_fuchsia || is_fuchsia_host) - -import("//build/dart/dart_package.gni") -import("//build/dart/toolchain.gni") -import("$flutter_root/lib/ui/dart_ui.gni") -import("//topaz/public/dart-pkg/fuchsia/sdk_ext.gni") -import("//topaz/public/dart-pkg/zircon/sdk_ext.gni") -import("//topaz/public/lib/ui/flutter/sdk_ext/sdk_ext.gni") - -declare_args() { - flutter_app_default_is_jit = is_debug -} - -gen_snapshot_label = "//third_party/dart/runtime/bin:gen_snapshot($host_toolchain)" -gen_snapshot_dir = get_label_info(gen_snapshot_label, "root_out_dir") -gen_snapshot = "$gen_snapshot_dir/gen_snapshot" - -flutter_base = "//third_party/dart-pkg/git/flutter" -flutter_tools_label = - "$flutter_base/packages/flutter_tools:fuchsia_builder($host_toolchain)" -flutter_tools_out_dir = get_label_info(flutter_tools_label, "root_out_dir") -flutter_tools_bin = "$flutter_tools_out_dir/dart-tools/fuchsia_builder" - -template("flutter_jit_app") { - assert(defined(invoker.main_dart), "Must define main_dart") - - dart_package_name = target_name + "_dart_package" - - dart_package(dart_package_name) { - forward_variables_from(invoker, - [ - "deps", - "disable_analysis", - "source_dir", - ]) - if (defined(invoker.package_name)) { - package_name = invoker.package_name - } else { - infer_package_name = true - } - } - - if (defined(invoker.output_name)) { - bundle_path = "$root_build_dir/${invoker.output_name}" - } else { - bundle_path = "$target_gen_dir/${target_name}.flx" - } - - flutter_core_snapshot_label = "$flutter_root/lib/snapshot:generate_snapshot_bin" - flutter_core_snapshot_gen_dir = - get_label_info(flutter_core_snapshot_label, "target_gen_dir") - flutter_core_snapshot_vm_data = - "$flutter_core_snapshot_gen_dir/vm_isolate_snapshot.bin" - flutter_core_snapshot_vm_instructions = - "$flutter_core_snapshot_gen_dir/vm_snapshot_instructions.bin" - flutter_core_snapshot_isolate_data = - "$flutter_core_snapshot_gen_dir/isolate_snapshot.bin" - flutter_core_snapshot_isolate_instructions = - "$flutter_core_snapshot_gen_dir/isolate_snapshot_instructions.bin" - - dart_target_gen_dir = get_label_info(":bogus($dart_toolchain)", "target_gen_dir") - dot_packages = "$dart_target_gen_dir/$dart_package_name.packages" - bundle_depfile = "$bundle_path.d" - snapshot_path = "$target_gen_dir/${target_name}_snapshot.bin" - snapshot_depfile = "${snapshot_path}.d" - - main_dart = invoker.main_dart - - script_snapshot_label = target_name + "_snapshot" - - action(script_snapshot_label) { - depfile = snapshot_depfile - - inputs = [ - main_dart, - flutter_core_snapshot_vm_data, - flutter_core_snapshot_vm_instructions, - flutter_core_snapshot_isolate_data, - flutter_core_snapshot_isolate_instructions, - ] - - outputs = [ - snapshot_path, - ] - - if (defined(invoker.sources)) { - sources = invoker.sources - } - - script = "$flutter_root/build/script_snapshot.py" - - args = [ - "--snapshotter-path", - rebase_path(gen_snapshot), - "--vm-snapshot-data", - rebase_path(flutter_core_snapshot_vm_data), - "--vm-snapshot-instructions", - rebase_path(flutter_core_snapshot_vm_instructions), - "--isolate-snapshot-data", - rebase_path(flutter_core_snapshot_isolate_data), - "--isolate-snapshot-instructions", - rebase_path(flutter_core_snapshot_isolate_instructions), - "--main-dart", - rebase_path(main_dart), - "--packages", - rebase_path(dot_packages), - "--snapshot", - rebase_path(snapshot_path, root_build_dir), - "--depfile", - rebase_path(snapshot_depfile), - "--root-build-dir", - rebase_path(root_build_dir), - ] - if (is_debug) { - args += [ "--checked" ] - } - - deps = [ - ":$dart_package_name", - flutter_core_snapshot_label, - gen_snapshot_label, - ] - - if (defined(invoker.deps)) { - deps += invoker.deps - } - } - - action(target_name) { - depfile = bundle_depfile - - inputs = [ - snapshot_path, - ] - if (defined(invoker.manifest)) { - inputs += [ rebase_path(invoker.manifest) ] - } - - outputs = [ - bundle_path, - ] - - script = "$flutter_root/build/package.py" - - args = [ - "--flutter-root", - rebase_path(flutter_base), - "--flutter-tools", - rebase_path(flutter_tools_bin), - "--working-dir", - rebase_path("$target_gen_dir/$target_name/build"), - "--app-dir", - rebase_path("."), - "--packages", - rebase_path(dot_packages), - "--output-file", - rebase_path(bundle_path), - "--snapshot", - rebase_path(snapshot_path), - "--build-root", - rebase_path(root_build_dir), - "--depfile", - rebase_path(bundle_depfile), - "--interpreter", - "flutter_jit_runner", - ] - if (defined(invoker.manifest)) { - args += [ - "--manifest", - rebase_path(invoker.manifest), - ] - } - - deps = [ - ":$script_snapshot_label", - flutter_tools_label, - ] - } -} - -template("flutter_aot_app") { - assert(defined(invoker.main_dart), "Must define main_dart") - - dart_package_name = target_name + "_dart_package" - - dart_package(dart_package_name) { - forward_variables_from(invoker, - [ - "deps", - "disable_analysis", - "source_dir", - ]) - if (defined(invoker.package_name)) { - package_name = invoker.package_name - } else { - infer_package_name = true - } - } - - if (defined(invoker.output_name)) { - bundle_path = "$root_build_dir/${invoker.output_name}" - } else { - bundle_path = "$target_gen_dir/${target_name}.flx" - } - - dart_target_gen_dir = get_label_info(":bogus($dart_toolchain)", "target_gen_dir") - dot_packages = "$dart_target_gen_dir/$dart_package_name.packages" - bundle_depfile = "$bundle_path.d" - assembly_path = "$target_gen_dir/$target_name.S" - assembly_depfile = "${assembly_path}.d" - - main_dart = invoker.main_dart - - assembly_label = target_name + "_assembly" - - action(assembly_label) { - depfile = assembly_depfile - - inputs = fuchsia_sdk_ext_files + zircon_sdk_ext_files + - mozart_dart_sdk_ext_files + - [ - main_dart, - "$flutter_root/runtime/dart_vm_entry_points.txt", - "$flutter_root/runtime/dart_vm_entry_points_fuchsia.txt", - "//third_party/dart/runtime/bin/dart_io_entries.txt", - ] - - outputs = [ - assembly_path, - ] - - if (defined(invoker.sources)) { - sources = invoker.sources - } - - script = "$flutter_root/build/aot_snapshot.py" - args = [ - "--snapshotter-path", - rebase_path(gen_snapshot), - "--assembly", - rebase_path(assembly_path, root_build_dir), - "--packages", - rebase_path(dot_packages), - "--depfile", - rebase_path(assembly_depfile), - - "--url-mapping", - "dart:ui," + rebase_path(dart_ui_path), - "--url-mapping", - "dart:zircon," + rebase_path(zircon_sdk_ext_lib), - "--url-mapping", - "dart:fuchsia," + rebase_path(fuchsia_sdk_ext_lib), - "--url-mapping", - "dart:mozart.internal," + rebase_path(mozart_dart_sdk_ext_lib), - "--url-mapping", - "dart:vmservice_io," + rebase_path( - "$dart_root_gen_dir/dart-pkg/sky_engine/sdk_ext/vmservice_io.dart"), - - "--entry-points-manifest", - rebase_path("$flutter_root/runtime/dart_vm_entry_points.txt"), - "--entry-points-manifest", - rebase_path("$flutter_root/runtime/dart_vm_entry_points_fuchsia.txt"), - "--entry-points-manifest", - rebase_path("//third_party/dart/runtime/bin/dart_io_entries.txt"), - - "--main-dart", - rebase_path(main_dart), - "--root-build-dir", - rebase_path(root_build_dir), - ] - if (is_debug) { - args += [ "--checked" ] - } - - deps = [ - ":$dart_package_name", - "$flutter_root/lib/snapshot:generate_dart_ui", - gen_snapshot_label, - ] - - if (defined(invoker.deps)) { - deps += invoker.deps - } - } - - dylib_label = target_name + "_dylib" - - outer_target_name = target_name - shared_library(dylib_label) { - deps = [ - ":$assembly_label", - ] - sources = [ - assembly_path, - ] - cflags = [ - "-nostdlib", - "-nostartfiles", - ] - output_dir = target_gen_dir - output_name = outer_target_name - } - - dylib_path = - get_label_info(":$dylib_label($shlib_toolchain)", "target_gen_dir") + - "/lib.unstripped/lib$target_name.so" - - action(target_name) { - depfile = bundle_depfile - - inputs = [ - dylib_path, - ] - if (defined(invoker.manifest)) { - inputs += [ rebase_path(invoker.manifest) ] - } - - outputs = [ - bundle_path, - ] - - script = "$flutter_root/build/package.py" - - args = [ - "--flutter-root", - rebase_path(flutter_base), - "--flutter-tools", - rebase_path(flutter_tools_bin), - "--working-dir", - rebase_path("$target_gen_dir/$target_name/build"), - "--app-dir", - rebase_path("."), - "--packages", - rebase_path(dot_packages), - "--output-file", - rebase_path(bundle_path), - "--dylib", - rebase_path(dylib_path), - "--build-root", - rebase_path(root_build_dir), - "--depfile", - rebase_path(bundle_depfile), - "--interpreter", - "flutter_aot_runner", - ] - if (defined(invoker.manifest)) { - args += [ - "--manifest", - rebase_path(invoker.manifest), - ] - } - - deps = [ - ":$dylib_label", - flutter_tools_label, - ] - } -} - -# Defines a Flutter application -# -# Parameters -# -# main_dart (required) -# Name of the Dart file containing the main function. -# -# package_name (optional) -# Name of the Dart package. -# -# output_name (optional) -# Name of output to generate. Defaults to $target_name.flx. -# -# deps (optional) -# List of Dart packages the application depends on. -# -# manifest (optional) -# Path to the manifest file -# -# disable_analysis (optional) -# Prevents analysis from being run on this target. -template("flutter_app") { - if (flutter_app_default_is_jit) { - flutter_jit_app(target_name) { - forward_variables_from(invoker, - [ - "main_dart", - "package_name", - "output_name", - "deps", - "manifest", - "disable_analysis", - "source_dir", - ]) - } - } else { - flutter_aot_app(target_name) { - forward_variables_from(invoker, - [ - "main_dart", - "package_name", - "output_name", - "deps", - "manifest", - "disable_analysis", - "source_dir", - ]) - } - } -} diff --git a/build/package.py b/build/package.py deleted file mode 100755 index e5d3cca477a13..0000000000000 --- a/build/package.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env python -# Copyright 2016 The Chromium 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 subprocess -import os -import sys - - -def main(): - parser = argparse.ArgumentParser(description='Package a Flutter application') - - parser.add_argument('--flutter-root', type=str, required=True, - help='The root of the Flutter SDK') - parser.add_argument('--flutter-tools', type=str, required=True, - help='The executable for the Flutter tool') - parser.add_argument('--working-dir', type=str, required=True, - help='The directory where to put intermediate files') - parser.add_argument('--app-dir', type=str, required=True, - help='The root of the app') - parser.add_argument('--packages', type=str, required=True, - help='The package map to use') - parser.add_argument('--snapshot', type=str, required=False, - help='Path to application snapshot') - parser.add_argument('--dylib', type=str, required=False, - help='Path to AOT dylib') - parser.add_argument('--output-file', type=str, required=True, - help='Where to output application bundle') - parser.add_argument('--build-root', type=str, required=True, - help='The build\'s root directory') - parser.add_argument('--depfile', type=str, required=True, - help='Where to output application bundle dependencies') - parser.add_argument('--interpreter', type=str, required=True, - help='') - parser.add_argument('--manifest', type=str, help='The application manifest') - - args = parser.parse_args() - - env = os.environ.copy() - env['FLUTTER_ROOT'] = args.flutter_root - - call_args = [ - args.flutter_tools, - '--working-dir=%s' % args.working_dir, - '--packages=%s' % args.packages, - '--output-file=%s' % args.output_file, - '--header=#!fuchsia %s' % args.interpreter, - '--build-root=%s' % args.build_root, - '--depfile=%s' % args.depfile, - ] - if args.snapshot != None: - call_args.append('--snapshot=%s' % args.snapshot) - if args.dylib != None: - call_args.append('--dylib=%s' % args.dylib) - if 'manifest' in args: - call_args.append('--manifest=%s' % args.manifest) - - result = subprocess.call(call_args, env=env, cwd=args.app_dir) - - return result - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/build/script_snapshot.py b/build/script_snapshot.py deleted file mode 100755 index 7548ba65a9aae..0000000000000 --- a/build/script_snapshot.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env python -# Copyright 2016 The Chromium 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 subprocess -import os -import sys - - -def main(): - parser = argparse.ArgumentParser(description='Snapshot a Flutter application') - - parser.add_argument('--snapshotter-path', type=str, required=True, - help='The Flutter snapshotter') - parser.add_argument('--vm-snapshot-data', type=str, required=True, - help='Path to vm_isolate_snapshot.bin') - parser.add_argument('--vm-snapshot-instructions', type=str, required=True, - help='Path to vm_isolate_snapshot.bin') - parser.add_argument('--isolate-snapshot-data', type=str, required=True, - help='Path to isolate_snapshot.bin') - parser.add_argument('--isolate-snapshot-instructions', type=str, required=True, - help='Path to isolate_snapshot.bin') - parser.add_argument('--main-dart', type=str, required=True, - help='The main.dart file to use') - parser.add_argument('--packages', type=str, required=True, - help='The package map to use') - parser.add_argument('--snapshot', type=str, required=True, - help='Where to output application snapshot') - parser.add_argument('--depfile', type=str, required=True, - help='Where to output dependency information') - parser.add_argument('--root-build-dir', type=str, required=True, - help='The root build dir for --depfile and --snapshot') - parser.add_argument('--checked', default=False, action='store_true', - help='Enable checked mode') - - args = parser.parse_args() - - cmd = [ - args.snapshotter_path, - '--enable_mirrors=false', - '--await_is_keyword', - '--snapshot_kind=script', - '--vm_snapshot_data=%s' % args.vm_snapshot_data, - '--vm_snapshot_instructions=%s' % args.vm_snapshot_instructions, - '--isolate_snapshot_data=%s' % args.isolate_snapshot_data, - '--isolate_snapshot_instructions=%s' % args.isolate_snapshot_instructions, - '--packages=%s' % args.packages, - '--script_snapshot=%s' % args.snapshot, - '--dependencies=%s' % args.depfile, - ] - if args.checked: - cmd.append('--enable_asserts') - cmd.append('--enable_type_checks') - cmd.append('--error_on_bad_type') - cmd.append('--error_on_bad_override') - cmd.append(args.main_dart) - - result = subprocess.call(cmd, cwd=args.root_build_dir) - if result != 0: - print("Command failed: '%s'" % (" ".join(cmd))) - - return result - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/examples/hello_flutter/BUILD.gn b/examples/hello_flutter/BUILD.gn deleted file mode 100644 index 914aa1b1aa5ac..0000000000000 --- a/examples/hello_flutter/BUILD.gn +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2016 The Chromium 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("$flutter_root/build/flutter_app.gni") - -flutter_jit_app("hello_flutter") { - main_dart = "lib/main.dart" - - disable_analysis = true - - deps = [ - "//third_party/dart-pkg/git/flutter/packages/flutter", - ] -} - -flutter_aot_app("hello_flutter_aot") { - main_dart = "lib/main.dart" - - disable_analysis = true - - deps = [ - "//third_party/dart-pkg/git/flutter/packages/flutter", - ] -} diff --git a/examples/spinning_square/BUILD.gn b/examples/spinning_square/BUILD.gn deleted file mode 100644 index 7f0be5d3fcf8d..0000000000000 --- a/examples/spinning_square/BUILD.gn +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2016 The Chromium 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("$flutter_root/build/flutter_app.gni") - -flutter_app("spinning_square") { - main_dart = "lib/main.dart" - - disable_analysis = true - - deps = [ - "//third_party/dart-pkg/git/flutter/packages/flutter", - ] -}