Add support for LOCAL_ENGINE_HOST to Linux/Mac/Win builds. (#132579)
Partial work towards https://github.com/flutter/flutter/issues/132245. I also couldn't help myself to do a very minor refactor and add some comments to `LocalEngineInfo` because I was getting confused myself implementing it.
This commit is contained in:
@@ -11,7 +11,7 @@ import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/cache.dart';
|
||||
|
||||
import '../src/common.dart';
|
||||
import '../src/fake_process_manager.dart';
|
||||
import '../src/context.dart';
|
||||
import '../src/fakes.dart';
|
||||
|
||||
void main() {
|
||||
@@ -545,4 +545,37 @@ void main() {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
group('LocalEngineInfo', () {
|
||||
late FileSystem fileSystem;
|
||||
late LocalEngineInfo localEngineInfo;
|
||||
|
||||
setUp(() {
|
||||
fileSystem = MemoryFileSystem.test();
|
||||
});
|
||||
|
||||
testUsingContext('determines the target device name from the path', () {
|
||||
localEngineInfo = LocalEngineInfo(
|
||||
targetOutPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
||||
hostOutPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
||||
);
|
||||
|
||||
expect(localEngineInfo.localTargetName, 'android_debug_unopt');
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
});
|
||||
|
||||
testUsingContext('determines the target device name from the path when using a custom engine path', () {
|
||||
localEngineInfo = LocalEngineInfo(
|
||||
targetOutPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
||||
hostOutPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
||||
);
|
||||
|
||||
expect(localEngineInfo.localHostName, 'host_debug_unopt');
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:file/memory.dart';
|
||||
|
||||
import 'package:flutter_tools/src/artifacts.dart';
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
|
||||
@@ -101,7 +104,7 @@ void main() {
|
||||
expect(getNameForTargetPlatform(TargetPlatform.android), isNot(contains('ios')));
|
||||
});
|
||||
|
||||
testWithoutContext('defaultIOSArchsForEnvironment', () {
|
||||
testUsingContext('defaultIOSArchsForEnvironment', () {
|
||||
expect(defaultIOSArchsForEnvironment(
|
||||
EnvironmentType.physical,
|
||||
Artifacts.testLocalEngine(localEngineHost: 'host_debug_unopt', localEngine: 'ios_debug_unopt'),
|
||||
@@ -124,9 +127,12 @@ void main() {
|
||||
expect(defaultIOSArchsForEnvironment(
|
||||
EnvironmentType.simulator, Artifacts.test(),
|
||||
), <DarwinArch>[ DarwinArch.x86_64, DarwinArch.arm64 ]);
|
||||
});
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => MemoryFileSystem.test(),
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
});
|
||||
|
||||
testWithoutContext('defaultMacOSArchsForEnvironment', () {
|
||||
testUsingContext('defaultMacOSArchsForEnvironment', () {
|
||||
expect(defaultMacOSArchsForEnvironment(
|
||||
Artifacts.testLocalEngine(localEngineHost: 'host_debug_unopt', localEngine: 'host_debug_unopt'),
|
||||
).single, DarwinArch.x86_64);
|
||||
@@ -138,7 +144,10 @@ void main() {
|
||||
expect(defaultMacOSArchsForEnvironment(
|
||||
Artifacts.test(),
|
||||
), <DarwinArch>[ DarwinArch.x86_64, DarwinArch.arm64 ]);
|
||||
});
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => MemoryFileSystem.test(),
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
});
|
||||
|
||||
testWithoutContext('getIOSArchForName on Darwin arches', () {
|
||||
expect(getIOSArchForName('armv7'), DarwinArch.armv7);
|
||||
|
||||
Reference in New Issue
Block a user