Skip to content

Commit da72d59

Browse files
auto-submit[bot]auto-submit[bot]
andauthored
Reverts "[ Tool / Engine ] Cleanup x86 references (#181152)" (#181643)
<!-- start_original_pr_link --> Reverts: #181152 <!-- end_original_pr_link --> <!-- start_initiating_author --> Initiated by: chingjun <!-- end_initiating_author --> <!-- start_revert_reason --> Reason for reverting: broke internal tests. <!-- end_revert_reason --> <!-- start_original_pr_author --> Original PR Author: bkonyi <!-- end_original_pr_author --> <!-- start_reviewers --> Reviewed By: {mboetger, gaaclarke} <!-- end_reviewers --> <!-- start_revert_body --> This change reverts the following previous change: Fixes #170142 <!-- end_revert_body --> Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
1 parent 2183e36 commit da72d59

11 files changed

Lines changed: 108 additions & 37 deletions

File tree

engine/src/build/toolchain/android/BUILD.gn

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ template("android_toolchains_helper") {
127127
}
128128
}
129129

130+
android_toolchains_helper("x86") {
131+
toolchain_cpu = "x86"
132+
}
133+
130134
android_toolchains_helper("arm") {
131135
toolchain_cpu = "arm"
132136
}

engine/src/flutter/assets/native_assets.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ namespace flutter {
1313
#define kTargetArchitectureName "arm"
1414
#elif defined(FML_ARCH_CPU_ARM64)
1515
#define kTargetArchitectureName "arm64"
16+
#elif defined(FML_ARCH_CPU_X86)
17+
#define kTargetArchitectureName "ia32"
1618
#elif defined(FML_ARCH_CPU_X86_64)
1719
#define kTargetArchitectureName "x64"
1820
#elif defined(FML_ARCH_CPU_RISCV32)

engine/src/flutter/ci/builders/linux_android_debug_engine.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,50 @@
105105
]
106106
}
107107
},
108+
{
109+
"archives": [
110+
{
111+
"name": "ci/android_debug_x86",
112+
"type": "gcs",
113+
"base_path": "out/ci/android_debug_x86/zip_archives/",
114+
"include_paths": [
115+
"out/ci/android_debug_x86/zip_archives/android-x86/artifacts.zip",
116+
"out/ci/android_debug_x86/zip_archives/android-x86/android-x86-embedder.zip",
117+
"out/ci/android_debug_x86/zip_archives/android-x86/impeller_sdk.zip",
118+
"out/ci/android_debug_x86/zip_archives/android-x86/symbols.zip",
119+
"out/ci/android_debug_x86/zip_archives/download.flutter.io"
120+
],
121+
"realm": "production"
122+
}
123+
],
124+
"drone_dimensions": [
125+
"device_type=none",
126+
"os=Linux"
127+
],
128+
"gclient_variables": {
129+
"use_rbe": true
130+
},
131+
"gn": [
132+
"--target-dir",
133+
"ci/android_debug_x86",
134+
"--android",
135+
"--android-cpu=x86",
136+
"--no-lto",
137+
"--rbe",
138+
"--no-goma"
139+
],
140+
"name": "ci/android_debug_x86",
141+
"description": "Produces debug mode artifacts to target x86 Android from a Linux host.",
142+
"ninja": {
143+
"config": "ci/android_debug_x86",
144+
"targets": [
145+
"flutter",
146+
"flutter/shell/platform/android:abi_jars",
147+
"flutter/shell/platform/embedder:embedder-archive",
148+
"flutter/impeller/toolkit/interop:sdk"
149+
]
150+
}
151+
},
108152
{
109153
"archives": [
110154
{

engine/src/flutter/common/config.gni

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,14 @@ if (_host_os_name == "mac") {
115115
_host_os_name = "windows"
116116
}
117117

118+
# When building 32-bit Android development artifacts for Windows host (like
119+
# gen_snapshot), the host_cpu is set to x86. However, the correct prebuilt
120+
# Dart SDK to use during this build is still the 64-bit one.
118121
_host_cpu = host_cpu
122+
if (host_os == "win" && host_cpu == "x86") {
123+
_host_cpu = "x64"
124+
}
125+
119126
_target_prebuilt_config = "$_target_os_name-$target_cpu"
120127
_host_prebuilt_config = "$_host_os_name-$_host_cpu"
121128

engine/src/flutter/impeller/toolkit/interop/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ The `$FLUTTER_SHA` is the Git hash in the [Flutter repository](https://github.co
3636
|:-----:|:------------:|:-----------:|:--------------:|:-------------:|
3737
| armv7 | | | android-arm | |
3838
| arm64 | darwin-arm64 | linux-arm64 | android-arm64 | windows-arm64 |
39+
| x86 | | | android-x86 | |
3940
| x64 | darwin-x64 | linux-x64 | android-x64 | windows-x64 |
4041

4142

engine/src/flutter/shell/platform/android/BUILD.gn

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -759,49 +759,51 @@ generated_file("android_entitlement_config") {
759759
deps = []
760760
}
761761

762-
zip_bundle("gen_snapshot") {
763-
gen_snapshot_out_dir =
764-
get_label_info("$dart_src/runtime/bin:gen_snapshot($host_toolchain)",
765-
"root_out_dir")
762+
if (target_cpu != "x86") {
763+
zip_bundle("gen_snapshot") {
764+
gen_snapshot_out_dir =
765+
get_label_info("$dart_src/runtime/bin:gen_snapshot($host_toolchain)",
766+
"root_out_dir")
766767

767-
# The source gen_snapshot binary from the build outputs.
768-
gen_snapshot_src = rebase_path("$gen_snapshot_out_dir/gen_snapshot")
768+
# The source gen_snapshot binary from the build outputs.
769+
gen_snapshot_src = rebase_path("$gen_snapshot_out_dir/gen_snapshot")
769770

770-
# The output gen_snapshot binary name in the archive.
771-
gen_snapshot_dest = "gen_snapshot"
771+
# The output gen_snapshot binary name in the archive.
772+
gen_snapshot_dest = "gen_snapshot"
772773

773-
if (host_os == "mac") {
774-
gen_snapshot_src = rebase_path("$root_out_dir/universal/gen_snapshot")
775-
} else if (host_os == "win") {
776-
gen_snapshot_src = rebase_path("$root_out_dir/gen_snapshot.exe")
777-
gen_snapshot_dest = "gen_snapshot.exe"
778-
}
779-
780-
if (host_os == "linux") {
781-
output = "$android_zip_archive_dir/linux-x64.zip"
782-
} else if (host_os == "mac") {
783-
output = "$android_zip_archive_dir/darwin-x64.zip"
784-
} else if (host_os == "win") {
785-
output = "$android_zip_archive_dir/windows-x64.zip"
786-
}
787-
788-
files = [
789-
{
790-
source = gen_snapshot_src
791-
destination = gen_snapshot_dest
792-
},
793-
]
774+
if (host_os == "mac") {
775+
gen_snapshot_src = rebase_path("$root_out_dir/universal/gen_snapshot")
776+
} else if (host_os == "win") {
777+
gen_snapshot_src = rebase_path("$root_out_dir/gen_snapshot.exe")
778+
gen_snapshot_dest = "gen_snapshot.exe"
779+
}
794780

795-
deps = [ "//flutter/lib/snapshot:generate_snapshot_bins" ]
781+
if (host_os == "linux") {
782+
output = "$android_zip_archive_dir/linux-x64.zip"
783+
} else if (host_os == "mac") {
784+
output = "$android_zip_archive_dir/darwin-x64.zip"
785+
} else if (host_os == "win") {
786+
output = "$android_zip_archive_dir/windows-x64.zip"
787+
}
796788

797-
if (host_os == "mac") {
798-
deps += [ ":android_entitlement_config" ]
799-
files += [
789+
files = [
800790
{
801-
source = "$target_gen_dir/android_entitlements.txt"
802-
destination = "entitlements.txt"
791+
source = gen_snapshot_src
792+
destination = gen_snapshot_dest
803793
},
804794
]
795+
796+
deps = [ "//flutter/lib/snapshot:generate_snapshot_bins" ]
797+
798+
if (host_os == "mac") {
799+
deps += [ ":android_entitlement_config" ]
800+
files += [
801+
{
802+
source = "$target_gen_dir/android_entitlements.txt"
803+
destination = "entitlements.txt"
804+
},
805+
]
806+
}
805807
}
806808
}
807809

@@ -842,8 +844,10 @@ group("android") {
842844
":android_javadoc",
843845
":android_symbols",
844846
":flutter_jar_zip",
845-
":gen_snapshot",
846847
]
848+
if (target_cpu != "x86") {
849+
deps += [ ":gen_snapshot" ]
850+
}
847851
}
848852

849853
# Renames embedding android artifacts and places them in the final

engine/src/flutter/tools/engine_tool/lib/src/commands/run_command.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ final class RunTarget {
232232
// -----------------------------------------------------------------------
233233
// ANDROID
234234
TargetPlatform.androidUnspecified => 'android_$mode',
235+
TargetPlatform.androidX86 => 'android_${mode}_x86',
235236
TargetPlatform.androidX64 => 'android_${mode}_x64',
236237
TargetPlatform.androidArm64 => 'android_${mode}_arm64',
237238
TargetPlatform.androidRiscv64 => 'android_${mode}_riscv64',
@@ -290,6 +291,7 @@ final class RunTarget {
290291
// -----------------------------------------------------------------------
291292
// ANDROID
292293
TargetPlatform.androidUnspecified ||
294+
TargetPlatform.androidX86 ||
293295
TargetPlatform.androidX64 ||
294296
TargetPlatform.androidRiscv64 ||
295297
TargetPlatform.androidArm64 => [

engine/src/flutter/tools/engine_tool/lib/src/flutter_tool_interop/target_platform.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ final class TargetPlatform {
2929
/// Android x64.
3030
static const androidX64 = TargetPlatform._('android-x64');
3131

32+
/// Android x86.
33+
static const androidX86 = TargetPlatform._('android-x86');
34+
3235
/// Linux ARM64.
3336
static const linuxArm64 = TargetPlatform._('linux-arm64');
3437

@@ -89,6 +92,7 @@ final class TargetPlatform {
8992
androidArm64,
9093
androidRiscv64,
9194
androidX64,
95+
androidX86,
9296
linuxArm64,
9397
linuxX64,
9498
windowsArm64,

engine/src/flutter/tools/engine_tool/test/run_target_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ void main() {
6060
group('buildConfigFor', () {
6161
final Map<TargetPlatform, String> expectedDebugTargets = {
6262
TargetPlatform.androidUnspecified: 'android_debug',
63+
TargetPlatform.androidX86: 'android_debug_x86',
6364
TargetPlatform.androidX64: 'android_debug_x64',
6465
TargetPlatform.androidArm64: 'android_debug_arm64',
6566
TargetPlatform.androidRiscv64: 'android_debug_riscv64',
@@ -97,6 +98,7 @@ void main() {
9798
TargetPlatform.androidUnspecified: [
9899
Label.parseGn('//flutter/shell/platform/android:android_jar'),
99100
],
101+
TargetPlatform.androidX86: [Label.parseGn('//flutter/shell/platform/android:android_jar')],
100102
TargetPlatform.androidX64: [Label.parseGn('//flutter/shell/platform/android:android_jar')],
101103
TargetPlatform.androidArm64: [Label.parseGn('//flutter/shell/platform/android:android_jar')],
102104
TargetPlatform.androidRiscv64: [

packages/flutter_tools/lib/src/emulator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class EmulatorManager {
137137
error:
138138
'No suitable Android AVD system images are available. You may need to install these'
139139
' using sdkmanager, for example:\n'
140-
' sdkmanager "system-images;android-34;google_apis_playstore;x86_64"',
140+
' sdkmanager "system-images;android-27;google_apis_playstore;x86"',
141141
);
142142
}
143143

0 commit comments

Comments
 (0)