[flutter_tools] handle out of date xcode config in assemble (#79983)

This commit is contained in:
Jonah Williams
2021-04-08 15:22:38 -07:00
committed by GitHub
parent db51c6d510
commit a3e66b3967
2 changed files with 31 additions and 1 deletions

View File

@@ -291,7 +291,15 @@ class AssembleCommand extends FlutterCommand {
}
}
Target target;
final List<String> decodedDefines = decodeDartDefines(environment.defines, kDartDefines);
List<String> decodedDefines;
try {
decodedDefines = decodeDartDefines(environment.defines, kDartDefines);
} on FormatException {
throwToolExit(
'Error parsing assemble command: your generated configuration may be out of date. '
"Try re-running 'flutter build ios' or the appropriate build command."
);
}
if (FlutterProject.current().manifest.deferredComponents != null
&& decodedDefines.contains('validate-deferred-components=true')
&& deferredTargets.isNotEmpty

View File

@@ -99,6 +99,28 @@ void main() {
ProcessManager: () => FakeProcessManager.any(),
});
testUsingContext('flutter assemble throws ToolExit if dart-defines are not base64 encoded', () async {
final CommandRunner<void> commandRunner = createTestCommandRunner(AssembleCommand(
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
));
final List<String> command = <String>[
'assemble',
'--output',
'Output',
'--DartDefines=flutter.inspector.structuredErrors%3Dtrue',
'debug_macos_bundle_flutter_assets',
];
expect(
commandRunner.run(command),
throwsToolExit(message: 'Error parsing assemble command: your generated configuration may be out of date')
);
}, overrides: <Type, Generator>{
Cache: () => Cache.test(processManager: FakeProcessManager.any()),
FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.any(),
});
testUsingContext('flutter assemble throws ToolExit if called with non-existent rule', () async {
final CommandRunner<void> commandRunner = createTestCommandRunner(AssembleCommand(
buildSystem: TestBuildSystem.all(BuildResult(success: true)),