Write FLUTTER_BUILD_MODE when using a local engine (#51687)

This commit is contained in:
Dan Field
2020-03-04 07:36:55 -08:00
committed by GitHub
parent d8c0deb1b6
commit 9b4b7d7ee0
2 changed files with 79 additions and 16 deletions

View File

@@ -209,9 +209,20 @@ List<String> _xcodeBuildSettingsLines({
if (globals.artifacts is LocalEngineArtifacts) {
final LocalEngineArtifacts localEngineArtifacts = globals.artifacts as LocalEngineArtifacts;
final String engineOutPath = localEngineArtifacts.engineOutPath;
final String engineOutPath = globals.fs.path.basename(localEngineArtifacts.engineOutPath);
String engineBuildMode = 'release';
if (engineOutPath.toLowerCase().contains('debug')) {
engineBuildMode = 'debug';
} else if (engineOutPath.toLowerCase().contains('profile')) {
engineBuildMode = 'profile';
}
xcodeBuildSettings.add('FLUTTER_ENGINE=${globals.fs.path.dirname(globals.fs.path.dirname(engineOutPath))}');
xcodeBuildSettings.add('LOCAL_ENGINE=${globals.fs.path.basename(engineOutPath)}');
xcodeBuildSettings.add('LOCAL_ENGINE=$engineOutPath');
// Only write this or local engines, where it is supposed to be sticky to
// match the engine configuration. Avoid writing it otherwise so that it
// does not stick the user with the wrong build mode, particularly for
// existing app use cases.
xcodeBuildSettings.add('FLUTTER_BUILD_MODE=$engineBuildMode');
// Tell Xcode not to build universal binaries for local engines, which are
// single-architecture.