From 5b6518d416caea04920a914542a17eec77fbfa81 Mon Sep 17 00:00:00 2001 From: Darren Chan <74682667+chandarrengoog@users.noreply.github.com> Date: Thu, 27 May 2021 19:49:02 -0400 Subject: [PATCH] Add debug symbols (symbol-index) to serve.sh for Fuchsia. (flutter/engine#26463) --- .../tools/fuchsia/devshell/lib/vars.sh | 1 - .../flutter/tools/fuchsia/devshell/serve.sh | 31 +++++++++----- .../tools/fuchsia/fuchsia_debug_symbols.gni | 40 ------------------- 3 files changed, 22 insertions(+), 50 deletions(-) diff --git a/engine/src/flutter/tools/fuchsia/devshell/lib/vars.sh b/engine/src/flutter/tools/fuchsia/devshell/lib/vars.sh index 0839363559..e77b131316 100644 --- a/engine/src/flutter/tools/fuchsia/devshell/lib/vars.sh +++ b/engine/src/flutter/tools/fuchsia/devshell/lib/vars.sh @@ -13,7 +13,6 @@ fi # Note: if this file location changes this path needs to change FLUTTER_ENGINE_SRC_DIR="$(dirname "$(dirname "$(dirname "$(dirname "$(dirname "${devshell_lib_dir}")")")")")" export FLUTTER_ENGINE_SRC_DIR -export FLUTTER_ENGINE_OUT_DIR="${FLUTTER_ENGINE_OUT_DIR:-${FLUTTER_ENGINE_SRC_DIR}/out}" unset devshell_lib_dir # Find the fuchsia sdk location diff --git a/engine/src/flutter/tools/fuchsia/devshell/serve.sh b/engine/src/flutter/tools/fuchsia/devshell/serve.sh index 7adae92520..a3e3601284 100755 --- a/engine/src/flutter/tools/fuchsia/devshell/serve.sh +++ b/engine/src/flutter/tools/fuchsia/devshell/serve.sh @@ -6,11 +6,11 @@ ### Serves the out directory ## usage: -## -p port for "pm serve" to listen on -## -d device_name to use for connecting -## -r If you are running a remote workflow -## --only-serve-runners If set will only serve the flutter and dart runners -## --out the out directory (ex: fuchsia_debug_x64) +## --out Required. The out directory (ex: out/fuchsia_debug_x64). +## -p Optional. The port for "pm serve" to listen on. Defaults to 8084. +## -d Required for local workflows. The device_name to use for connecting. +## -r Optional. Serve to a remote target. +## --only-serve-runners Optional. Only serve the flutter and dart runners. #TODO: Take an out directory and use that to find the list of packages to publish @@ -19,12 +19,17 @@ source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars. # We need to use the fuchsia checkout still, make sure it is there ensure_fuchsia_dir -remote=false -device_name="" +out="" port="8084" +device_name="" +remote=false only_serve_runners=false while (($#)); do case "$1" in + --out) + out="$2" + shift + ;; -p) port="$2" shift @@ -46,17 +51,25 @@ while (($#)); do shift done +if [[ -z "${out}" ]]; then + engine-error "Must specify an out directory, such as out/fuchsia_debug_x64" + exit 1 +fi + # Start our package server # TODO: Need to ask for the out directory to find the package list # TODO: Generate the all_packages.list file cd "${FLUTTER_ENGINE_SRC_DIR}" || exit "${FLUTTER_ENGINE_FUCHSIA_SDK_DIR}/tools/pm" serve -vt \ - -repo "${FLUTTER_ENGINE_OUT_DIR}/tuf" \ + -repo "${FLUTTER_ENGINE_FUCHSIA_SDK_DIR}/${out}/tuf" \ -l ":${port}" \ -p "${FLUTTER_ENGINE_SRC_DIR}/flutter/tools/fuchsia/all_packages.list"& serve_pid=$! -# TODO: Set up the debug symbol server +# Add debug symbols to the symbol index. +"${FLUTTER_ENGINE_FUCHSIA_SDK_DIR}/tools/symbol-index" add \ + "${FLUTTER_ENGINE_SRC_DIR}/${out}/.build-id" \ + "${FLUTTER_ENGINE_SRC_DIR}/${out}" # Start our server and loop to check if our device is up give some slack time # to ensure that pm has started diff --git a/engine/src/flutter/tools/fuchsia/fuchsia_debug_symbols.gni b/engine/src/flutter/tools/fuchsia/fuchsia_debug_symbols.gni index 5d624b6f86..88254ced35 100644 --- a/engine/src/flutter/tools/fuchsia/fuchsia_debug_symbols.gni +++ b/engine/src/flutter/tools/fuchsia/fuchsia_debug_symbols.gni @@ -41,46 +41,6 @@ template("_copy_debug_symbols") { } outputs = [ "${_dest_base}/.${target_name}_success" ] - - if (!defined(deps)) { - deps = [] - } - deps += [ ":${target_name}_soft_transition" ] - } - - # TODO(fxbug.dev/76223): Soft transition recipes/engine.py to used - # canonicalized debug symbol name and then remove. - action(target_name + "_soft_transition") { - forward_variables_from(invoker, - [ - "deps", - "unstripped", - "binary_path", - "testonly", - ]) - - script = "//flutter/tools/fuchsia/copy_debug_symbols.py" - - sources = [ binary_path ] - - _dest_base = "${root_out_dir}/flutter-debug-symbols-${flutter_runtime_mode}-${target_os}-${target_cpu}" - - args = [ - "--executable-name", - target_name, - "--executable-path", - rebase_path(binary_path), - "--destination-base", - rebase_path(_dest_base), - "--read-elf", - rebase_path("//buildtools/${host_os}-${host_cpu}/clang/bin/llvm-readelf"), - ] - - if (unstripped) { - args += [ "--unstripped" ] - } - - outputs = [ "${_dest_base}/.${target_name}_success" ] } }