@@ -112,7 +112,7 @@ void main() {
112
112
createCoreMockProjectFiles ();
113
113
114
114
expect (createTestCommandRunner (command).run (
115
- const < String > ['build' , 'macos' ]
115
+ const < String > ['build' , 'macos' , '--no-pub' ]
116
116
), throwsToolExit (message: 'No macOS desktop project configured' ));
117
117
}, overrides: < Type , Generator > {
118
118
Platform : () => macosPlatform,
@@ -129,7 +129,7 @@ void main() {
129
129
.createSync (recursive: true );
130
130
131
131
expect (createTestCommandRunner (command).run (
132
- const < String > ['build' , 'macos' ]
132
+ const < String > ['build' , 'macos' , '--no-pub' ]
133
133
), throwsToolExit ());
134
134
}, overrides: < Type , Generator > {
135
135
Platform : () => notMacosPlatform,
@@ -143,7 +143,7 @@ void main() {
143
143
createMinimalMockProjectFiles ();
144
144
145
145
await createTestCommandRunner (command).run (
146
- const < String > ['build' , 'macos' , '--debug' ]
146
+ const < String > ['build' , 'macos' , '--debug' , '--no-pub' ]
147
147
);
148
148
expect (testLogger.statusText, isNot (contains ('STDOUT STUFF' )));
149
149
expect (testLogger.traceText, isNot (contains ('STDOUT STUFF' )));
@@ -162,7 +162,7 @@ void main() {
162
162
createMinimalMockProjectFiles ();
163
163
164
164
await createTestCommandRunner (command).run (
165
- const < String > ['build' , 'macos' , '--debug' ]
165
+ const < String > ['build' , 'macos' , '--debug' , '--no-pub' ]
166
166
);
167
167
}, overrides: < Type , Generator > {
168
168
FileSystem : () => fileSystem,
@@ -178,7 +178,7 @@ void main() {
178
178
createMinimalMockProjectFiles ();
179
179
180
180
await createTestCommandRunner (command).run (
181
- const < String > ['build' , 'macos' , '--debug' , '-v' ]
181
+ const < String > ['build' , 'macos' , '--debug' , '--no-pub' , '- v' ]
182
182
);
183
183
}, overrides: < Type , Generator > {
184
184
FileSystem : () => fileSystem,
@@ -195,7 +195,7 @@ void main() {
195
195
createMinimalMockProjectFiles ();
196
196
197
197
await createTestCommandRunner (command).run (
198
- const < String > ['build' , 'macos' , '--profile' ]
198
+ const < String > ['build' , 'macos' , '--profile' , '--no-pub' ]
199
199
);
200
200
}, overrides: < Type , Generator > {
201
201
FileSystem : () => fileSystem,
@@ -212,7 +212,7 @@ void main() {
212
212
createMinimalMockProjectFiles ();
213
213
214
214
await createTestCommandRunner (command).run (
215
- const < String > ['build' , 'macos' , '--release' ]
215
+ const < String > ['build' , 'macos' , '--release' , '--no-pub' ]
216
216
);
217
217
}, overrides: < Type , Generator > {
218
218
FileSystem : () => fileSystem,
@@ -223,6 +223,52 @@ void main() {
223
223
FeatureFlags : () => TestFeatureFlags (isMacOSEnabled: true ),
224
224
});
225
225
226
+ testUsingContext ('macOS build supports standard desktop build options' , () async {
227
+ final BuildCommand command = BuildCommand ();
228
+ createMinimalMockProjectFiles ();
229
+ fileSystem.file ('lib/other.dart' )
230
+ .createSync (recursive: true );
231
+
232
+ await createTestCommandRunner (command).run (
233
+ const < String > [
234
+ 'build' ,
235
+ 'macos' ,
236
+ '--target=lib/other.dart' ,
237
+ '--no-pub' ,
238
+ '--track-widget-creation' ,
239
+ '--split-debug-info=foo/' ,
240
+ '--enable-experiment=non-nullable' ,
241
+ '--obfuscate' ,
242
+ '--dart-define=foo.bar=2' ,
243
+ '--dart-define=fizz.far=3' ,
244
+ '--tree-shake-icons' ,
245
+ '--bundle-sksl-path=foo/bar.sksl.json' ,
246
+ ]
247
+ );
248
+ final List <String > contents = fileSystem
249
+ .file ('./macos/Flutter/ephemeral/Flutter-Generated.xcconfig' )
250
+ .readAsLinesSync ();
251
+
252
+ expect (contents, containsAll (< String > [
253
+ 'DART_DEFINES=foo.bar%3D2,fizz.far%3D3' ,
254
+ 'DART_OBFUSCATION=true' ,
255
+ 'EXTRA_FRONT_END_OPTIONS=--enable-experiment%3Dnon-nullable' ,
256
+ 'EXTRA_GEN_SNAPSHOT_OPTIONS=--enable-experiment%3Dnon-nullable' ,
257
+ 'SPLIT_DEBUG_INFO=foo/' ,
258
+ 'TRACK_WIDGET_CREATION=true' ,
259
+ 'TREE_SHAKE_ICONS=true' ,
260
+ 'FLUTTER_TARGET=lib/other.dart' ,
261
+ 'BUNDLE_SKSL_PATH=foo/bar.sksl.json' ,
262
+ ]));
263
+ }, overrides: < Type , Generator > {
264
+ FileSystem : () => fileSystem,
265
+ ProcessManager : () => FakeProcessManager .list (< FakeCommand > [
266
+ setUpMockXcodeBuildHandler ('Release' )
267
+ ]),
268
+ Platform : () => macosPlatform,
269
+ FeatureFlags : () => TestFeatureFlags (isMacOSEnabled: true ),
270
+ });
271
+
226
272
testUsingContext ('macOS build supports build-name and build-number' , () async {
227
273
final BuildCommand command = BuildCommand ();
228
274
createMinimalMockProjectFiles ();
@@ -232,6 +278,7 @@ void main() {
232
278
'build' ,
233
279
'macos' ,
234
280
'--debug' ,
281
+ '--no-pub' ,
235
282
'--build-name=1.2.3' ,
236
283
'--build-number=42' ,
237
284
],
@@ -254,7 +301,7 @@ void main() {
254
301
testUsingContext ('Refuses to build for macOS when feature is disabled' , () {
255
302
final CommandRunner <void > runner = createTestCommandRunner (BuildCommand ());
256
303
257
- expect (() => runner.run (< String > ['build' , 'macos' ]),
304
+ expect (() => runner.run (< String > ['build' , 'macos' , '--no-pub' ]),
258
305
throwsToolExit ());
259
306
}, overrides: < Type , Generator > {
260
307
FeatureFlags : () => TestFeatureFlags (isMacOSEnabled: false ),
@@ -283,7 +330,7 @@ void main() {
283
330
..writeAsBytesSync (List <int >.generate (10000 , (int index) => 0 ));
284
331
285
332
await createTestCommandRunner (command).run (
286
- const < String > ['build' , 'macos' , '--analyze-size' ]
333
+ const < String > ['build' , 'macos' , '--no-pub' , '-- analyze-size' ]
287
334
);
288
335
289
336
expect (testLogger.statusText, contains ('A summary of your macOS bundle analysis can be found at' ));
0 commit comments