| #!/bin/bash |
| # Copyright 2022 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. |
| # |
| # Prerequisites: |
| # 1. $FUCHSIA_EMBEDDER_DIR is set to your flutter-embedder.git checkout directory. |
| # 2. You are currently running Workstation (`ffx emu start --headless workstation.qemu-x64`). |
| # |
| # TODO(akbiggs): Port this workflow to Bazel. |
| |
| set -e # Exit if any program returns an error. |
| APP_NAME=flutter_sample_app |
| FAR_DEBUG_DIR=/tmp/"${APP_NAME}"_far_contents |
| |
| function is-stderr-tty { |
| [[ -t 2 ]] |
| } |
| |
| # echo-info prints a line to stderr with a green INFO: prefix. |
| function echo-info { |
| if is-stderr-tty; then |
| echo -e >&2 "\033[1;32mINFO:\033[0m $*" |
| else |
| echo -e >&2 "INFO: $*" |
| fi |
| } |
| |
| pushd "${FUCHSIA_EMBEDDER_DIR}" |
| |
| echo-info "Building Flutter sample app bundle." |
| cd "${FUCHSIA_EMBEDDER_DIR}"/src/examples/"${APP_NAME}" |
| "${FUCHSIA_EMBEDDER_DIR}"/tools/flutter build bundle |
| |
| echo-info "Running Flutter sample app." |
| cd "${FUCHSIA_EMBEDDER_DIR}" |
| bazel run --config=fuchsia_x64 //src/examples/"${APP_NAME}":"${APP_NAME}"_pkg.component -- --session |
| |
| popd |