Update flutter_tools internals related to Gradle/XCode to set --local-engine-host. (#132346)

Partial work towards https://github.com/flutter/flutter/issues/132245.

I made a minor refactor to test-only code because it was too confusing
to have 2 optional parameters that are technically required together,
but otherwise all other changes *should* be pass throughs. That being
said, I can't say I totally understand the Gradle stuff so I could use a
hand double checking that.
This commit is contained in:
Matan Lurey
2023-08-15 07:28:18 -07:00
committed by GitHub
parent 9526142cad
commit 6579844528
9 changed files with 73 additions and 33 deletions

View File

@@ -192,7 +192,7 @@ void main() {
));
await commandRunner.run(<String>['assemble', '-o Output', 'debug_macos_bundle_flutter_assets']);
}, overrides: <Type, Generator>{
Artifacts: () => Artifacts.test(localEngine: 'out/host_release'),
Artifacts: () => Artifacts.testLocalEngine(localEngine: 'out/host_release', localEngineHost: 'out/host_release'),
Cache: () => Cache.test(processManager: FakeProcessManager.any()),
FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(),

View File

@@ -1187,7 +1187,7 @@ unknown crash
logger: logger,
processManager: processManager,
fileSystem: fileSystem,
artifacts: Artifacts.test(localEngine: 'out/android_arm'),
artifacts: Artifacts.testLocalEngine(localEngine: 'out/android_arm', localEngineHost: 'out/host_release'),
usage: testUsage,
gradleUtils: FakeGradleUtils(),
platform: FakePlatform(),
@@ -1200,6 +1200,7 @@ unknown crash
'-Plocal-engine-repo=/.tmp_rand0/flutter_tool_local_engine_repo.rand0',
'-Plocal-engine-build-mode=release',
'-Plocal-engine-out=out/android_arm',
'-Plocal-engine-host-out=out/host_release',
'-Ptarget-platform=android-arm',
'-Ptarget=lib/main.dart',
'-Pbase-application-name=io.flutter.app.FlutterApplication',
@@ -1266,7 +1267,7 @@ unknown crash
logger: logger,
processManager: processManager,
fileSystem: fileSystem,
artifacts: Artifacts.test(localEngine: 'out/android_arm64'),
artifacts: Artifacts.testLocalEngine(localEngine: 'out/android_arm64', localEngineHost: 'out/host_release'),
usage: testUsage,
gradleUtils: FakeGradleUtils(),
platform: FakePlatform(),
@@ -1279,6 +1280,7 @@ unknown crash
'-Plocal-engine-repo=/.tmp_rand0/flutter_tool_local_engine_repo.rand0',
'-Plocal-engine-build-mode=release',
'-Plocal-engine-out=out/android_arm64',
'-Plocal-engine-host-out=out/host_release',
'-Ptarget-platform=android-arm64',
'-Ptarget=lib/main.dart',
'-Pbase-application-name=io.flutter.app.FlutterApplication',
@@ -1345,7 +1347,7 @@ unknown crash
logger: logger,
processManager: processManager,
fileSystem: fileSystem,
artifacts: Artifacts.test(localEngine: 'out/android_x86'),
artifacts: Artifacts.testLocalEngine(localEngine: 'out/android_x86', localEngineHost: 'out/host_release'),
usage: testUsage,
gradleUtils: FakeGradleUtils(),
platform: FakePlatform(),
@@ -1358,6 +1360,7 @@ unknown crash
'-Plocal-engine-repo=/.tmp_rand0/flutter_tool_local_engine_repo.rand0',
'-Plocal-engine-build-mode=release',
'-Plocal-engine-out=out/android_x86',
'-Plocal-engine-host-out=out/host_release',
'-Ptarget-platform=android-x86',
'-Ptarget=lib/main.dart',
'-Pbase-application-name=io.flutter.app.FlutterApplication',
@@ -1424,7 +1427,7 @@ unknown crash
logger: logger,
processManager: processManager,
fileSystem: fileSystem,
artifacts: Artifacts.test(localEngine: 'out/android_x64'),
artifacts: Artifacts.testLocalEngine(localEngine: 'out/android_x64', localEngineHost: 'out/host_release'),
usage: testUsage,
gradleUtils: FakeGradleUtils(),
platform: FakePlatform(),
@@ -1437,6 +1440,7 @@ unknown crash
'-Plocal-engine-repo=/.tmp_rand0/flutter_tool_local_engine_repo.rand0',
'-Plocal-engine-build-mode=release',
'-Plocal-engine-out=out/android_x64',
'-Plocal-engine-host-out=out/host_release',
'-Ptarget-platform=android-x64',
'-Ptarget=lib/main.dart',
'-Pbase-application-name=io.flutter.app.FlutterApplication',
@@ -1565,7 +1569,7 @@ unknown crash
logger: logger,
processManager: processManager,
fileSystem: fileSystem,
artifacts: Artifacts.test(localEngine: 'out/android_arm'),
artifacts: Artifacts.testLocalEngine(localEngine: 'out/android_arm', localEngineHost: 'out/host_release'),
usage: testUsage,
gradleUtils: FakeGradleUtils(),
platform: FakePlatform(),
@@ -1586,6 +1590,7 @@ unknown crash
'-Plocal-engine-repo=/.tmp_rand0/flutter_tool_local_engine_repo.rand0',
'-Plocal-engine-build-mode=release',
'-Plocal-engine-out=out/android_arm',
'-Plocal-engine-host-out=out/host_release',
'-Ptarget-platform=android-arm',
'assembleAarRelease',
],
@@ -1653,7 +1658,7 @@ unknown crash
logger: logger,
processManager: processManager,
fileSystem: fileSystem,
artifacts: Artifacts.test(localEngine: 'out/android_arm64'),
artifacts: Artifacts.testLocalEngine(localEngine: 'out/android_arm64', localEngineHost: 'out/host_release'),
usage: testUsage,
gradleUtils: FakeGradleUtils(),
platform: FakePlatform(),
@@ -1674,6 +1679,7 @@ unknown crash
'-Plocal-engine-repo=/.tmp_rand0/flutter_tool_local_engine_repo.rand0',
'-Plocal-engine-build-mode=release',
'-Plocal-engine-out=out/android_arm64',
'-Plocal-engine-host-out=out/host_release',
'-Ptarget-platform=android-arm64',
'assembleAarRelease',
],
@@ -1741,7 +1747,7 @@ unknown crash
logger: logger,
processManager: processManager,
fileSystem: fileSystem,
artifacts: Artifacts.test(localEngine: 'out/android_x86'),
artifacts: Artifacts.testLocalEngine(localEngine: 'out/android_x86', localEngineHost: 'out/host_release'),
usage: testUsage,
gradleUtils: FakeGradleUtils(),
platform: FakePlatform(),
@@ -1762,6 +1768,7 @@ unknown crash
'-Plocal-engine-repo=/.tmp_rand0/flutter_tool_local_engine_repo.rand0',
'-Plocal-engine-build-mode=release',
'-Plocal-engine-out=out/android_x86',
'-Plocal-engine-host-out=out/host_release',
'-Ptarget-platform=android-x86',
'assembleAarRelease',
],
@@ -1829,7 +1836,7 @@ unknown crash
logger: logger,
processManager: processManager,
fileSystem: fileSystem,
artifacts: Artifacts.test(localEngine: 'out/android_x64'),
artifacts: Artifacts.testLocalEngine(localEngine: 'out/android_x64', localEngineHost: 'out/host_release'),
usage: testUsage,
gradleUtils: FakeGradleUtils(),
platform: FakePlatform(),
@@ -1850,6 +1857,7 @@ unknown crash
'-Plocal-engine-repo=/.tmp_rand0/flutter_tool_local_engine_repo.rand0',
'-Plocal-engine-build-mode=release',
'-Plocal-engine-out=out/android_x64',
'-Plocal-engine-host-out=out/host_release',
'-Ptarget-platform=android-x64',
'assembleAarRelease',
],

View File

@@ -211,7 +211,7 @@ void main() {
setUp(() {
fs = MemoryFileSystem.test();
localEngineArtifacts = Artifacts.test(localEngine: 'out/android_arm');
localEngineArtifacts = Artifacts.testLocalEngine(localEngine: 'out/android_arm', localEngineHost: 'out/host_release');
});
void testUsingAndroidContext(String description, dynamic Function() testMethod) {

View File

@@ -104,17 +104,17 @@ void main() {
testWithoutContext('defaultIOSArchsForEnvironment', () {
expect(defaultIOSArchsForEnvironment(
EnvironmentType.physical,
Artifacts.test(localEngine: 'ios_debug_unopt'),
Artifacts.testLocalEngine(localEngineHost: 'host_debug_unopt', localEngine: 'ios_debug_unopt'),
).single, DarwinArch.arm64);
expect(defaultIOSArchsForEnvironment(
EnvironmentType.simulator,
Artifacts.test(localEngine: 'ios_debug_sim_unopt'),
Artifacts.testLocalEngine(localEngineHost: 'host_debug_unopt', localEngine: 'ios_debug_sim_unopt'),
).single, DarwinArch.x86_64);
expect(defaultIOSArchsForEnvironment(
EnvironmentType.simulator,
Artifacts.test(localEngine: 'ios_debug_sim_unopt_arm64'),
Artifacts.testLocalEngine(localEngineHost: 'host_debug_unopt', localEngine: 'ios_debug_sim_unopt_arm64'),
).single, DarwinArch.arm64);
expect(defaultIOSArchsForEnvironment(
@@ -128,11 +128,11 @@ void main() {
testWithoutContext('defaultMacOSArchsForEnvironment', () {
expect(defaultMacOSArchsForEnvironment(
Artifacts.test(localEngine: 'host_debug_unopt'),
Artifacts.testLocalEngine(localEngineHost: 'host_debug_unopt', localEngine: 'host_debug_unopt'),
).single, DarwinArch.x86_64);
expect(defaultMacOSArchsForEnvironment(
Artifacts.test(localEngine: 'host_debug_unopt_arm64'),
Artifacts.testLocalEngine(localEngineHost: 'host_debug_unopt', localEngine: 'host_debug_unopt_arm64'),
).single, DarwinArch.arm64);
expect(defaultMacOSArchsForEnvironment(

View File

@@ -754,7 +754,7 @@ Information about project "Runner":
setUp(() {
fs = MemoryFileSystem.test();
localIosArtifacts = Artifacts.test(localEngine: 'out/ios_profile_arm64');
localIosArtifacts = Artifacts.testLocalEngine(localEngine: 'out/ios_profile_arm64', localEngineHost: 'out/host_release');
macOS = FakePlatform(operatingSystem: 'macos');
fs.file(xcodebuild).createSync(recursive: true);
});
@@ -938,7 +938,7 @@ Build settings for action build and target plugin2:
}
testUsingOsxContext('exits when armv7 local engine is set', () async {
localIosArtifacts = Artifacts.test(localEngine: 'out/ios_profile_arm');
localIosArtifacts = Artifacts.testLocalEngine(localEngine: 'out/ios_profile_arm', localEngineHost: 'out/host_release');
const BuildInfo buildInfo = BuildInfo.debug;
final FlutterProject project = FlutterProject.fromDirectoryTest(fs.directory('path/to/project'));
await expectLater(() =>
@@ -971,7 +971,7 @@ Build settings for action build and target plugin2:
final String buildPhaseScriptContents = buildPhaseScript.readAsStringSync();
expect(buildPhaseScriptContents.contains('export "ARCHS=arm64"'), isTrue);
}, overrides: <Type, Generator>{
Artifacts: () => Artifacts.test(localEngine: 'out/host_profile_arm64'),
Artifacts: () => Artifacts.testLocalEngine(localEngine: 'out/host_profile_arm64', localEngineHost: 'out/host_release'),
Platform: () => macOS,
FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(),
@@ -998,7 +998,7 @@ Build settings for action build and target plugin2:
final String buildPhaseScriptContents = buildPhaseScript.readAsStringSync();
expect(buildPhaseScriptContents.contains('export "ARCHS=x86_64"'), isTrue);
}, overrides: <Type, Generator>{
Artifacts: () => Artifacts.test(localEngine: 'out/host_profile'),
Artifacts: () => Artifacts.testLocalEngine(localEngine: 'out/host_profile', localEngineHost: 'out/host_release'),
Platform: () => macOS,
FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(),
@@ -1083,7 +1083,7 @@ Build settings for action build and target plugin2:
final String buildPhaseScriptContents = buildPhaseScript.readAsStringSync();
expect(buildPhaseScriptContents.contains('ARCHS=x86_64'), isTrue);
}, overrides: <Type, Generator>{
Artifacts: () => Artifacts.test(localEngine: 'out/ios_debug_sim_unopt'),
Artifacts: () => Artifacts.testLocalEngine(localEngine: 'out/ios_debug_sim_unopt', localEngineHost: 'out/host_debug_unopt'),
Platform: () => macOS,
FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(),
@@ -1109,7 +1109,7 @@ Build settings for action build and target plugin2:
final String buildPhaseScriptContents = buildPhaseScript.readAsStringSync();
expect(buildPhaseScriptContents.contains('ARCHS=arm64'), isTrue);
}, overrides: <Type, Generator>{
Artifacts: () => Artifacts.test(localEngine: 'out/ios_debug_sim_arm64'),
Artifacts: () => Artifacts.testLocalEngine(localEngine: 'out/ios_debug_sim_arm64', localEngineHost: 'out/host_debug_unopt'),
Platform: () => macOS,
FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(),