File tree Expand file tree Collapse file tree 3 files changed +37
-3
lines changed
test/commands.shard/hermetic Expand file tree Collapse file tree 3 files changed +37
-3
lines changed Original file line number Diff line number Diff line change @@ -249,7 +249,7 @@ class AssembleCommand extends FlutterCommand {
249249 output = globals.fs.path.join (_flutterProject.directory.path, output);
250250 }
251251 final Artifacts artifacts = globals.artifacts! ;
252- final result = Environment (
252+ return Environment (
253253 outputDir: globals.fs.directory (output),
254254 buildDir: _flutterProject.directory
255255 .childDirectory ('.dart_tool' )
@@ -269,12 +269,14 @@ class AssembleCommand extends FlutterCommand {
269269 engineVersion: artifacts.usesLocalArtifacts ? null : globals.flutterVersion.engineRevision,
270270 generateDartPluginRegistry: true ,
271271 );
272- return result;
273272 }
274273
275274 Map <String , String > _parseDefines (List <String > values) {
276275 final results = < String , String > {};
277276 for (final chunk in values) {
277+ if (chunk.isEmpty) {
278+ continue ;
279+ }
278280 final int indexEquals = chunk.indexOf ('=' );
279281 if (indexEquals == - 1 ) {
280282 throwToolExit ('Improperly formatted define flag: $chunk ' );
Original file line number Diff line number Diff line change @@ -1603,7 +1603,10 @@ abstract class FlutterCommand extends Command<void> {
16031603 });
16041604
16051605 if (argParser.options.containsKey (FlutterOptions .kDartDefinesOption)) {
1606- dartDefines.addAll (stringsArg (FlutterOptions .kDartDefinesOption));
1606+ final Iterable <String > defines = stringsArg (
1607+ FlutterOptions .kDartDefinesOption,
1608+ ).where ((string) => string.isNotEmpty);
1609+ dartDefines.addAll (defines);
16071610 }
16081611
16091612 return dartDefines;
Original file line number Diff line number Diff line change @@ -85,6 +85,35 @@ void main() {
8585 },
8686 );
8787
88+ testUsingContext (
89+ 'flutter assemble can parse empty defines' ,
90+ () async {
91+ final CommandRunner <void > commandRunner = createTestCommandRunner (
92+ AssembleCommand (
93+ buildSystem: TestBuildSystem .all (BuildResult (success: true ), (
94+ Target target,
95+ Environment environment,
96+ ) {
97+ expect (environment.defines, const {'DeferredComponents' : 'false' });
98+ }),
99+ ),
100+ );
101+ await commandRunner.run (< String > [
102+ 'assemble' ,
103+ '-o Output' ,
104+ '--DartDefines=' ,
105+ 'debug_macos_bundle_flutter_assets' ,
106+ ]);
107+
108+ expect (testLogger.traceText, contains ('build succeeded.' ));
109+ },
110+ overrides: < Type , Generator > {
111+ Cache : () => Cache .test (processManager: FakeProcessManager .any ()),
112+ FileSystem : () => MemoryFileSystem .test (),
113+ ProcessManager : () => FakeProcessManager .any (),
114+ },
115+ );
116+
88117 testUsingContext (
89118 'flutter assemble can parse inputs' ,
90119 () async {
You can’t perform that action at this time.
0 commit comments