forked from firka/flutter
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:
@@ -401,6 +401,7 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
||||
command.add('-Plocal-engine-repo=${localEngineRepo.path}');
|
||||
command.add('-Plocal-engine-build-mode=${buildInfo.modeName}');
|
||||
command.add('-Plocal-engine-out=${localEngineInfo.engineOutPath}');
|
||||
command.add('-Plocal-engine-host-out=${localEngineInfo.engineHostOutPath}');
|
||||
command.add('-Ptarget-platform=${_getTargetPlatformByLocalEnginePath(
|
||||
localEngineInfo.engineOutPath)}');
|
||||
} else if (androidBuildInfo.targetArchs.isNotEmpty) {
|
||||
@@ -726,6 +727,7 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
||||
command.add('-Plocal-engine-repo=${localEngineRepo.path}');
|
||||
command.add('-Plocal-engine-build-mode=${buildInfo.modeName}');
|
||||
command.add('-Plocal-engine-out=${localEngineInfo.engineOutPath}');
|
||||
command.add('-Plocal-engine-host-out=${localEngineInfo.engineHostOutPath}');
|
||||
|
||||
// Copy the local engine repo in the output directory.
|
||||
try {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:process/process.dart';
|
||||
|
||||
import 'base/common.dart';
|
||||
@@ -287,10 +288,12 @@ class EngineBuildPaths {
|
||||
class LocalEngineInfo {
|
||||
const LocalEngineInfo({
|
||||
required this.engineOutPath,
|
||||
required this.engineHostOutPath,
|
||||
required this.localEngineName,
|
||||
});
|
||||
|
||||
final String engineOutPath;
|
||||
final String engineHostOutPath;
|
||||
final String localEngineName;
|
||||
}
|
||||
|
||||
@@ -302,12 +305,23 @@ abstract class Artifacts {
|
||||
/// If a [fileSystem] is not provided, creates a new [MemoryFileSystem] instance.
|
||||
///
|
||||
/// Creates a [LocalEngineArtifacts] if `localEngine` is non-null
|
||||
factory Artifacts.test({String? localEngine, FileSystem? fileSystem}) {
|
||||
fileSystem ??= MemoryFileSystem.test();
|
||||
if (localEngine != null) {
|
||||
return _TestLocalEngine(localEngine, fileSystem);
|
||||
}
|
||||
return _TestArtifacts(fileSystem);
|
||||
@visibleForTesting
|
||||
factory Artifacts.test({FileSystem? fileSystem}) {
|
||||
return _TestArtifacts(fileSystem ?? MemoryFileSystem.test());
|
||||
}
|
||||
|
||||
/// A test-specific implementation of artifacts that returns stable paths for
|
||||
/// all artifacts, and uses a local engine.
|
||||
///
|
||||
/// If a [fileSystem] is not provided, creates a new [MemoryFileSystem] instance.
|
||||
@visibleForTesting
|
||||
factory Artifacts.testLocalEngine({
|
||||
required String localEngine,
|
||||
required String localEngineHost,
|
||||
FileSystem? fileSystem,
|
||||
}) {
|
||||
return _TestLocalEngine(
|
||||
localEngine, localEngineHost, fileSystem ?? MemoryFileSystem.test());
|
||||
}
|
||||
|
||||
static Artifacts getLocalEngine(EngineBuildPaths engineBuildPaths) {
|
||||
@@ -811,6 +825,7 @@ class CachedLocalEngineArtifacts implements Artifacts {
|
||||
localEngineInfo =
|
||||
LocalEngineInfo(
|
||||
engineOutPath: engineOutPath,
|
||||
engineHostOutPath: _hostEngineOutPath,
|
||||
localEngineName: fileSystem.path.basename(engineOutPath)
|
||||
),
|
||||
_cache = cache,
|
||||
@@ -1365,12 +1380,12 @@ class _TestArtifacts implements Artifacts {
|
||||
}
|
||||
|
||||
class _TestLocalEngine extends _TestArtifacts {
|
||||
_TestLocalEngine(String engineOutPath, super.fileSystem) :
|
||||
localEngineInfo =
|
||||
LocalEngineInfo(
|
||||
engineOutPath: engineOutPath,
|
||||
localEngineName: fileSystem.path.basename(engineOutPath)
|
||||
);
|
||||
_TestLocalEngine(
|
||||
String engineOutPath, String engineHostOutPath, super.fileSystem)
|
||||
: localEngineInfo = LocalEngineInfo(
|
||||
engineOutPath: engineOutPath,
|
||||
engineHostOutPath: engineHostOutPath,
|
||||
localEngineName: fileSystem.path.basename(engineOutPath));
|
||||
|
||||
@override
|
||||
bool get isLocalEngine => true;
|
||||
|
||||
@@ -72,6 +72,7 @@ class IMobileDevice {
|
||||
/// Create an [IMobileDevice] for testing.
|
||||
factory IMobileDevice.test({ required ProcessManager processManager }) {
|
||||
return IMobileDevice(
|
||||
// ignore: invalid_use_of_visible_for_testing_member
|
||||
artifacts: Artifacts.test(),
|
||||
cache: Cache.test(processManager: processManager),
|
||||
processManager: processManager,
|
||||
|
||||
Reference in New Issue
Block a user