blob: 1157a5449c969bfc0627f29b6760bae0521e083a [file] [log] [blame]
#!/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.
#
# Builds and copies artifacts for the Flutter embedder from your
# local source of the Flutter Engine repository.
#
# Usage:
# build_and_copy_engine_artifacts.sh
#
# Requirements:
# 1. $ENGINE_DIR is set to the src/ directory of your flutter/engine checkout.
# 2. $FUCHSIA_EMBEDDER_DIR is set to your flutter-embedder.git checkout.
# 3. $DEPOT_TOOLS is set to your depot_tools directory.
set -e # Fail on any error.
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/echo_helpers.sh || exit $?
echo-info "Building the debug Flutter Engine embedding for Fuchsia (libflutter_engine.so)..."
"${ENGINE_DIR}"/flutter/tools/gn --fuchsia --embedder-for-target --unopt
debug_out_dir="${ENGINE_DIR}"/out/fuchsia_debug_unopt_x64
"${DEPOT_TOOLS}"/ninja -C "${debug_out_dir}"
echo-info "Copying debug Flutter Engine artifacts to ${FUCHSIA_EMBEDDER_DIR}/src/embedder/engine/debug_x64..."
cp "${debug_out_dir}"/libflutter_engine.so "${FUCHSIA_EMBEDDER_DIR}"/src/embedder/engine/debug_x64/libflutter_engine.so
echo-info "Copying embedder.h to ${FUCHSIA_EMBEDDER_DIR}/src/embedder/engine..."
cp "${ENGINE_DIR}"/flutter/shell/platform/embedder/embedder.h "${FUCHSIA_EMBEDDER_DIR}"/src/embedder/engine