| # Copyright 2021 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("//build/sdk/sdk_atom.gni") |
| import("//build/sdk/sdk_noop_atom.gni") |
| import("//src/developer/ffx/build/ffx_plugin.gni") |
| |
| if (is_host) { |
| ffx_plugin("ffx_emulator") { |
| version = "0.1.0" |
| edition = "2018" |
| with_unit_tests = true |
| args_sources = [ "src/args.rs" ] |
| config_data = [ "data/config.json" ] |
| plugin_deps = [ |
| "list:ffx_emulator_list", |
| "show:ffx_emulator_show", |
| "start:ffx_emulator_start", |
| "stop:ffx_emulator_stop", |
| ] |
| test_deps = [ |
| "common:tests", |
| "configuration:tests", |
| "engines:tests", |
| "list:tests", |
| "show:tests", |
| "start:tests", |
| "stop:tests", |
| ] |
| deps = [ |
| ":aemu_internal", |
| ":qemu_internal", |
| ] |
| } |
| |
| # AEMU binaries are only available for x64 currently. |
| if (current_cpu == host_cpu && host_cpu == "x64") { |
| action("create_aemu_companion_data") { |
| script = "//src/developer/ffx/plugins/emulator/create_companion_data.py" |
| sources = [ |
| "//prebuilt/third_party/android/aemu/release/${host_platform}/emulator", |
| ] |
| inputs = |
| [ "//prebuilt/third_party/android/aemu/release/${host_platform}" ] |
| outputs = [ |
| "$target_gen_dir/${target_name}.txt", |
| "$target_gen_dir/${target_name}_metadata.json", |
| ] |
| args = [ |
| "--name", |
| "aemu_internal", |
| "--binary", |
| rebase_path(sources[0], root_build_dir), |
| "--src_root", |
| rebase_path(inputs[0], root_build_dir), |
| "--dest_root", |
| "tools/${host_cpu}/aemu_internal", |
| "--output", |
| rebase_path(outputs[0], root_build_dir), |
| "--meta_out", |
| rebase_path(outputs[1], root_build_dir), |
| ] |
| } |
| |
| action("create_qemu_companion_data") { |
| script = "//src/developer/ffx/plugins/emulator/create_companion_data.py" |
| sources = [ |
| "//prebuilt/third_party/qemu/${host_platform}/bin/qemu-system-x86_64", |
| ] |
| inputs = [ "//prebuilt/third_party/qemu/${host_platform}" ] |
| outputs = [ |
| "$target_gen_dir/${target_name}.txt", |
| "$target_gen_dir/${target_name}_metadata.json", |
| ] |
| args = [ |
| "--name", |
| "qemu_internal", |
| "--binary", |
| rebase_path(sources[0], root_build_dir), |
| "--src_root", |
| rebase_path(inputs[0], root_build_dir), |
| "--dest_root", |
| "tools/${host_cpu}/qemu_internal", |
| "--output", |
| rebase_path(outputs[0], root_build_dir), |
| "--meta_out", |
| rebase_path(outputs[1], root_build_dir), |
| ] |
| } |
| |
| if (host_os == "linux" || host_os == "mac") { |
| aemu_file_base = "tools/$current_cpu/aemu_internal" |
| qemu_file_base = "tools/$current_cpu/qemu_internal" |
| } |
| sdk_atom("aemu_internal") { |
| id = "sdk://tools/$current_cpu/aemu_internal" |
| category = "partner" |
| |
| # Declare the support files to add for this host tool. |
| _file_list_array = get_target_outputs(":create_aemu_companion_data") |
| |
| meta = { |
| dest = "${aemu_file_base}-meta.json" |
| schema = "companion_host_tool" |
| source = _file_list_array[1] |
| } |
| |
| file_list = _file_list_array[0] |
| |
| non_sdk_deps = [ ":create_aemu_companion_data" ] |
| } |
| sdk_atom("qemu_internal") { |
| id = "sdk://tools/$current_cpu/qemu_internal" |
| category = "partner" |
| |
| # Declare the support files to add for this host tool. |
| _file_list_array = get_target_outputs(":create_qemu_companion_data") |
| |
| meta = { |
| dest = "${qemu_file_base}-meta.json" |
| schema = "companion_host_tool" |
| source = _file_list_array[1] |
| } |
| |
| file_list = _file_list_array[0] |
| |
| non_sdk_deps = [ ":create_qemu_companion_data" ] |
| } |
| sdk_noop_atom("aemu_internal_legacy") { |
| } |
| sdk_noop_atom("qemu_internal_legacy") { |
| } |
| } else { |
| # There is no arm64 aemu yet. |
| sdk_noop_atom("aemu_internal") { |
| } |
| sdk_noop_atom("qemu_internal") { |
| } |
| } |
| } |