Unverified Commit a3e66b39 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

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

parent db51c6d5
...@@ -291,7 +291,15 @@ class AssembleCommand extends FlutterCommand { ...@@ -291,7 +291,15 @@ class AssembleCommand extends FlutterCommand {
} }
} }
Target target; 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 if (FlutterProject.current().manifest.deferredComponents != null
&& decodedDefines.contains('validate-deferred-components=true') && decodedDefines.contains('validate-deferred-components=true')
&& deferredTargets.isNotEmpty && deferredTargets.isNotEmpty
......
...@@ -99,6 +99,28 @@ void main() { ...@@ -99,6 +99,28 @@ void main() {
ProcessManager: () => FakeProcessManager.any(), 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 { testUsingContext('flutter assemble throws ToolExit if called with non-existent rule', () async {
final CommandRunner<void> commandRunner = createTestCommandRunner(AssembleCommand( final CommandRunner<void> commandRunner = createTestCommandRunner(AssembleCommand(
buildSystem: TestBuildSystem.all(BuildResult(success: true)), buildSystem: TestBuildSystem.all(BuildResult(success: true)),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment