Skip to content

Commit

Permalink
chore: enable Flutter Android workflow on aarch64 (#113829)
Browse files Browse the repository at this point in the history
- removes invalid arch check on Android workflow in order to enable Android development on any device supported

Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>

Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
  • Loading branch information
TheOneWithTheBraid committed Nov 10, 2022
1 parent c1ceda4 commit 2e432ec
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 33 deletions.
9 changes: 2 additions & 7 deletions packages/flutter_tools/lib/src/android/android_workflow.dart
Expand Up @@ -44,19 +44,14 @@ class AndroidWorkflow implements Workflow {
AndroidWorkflow({
required AndroidSdk? androidSdk,
required FeatureFlags featureFlags,
required OperatingSystemUtils operatingSystemUtils,
}) : _androidSdk = androidSdk,
_featureFlags = featureFlags,
_operatingSystemUtils = operatingSystemUtils;
_featureFlags = featureFlags;

final AndroidSdk? _androidSdk;
final FeatureFlags _featureFlags;
final OperatingSystemUtils _operatingSystemUtils;

@override
bool get appliesToHostPlatform => _featureFlags.isAndroidEnabled
// Android Studio is not currently supported on Linux Arm64 Hosts.
&& _operatingSystemUtils.hostPlatform != HostPlatform.linux_arm64;
bool get appliesToHostPlatform => _featureFlags.isAndroidEnabled;

@override
bool get canListDevices => appliesToHostPlatform && _androidSdk != null
Expand Down
1 change: 0 additions & 1 deletion packages/flutter_tools/lib/src/context_runner.dart
Expand Up @@ -120,7 +120,6 @@ Future<T> runInContext<T>(
AndroidWorkflow: () => AndroidWorkflow(
androidSdk: globals.androidSdk,
featureFlags: featureFlags,
operatingSystemUtils: globals.os,
),
ApplicationPackageFactory: () => FlutterApplicationPackageFactory(
userMessages: globals.userMessages,
Expand Down
Expand Up @@ -23,7 +23,6 @@ void main() {
androidWorkflow = AndroidWorkflow(
androidSdk: FakeAndroidSdk(),
featureFlags: TestFeatureFlags(),
operatingSystemUtils: FakeOperatingSystemUtils(),
);
});

Expand All @@ -34,7 +33,6 @@ void main() {
androidWorkflow: AndroidWorkflow(
androidSdk: FakeAndroidSdk(null),
featureFlags: TestFeatureFlags(),
operatingSystemUtils: FakeOperatingSystemUtils(),
),
processManager: FakeProcessManager.empty(),
fileSystem: MemoryFileSystem.test(),
Expand All @@ -55,7 +53,6 @@ void main() {
androidWorkflow: AndroidWorkflow(
androidSdk: FakeAndroidSdk(),
featureFlags: TestFeatureFlags(),
operatingSystemUtils: FakeOperatingSystemUtils(),
),
processManager: fakeProcessManager,
fileSystem: MemoryFileSystem.test(),
Expand All @@ -74,7 +71,6 @@ void main() {
androidWorkflow: AndroidWorkflow(
androidSdk: FakeAndroidSdk(null),
featureFlags: TestFeatureFlags(),
operatingSystemUtils: FakeOperatingSystemUtils(),
),
processManager: FakeProcessManager.empty(),
fileSystem: MemoryFileSystem.test(),
Expand Down Expand Up @@ -116,7 +112,6 @@ void main() {
featureFlags: TestFeatureFlags(
isAndroidEnabled: false,
),
operatingSystemUtils: FakeOperatingSystemUtils(),
),
processManager: FakeProcessManager.any(),
fileSystem: MemoryFileSystem.test(),
Expand Down
Expand Up @@ -39,7 +39,6 @@ void main() {
final AndroidWorkflow androidWorkflow = AndroidWorkflow(
featureFlags: TestFeatureFlags(),
androidSdk: null,
operatingSystemUtils: FakeOperatingSystemUtils(),
);

expect(androidWorkflow.canLaunchDevices, false);
Expand All @@ -53,28 +52,26 @@ void main() {
final AndroidWorkflow androidWorkflow = AndroidWorkflow(
featureFlags: TestFeatureFlags(),
androidSdk: androidSdk,
operatingSystemUtils: FakeOperatingSystemUtils(),
);

expect(androidWorkflow.canLaunchDevices, false);
expect(androidWorkflow.canListDevices, false);
expect(androidWorkflow.canListEmulators, false);
});

// Android Studio is not currently supported on Linux Arm64 hosts.
testWithoutContext('Not supported AndroidStudio on Linux Arm Hosts', () {
// Android SDK is actually supported on Linux Arm64 hosts.
testWithoutContext('Support for Android SDK on Linux Arm Hosts', () {
final FakeAndroidSdk androidSdk = FakeAndroidSdk();
androidSdk.adbPath = null;
final AndroidWorkflow androidWorkflow = AndroidWorkflow(
featureFlags: TestFeatureFlags(),
androidSdk: androidSdk,
operatingSystemUtils: CustomFakeOperatingSystemUtils(hostPlatform: HostPlatform.linux_arm64),
);

expect(androidWorkflow.appliesToHostPlatform, false);
expect(androidWorkflow.canLaunchDevices, false);
expect(androidWorkflow.canListDevices, false);
expect(androidWorkflow.canListEmulators, false);
expect(androidWorkflow.appliesToHostPlatform, isTrue);
expect(androidWorkflow.canLaunchDevices, isFalse);
expect(androidWorkflow.canListDevices, isFalse);
expect(androidWorkflow.canListEmulators, isFalse);
});

testWithoutContext('AndroidWorkflow is disabled if feature is disabled', () {
Expand All @@ -83,7 +80,6 @@ void main() {
final AndroidWorkflow androidWorkflow = AndroidWorkflow(
featureFlags: TestFeatureFlags(isAndroidEnabled: false),
androidSdk: androidSdk,
operatingSystemUtils: FakeOperatingSystemUtils(),
);

expect(androidWorkflow.appliesToHostPlatform, false);
Expand All @@ -98,7 +94,6 @@ void main() {
final AndroidWorkflow androidWorkflow = AndroidWorkflow(
featureFlags: TestFeatureFlags(),
androidSdk: androidSdk,
operatingSystemUtils: FakeOperatingSystemUtils(),
);

expect(androidWorkflow.appliesToHostPlatform, true);
Expand All @@ -114,7 +109,6 @@ void main() {
final AndroidWorkflow androidWorkflow = AndroidWorkflow(
featureFlags: TestFeatureFlags(),
androidSdk: androidSdk,
operatingSystemUtils: FakeOperatingSystemUtils(),
);

expect(androidWorkflow.appliesToHostPlatform, true);
Expand Down
8 changes: 0 additions & 8 deletions packages/flutter_tools/test/general.shard/emulator_test.dart
Expand Up @@ -79,7 +79,6 @@ void main() {
androidWorkflow: AndroidWorkflow(
androidSdk: sdk,
featureFlags: TestFeatureFlags(),
operatingSystemUtils: FakeOperatingSystemUtils(),
),
);

Expand All @@ -101,7 +100,6 @@ void main() {
androidWorkflow: AndroidWorkflow(
androidSdk: sdk,
featureFlags: TestFeatureFlags(),
operatingSystemUtils: FakeOperatingSystemUtils(),
),
);

Expand All @@ -116,7 +114,6 @@ void main() {
androidWorkflow: AndroidWorkflow(
androidSdk: sdk,
featureFlags: TestFeatureFlags(),
operatingSystemUtils: FakeOperatingSystemUtils(),
),
fileSystem: fileSystem,
);
Expand Down Expand Up @@ -144,7 +141,6 @@ void main() {
androidWorkflow: AndroidWorkflow(
androidSdk: sdk,
featureFlags: TestFeatureFlags(),
operatingSystemUtils: FakeOperatingSystemUtils(),
),
);
final CreateEmulatorResult result = await emulatorManager.createEmulator();
Expand Down Expand Up @@ -186,7 +182,6 @@ void main() {
androidWorkflow: AndroidWorkflow(
androidSdk: sdk,
featureFlags: TestFeatureFlags(),
operatingSystemUtils: FakeOperatingSystemUtils(),
),
);
final CreateEmulatorResult result = await emulatorManager.createEmulator();
Expand Down Expand Up @@ -223,7 +218,6 @@ void main() {
androidWorkflow: AndroidWorkflow(
androidSdk: sdk,
featureFlags: TestFeatureFlags(),
operatingSystemUtils: FakeOperatingSystemUtils(),
),
);
final CreateEmulatorResult result = await emulatorManager.createEmulator(name: 'test');
Expand Down Expand Up @@ -262,7 +256,6 @@ void main() {
androidWorkflow: AndroidWorkflow(
androidSdk: sdk,
featureFlags: TestFeatureFlags(),
operatingSystemUtils: FakeOperatingSystemUtils(),
),
);
final CreateEmulatorResult result = await emulatorManager.createEmulator(name: 'existing-avd-1');
Expand Down Expand Up @@ -304,7 +297,6 @@ void main() {
androidWorkflow: AndroidWorkflow(
androidSdk: sdk,
featureFlags: TestFeatureFlags(),
operatingSystemUtils: FakeOperatingSystemUtils(),
),
);
final CreateEmulatorResult result = await emulatorManager.createEmulator();
Expand Down

0 comments on commit 2e432ec

Please sign in to comment.