From daeb8316d777bbb3286f2f817c185788d3b2f4b2 Mon Sep 17 00:00:00 2001 From: Zachary Anderson Date: Wed, 25 Jan 2023 08:35:57 -0800 Subject: [PATCH] Only build analyze_snapshot on Linux host (flutter/engine#39129) --- engine/src/flutter/BUILD.gn | 10 +++++++--- engine/src/flutter/lib/snapshot/BUILD.gn | 2 +- engine/src/flutter/shell/platform/android/BUILD.gn | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/engine/src/flutter/BUILD.gn b/engine/src/flutter/BUILD.gn index acd070c7f87..d1b7a573af3 100644 --- a/engine/src/flutter/BUILD.gn +++ b/engine/src/flutter/BUILD.gn @@ -82,9 +82,6 @@ group("flutter") { # gen_snapshot for the host and not the target. "//third_party/dart/runtime/bin:gen_snapshot", - # Built alongside gen_snapshot for 64 bit targets - "//third_party/dart/runtime/bin:analyze_snapshot", - # Impeller artifacts - compiler and libtessellator "//flutter/impeller/compiler:impellerc", "//flutter/impeller/tessellator:tessellator_shared", @@ -93,6 +90,13 @@ group("flutter") { "//flutter/tools/path_ops", ] + if (host_os == "linux") { + public_deps += [ + # Built alongside gen_snapshot for 64 bit targets + "//third_party/dart/runtime/bin:analyze_snapshot", + ] + } + if (full_dart_sdk) { public_deps += [ "//flutter/web_sdk" ] } diff --git a/engine/src/flutter/lib/snapshot/BUILD.gn b/engine/src/flutter/lib/snapshot/BUILD.gn index 9247a529d02..5ef9d98cc0e 100644 --- a/engine/src/flutter/lib/snapshot/BUILD.gn +++ b/engine/src/flutter/lib/snapshot/BUILD.gn @@ -37,7 +37,7 @@ group("generate_snapshot_bins") { } # Build analyze_snapshot for 64-bit target CPUs. - if (target_cpu == "x64" || target_cpu == "arm64") { + if (host_os == "linux" && (target_cpu == "x64" || target_cpu == "arm64")) { deps += [ "//third_party/dart/runtime/bin:analyze_snapshot($host_toolchain)" ] } diff --git a/engine/src/flutter/shell/platform/android/BUILD.gn b/engine/src/flutter/shell/platform/android/BUILD.gn index 2b310e3eb3b..a0d91955a66 100644 --- a/engine/src/flutter/shell/platform/android/BUILD.gn +++ b/engine/src/flutter/shell/platform/android/BUILD.gn @@ -667,7 +667,7 @@ if (target_cpu != "x86") { } } -if (target_cpu == "x64" || target_cpu == "arm64") { +if (host_os == "linux" && (target_cpu == "x64" || target_cpu == "arm64")) { zip_bundle("analyze_snapshot") { deps = [ "//third_party/dart/runtime/bin:analyze_snapshot($host_toolchain)" ]