Skip to content

Commit

Permalink
Fix android zip bundles (flutter#27604)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnfield authored Jul 21, 2021
1 parent 44d8465 commit a819189
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 12 deletions.
3 changes: 3 additions & 0 deletions build/zip_bundle.gni
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ if (flutter_runtime_mode == "jit_release") {
android_zip_archive_dir = "android-$target_cpu-jit-release"
} else {
android_zip_archive_dir = "android-$target_cpu"
if (flutter_runtime_mode != "debug") {
android_zip_archive_dir += "-$flutter_runtime_mode"
}
}

# Creates a zip file in the $root_build_dir/zip_archives folder.
Expand Down
57 changes: 45 additions & 12 deletions shell/platform/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ zip_bundle("android_symbols") {
deps = [ ":flutter_shell_native" ]
}

zip_bundle("android") {
zip_bundle("flutter_jar_zip") {
output = "$android_zip_archive_dir/artifacts.zip"
files = [
{
Expand All @@ -569,11 +569,7 @@ zip_bundle("android") {
},
]

deps = [
":android_jar",
":android_javadoc",
":android_symbols",
]
deps = [ ":android_jar" ]

if (current_cpu == "x86" || current_cpu == "x64") {
files += [
Expand All @@ -584,12 +580,6 @@ zip_bundle("android") {
]
deps += [ ":flutter_shell_native" ]
}

# We only run the robolectric tests for android_debug_unopt (arm CPU), and
# the target is relatively expensive to build.
if (flutter_runtime_mode == "debug" && current_cpu == "arm") {
deps += [ ":robolectric_tests" ]
}
}

action("gen_android_javadoc") {
Expand Down Expand Up @@ -624,3 +614,46 @@ zip_bundle("android_javadoc") {
]
deps = [ ":gen_android_javadoc" ]
}

if (target_cpu != "x86") {
zip_bundle("gen_snapshot") {
gen_snapshot_bin = "gen_snapshot"
gen_snapshot_path = rebase_path("$root_out_dir/clang_x64/$gen_snapshot_bin")

if (host_os == "linux") {
output = "$android_zip_archive_dir/linux-x64.zip"
} else if (host_os == "mac") {
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
},
]

deps = [ "//third_party/dart/runtime/bin:gen_snapshot($host_toolchain)" ]
}
}

group("android") {
deps = [
":android_javadoc",
":android_symbols",
":flutter_jar_zip",
]
if (target_cpu != "x86") {
deps += [ ":gen_snapshot" ]
}

# We only run the robolectric tests for android_debug_unopt (arm CPU), and
# the target is relatively expensive to build.
if (flutter_runtime_mode == "debug" && current_cpu == "arm") {
deps += [ ":robolectric_tests" ]
}
}

0 comments on commit a819189

Please sign in to comment.