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:
Matan Lurey
2023-08-16 15:24:51 -07:00
committed by GitHub
parent 14f9ed28d0
commit 223ae5d3ac
8 changed files with 127 additions and 54 deletions

View File

@@ -247,9 +247,11 @@ void _writeGeneratedFlutterConfig(
};
final LocalEngineInfo? localEngineInfo = globals.artifacts?.localEngineInfo;
if (localEngineInfo != null) {
final String engineOutPath = localEngineInfo.engineOutPath;
environment['FLUTTER_ENGINE'] = globals.fs.path.dirname(globals.fs.path.dirname(engineOutPath));
environment['LOCAL_ENGINE'] = localEngineInfo.localEngineName;
final String targetOutPath = localEngineInfo.targetOutPath;
// Get the engine source root $ENGINE/src/out/foo_bar_baz -> $ENGINE/src
environment['FLUTTER_ENGINE'] = globals.fs.path.dirname(globals.fs.path.dirname(targetOutPath));
environment['LOCAL_ENGINE'] = localEngineInfo.localTargetName;
environment['LOCAL_ENGINE_HOST'] = localEngineInfo.localHostName;
}
writeGeneratedCmakeConfig(Cache.flutterRoot!, windowsProject, buildInfo, environment, globals.logger);
}