| # Copyright 2019 The Fuchsia 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("//topaz/runtime/flutter_runner/flutter_app.gni") |
| |
| template("settings_app") { |
| config = invoker.config |
| |
| base_sources = [ |
| "src/models/settings_model.dart", |
| "src/setting_entry.dart", |
| "src/widgets/all_settings.dart", |
| ] |
| |
| base_resources = [ |
| { |
| path = rebase_path(config) |
| dest = "settings.config" |
| }, |
| ] |
| |
| base_deps = [ |
| "//sdk/fidl/fuchsia.modular", |
| "//sdk/fidl/fuchsia.timezone", |
| "//sdk/fidl/fuchsia.ui.views", |
| "//sdk/fidl/fuchsia.wlan.service", |
| "//third_party/dart-pkg/git/flutter/packages/flutter", |
| "//third_party/dart-pkg/git/flutter/packages/flutter_test", |
| "//third_party/dart-pkg/pub/meta", |
| "//topaz/lib/settings:lib.settings", |
| "//topaz/public/dart/fuchsia_logger", |
| "//topaz/public/dart/fuchsia_modular", |
| "//topaz/public/dart/fuchsia_scenic_flutter", |
| "//topaz/public/dart/fuchsia_services", |
| "//topaz/public/dart/widgets:lib.widgets", |
| ] |
| |
| base_meta = [ |
| { |
| path = "//topaz/bin/settings/meta/settings.cmx" |
| dest = "settings.cmx" |
| }, |
| ] |
| |
| # We cannot define the flutter app as a component for the base/canonical |
| # target as tests target the dart library, which is only generated correctly |
| # when not defined as a component. |
| if (defined(invoker.extended) && invoker.extended) { |
| flutter_app(target_name) { |
| components = [ |
| { |
| component_name = "settings" |
| component_type = "flutter" |
| package_root = "//topaz/bin/settings" |
| main_dart = "//topaz/bin/settings/lib/main.dart" |
| sources = base_sources |
| deps = base_deps |
| }, |
| ] |
| manifest = "//topaz/bin/settings/pubspec.yaml" |
| |
| meta = base_meta |
| |
| resources = base_resources |
| } |
| } else { |
| flutter_app(target_name) { |
| main_dart = "lib/main.dart" |
| |
| package_name = "settings" |
| |
| manifest = "pubspec.yaml" |
| |
| meta = base_meta |
| |
| sources = base_sources |
| |
| resources = base_resources |
| |
| deps = base_deps |
| } |
| } |
| } |
| |
| # Defines a Flutter app target for the Settings app. |
| # |
| # This template allows products to have custom settings app by |
| # specifying a unique settings.config file specifying the options |
| # shown. It is important extended_settings_app is used and not settings_app, |
| # which is reserved for the topaz copy for generating the proper test artifacts. |
| # |
| # config (required) |
| # The file name of the settings configuration file defining what |
| # will be shown. see //topaz/bin/settings/settings.config as an |
| # example. The file should exist at the same root folder as |
| # template usage. |
| # |
| template("extended_settings_app") { |
| extended = true |
| settings_app(target_name) { |
| forward_variables_from(invoker, "*") |
| } |
| } |