From 138d587e3ae169cb288aad59ca9f7db6ca76e190 Mon Sep 17 00:00:00 2001 From: James Robinson Date: Thu, 18 Jan 2018 06:05:56 +0000 Subject: [PATCH] [gn] Remove uses of is_fuchsia_host GN variable Some parts of the Dart build need to be customized when running the host steps for a build ultimately targeting a Fuchsia build. This was set by passing a special GN variable indicating that a configuration was a host configuration targeting a Fuchsia build, but the built-in GN variable 'target_os' has the same result as it is the same across all toolchains in a particular build. This replaces the test: is_fuchsia || is_fuchsia_host with the equivalent: target_os == "fuchsia" and the less common: is_fuchsia_host with: target_os != current_os && target_os == "fuchsia" Change-Id: Iabec1fb2879b234ca44c9e03b2f4a62ffbc6fa4a Reviewed-on: https://dart-review.googlesource.com/35542 Reviewed-by: Zach Anderson Commit-Queue: Zach Anderson --- BUILD.gn | 10 ++++++---- build/config/BUILDCONFIG.gn | 8 +------- runtime/bin/BUILD.gn | 4 ++-- sdk/BUILD.gn | 2 +- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index e621934e475..3f93c69511f 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -4,9 +4,11 @@ import("build/dart_host_sdk_toolchain.gni") +targetting_fuchsia = target_os == "fuchsia" + # This target will be built if no target is specified when invoking ninja. group("default") { - if (is_fuchsia || is_fuchsia_host) { + if (targetting_fuchsia) { # Fuchsia has run_vm_tests marked testonly. testonly = true } @@ -16,7 +18,7 @@ group("default") { } group("most") { - if (is_fuchsia || is_fuchsia_host) { + if (targetting_fuchsia) { # Fuchsia has run_vm_tests marked testonly. testonly = true } @@ -32,7 +34,7 @@ group("most") { } group("runtime") { - if (is_fuchsia || is_fuchsia_host) { + if (targetting_fuchsia) { # Fuchsia has run_vm_tests marked testonly. testonly = true } @@ -47,7 +49,7 @@ group("runtime") { } group("runtime_kernel") { - if (is_fuchsia || is_fuchsia_host) { + if (targetting_fuchsia) { # Fuchsia has run_vm_tests marked testonly. testonly = true } diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn index 4dfbaf694ef..ff7b42f7665 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -154,7 +154,6 @@ if (current_os == "win") { is_android = false is_chromeos = false is_fuchsia = false - is_fuchsia_host = false is_ios = false is_linux = false is_mac = false @@ -165,7 +164,6 @@ if (current_os == "win") { is_android = false is_chromeos = false is_fuchsia = false - is_fuchsia_host = false is_ios = false is_linux = false is_mac = true @@ -176,7 +174,6 @@ if (current_os == "win") { is_android = true is_chromeos = false is_fuchsia = false - is_fuchsia_host = false is_ios = false is_linux = false is_mac = false @@ -187,7 +184,6 @@ if (current_os == "win") { is_android = false is_chromeos = false is_fuchsia = false - is_fuchsia_host = false is_ios = false is_linux = true is_mac = false @@ -252,9 +248,7 @@ if (is_linux) { } if (is_clang) { - _native_compiler_configs += [ - "//build/config/clang:extra_warnings", - ] + _native_compiler_configs += [ "//build/config/clang:extra_warnings" ] } # Optimizations and debug checking. diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn index 6afa317adbb..83e59cb4422 100644 --- a/runtime/bin/BUILD.gn +++ b/runtime/bin/BUILD.gn @@ -712,7 +712,7 @@ template("dart_executable") { if (is_fuchsia) { configs -= [ "//build/config:symbol_visibility_hidden" ] } - if (is_fuchsia_host) { + if (target_os != current_os && target_os == "fuchsia") { # We already have these in the standalone build, but Fuchsia doesn't # have them. They are needed for running Fuchsia binaries built for the # host. @@ -1005,7 +1005,7 @@ action("generate_snapshot_test_dat_file") { } executable("run_vm_tests") { - if (is_fuchsia || is_fuchsia_host) { + if (target_os == "fuchsia") { testonly = true } diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn index 41adf0158ee..5f352ab64e7 100644 --- a/sdk/BUILD.gn +++ b/sdk/BUILD.gn @@ -314,7 +314,7 @@ copy_trees("copy_trees") { } # Copies the Dart VM binary into bin/ -if (is_fuchsia_host) { +if (target_os != current_os && target_os == "fuchsia") { # In the Fuchsia build, this has to use a symlink for two reasons. # First, it makes the lookup of shared libraries relative to $ORIGIN # (Linux) or @loader_path (macOS) find the libraries where they are,