diff --git a/engine/src/flutter/lib/snapshot/BUILD.gn b/engine/src/flutter/lib/snapshot/BUILD.gn index 02f7956c1e..144518e217 100644 --- a/engine/src/flutter/lib/snapshot/BUILD.gn +++ b/engine/src/flutter/lib/snapshot/BUILD.gn @@ -28,21 +28,25 @@ group("generate_snapshot_bins") { ":generate_snapshot_bin", ":kernel_platform_files", ] + public_deps = [] # Build gen_snapshot for the currently specified target_cpu. - # - # For macOS target builds: needed for both target CPUs (arm64, x64). - # For iOS, Android target builds: all AOT target CPUs are arm/arm64. if (host_os == "mac" && (target_os == "mac" || target_os == "ios")) { - deps += [ ":create_macos_gen_snapshots" ] + # For macOS target builds: needed for both target CPUs (arm64, x64). + public_deps += [ ":create_macos_gen_snapshots" ] } else if (host_os == "mac" && (target_cpu == "arm" || target_cpu == "arm64")) { - deps += [ ":create_arm_gen_snapshot" ] + # For iOS, Android target builds: all AOT target CPUs are arm/arm64. + public_deps += [ ":create_arm_gen_snapshot" ] + } else if (target_cpu == "arm" || target_cpu == "arm64" || + target_cpu == "x64") { + # For other host OSes, build gen_snapshot directly. + public_deps = [ "$dart_src/runtime/bin:gen_snapshot($host_toolchain)" ] } # Build analyze_snapshot for 64-bit target CPUs. if (host_os == "linux" && (target_cpu == "x64" || target_cpu == "arm64")) { - deps += [ "$dart_src/runtime/bin:analyze_snapshot($host_toolchain)" ] + public_deps += [ "$dart_src/runtime/bin:analyze_snapshot($host_toolchain)" ] } } @@ -173,7 +177,7 @@ if (host_os == "mac" && target_os != "mac" && sources = [ "${host_output_dir}/gen_snapshot" ] outputs = [ "${host_output_dir}/gen_snapshot_${target_cpu_suffix}" ] - deps = [ "$dart_src/runtime/bin:gen_snapshot($host_toolchain)" ] + public_deps = [ "$dart_src/runtime/bin:gen_snapshot($host_toolchain)" ] visibility = [ ":*" ] } } diff --git a/engine/src/flutter/shell/platform/android/BUILD.gn b/engine/src/flutter/shell/platform/android/BUILD.gn index 6a4101bd4c..011c3369aa 100644 --- a/engine/src/flutter/shell/platform/android/BUILD.gn +++ b/engine/src/flutter/shell/platform/android/BUILD.gn @@ -681,11 +681,20 @@ generated_file("android_entitlement_config") { if (target_cpu != "x86") { zip_bundle("gen_snapshot") { - gen_snapshot_bin = "gen_snapshot" gen_snapshot_out_dir = get_label_info("$dart_src/runtime/bin:gen_snapshot($host_toolchain)", "root_out_dir") - gen_snapshot_path = rebase_path("$gen_snapshot_out_dir/$gen_snapshot_bin") + + # The source gen_snapshot binary from the build outputs. + gen_snapshot_src = rebase_path("$gen_snapshot_out_dir/gen_snapshot") + + # The output gen_snapshot binary name in the archive. + gen_snapshot_dest = "gen_snapshot" + + if (host_os == "win") { + gen_snapshot_src = rebase_path("$root_out_dir/gen_snapshot.exe") + gen_snapshot_dest = "gen_snapshot.exe" + } if (host_os == "linux") { output = "$android_zip_archive_dir/linux-x64.zip" @@ -693,18 +702,16 @@ if (target_cpu != "x86") { output = "$android_zip_archive_dir/darwin-x64.zip" } else if (host_os == "win") { output = "$android_zip_archive_dir/windows-x64.zip" - gen_snapshot_bin = "gen_snapshot.exe" - gen_snapshot_path = rebase_path("$root_out_dir/$gen_snapshot_bin") } files = [ { - source = gen_snapshot_path - destination = gen_snapshot_bin + source = gen_snapshot_src + destination = gen_snapshot_dest }, ] - deps = [ "$dart_src/runtime/bin:gen_snapshot($host_toolchain)" ] + deps = [ "//flutter/lib/snapshot:generate_snapshot_bins" ] if (host_os == "mac") { deps += [ ":android_entitlement_config" ]