Skip to content

Commit adb6939

Browse files
committed
Check if the workspace is flutter & run flutter analyze instead of dart analyze
1 parent bc2da5f commit adb6939

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

packages/melos/lib/src/commands/analyze.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ mixin _AnalyzeMixin on _Melos {
110110
}) {
111111
final options = _getOptionsArgs(fatalInfos, fatalWarnings, concurrency);
112112
return <String>[
113-
workspace.sdkTool('dart'),
113+
if (workspace.isFlutterWorkspace)
114+
workspace.sdkTool('flutter')
115+
else
116+
workspace.sdkTool('dart'),
114117
'analyze',
115118
options,
116119
];

packages/melos/test/commands/analyze_test.dart

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,34 @@ $ melos analyze
277277
expect(regex.hasMatch(logger.output.normalizeNewLines()), isTrue);
278278
});
279279

280+
test('should run analysis with using flutter', () async {
281+
final workspaceDir = await createTemporaryWorkspace();
282+
283+
await createProject(
284+
workspaceDir,
285+
PubSpec(
286+
name: 'a',
287+
dependencies: {
288+
'c': HostedReference(VersionConstraint.any),
289+
'flutter': const SdkReference('flutter'),
290+
},
291+
),
292+
);
293+
294+
final config = await MelosWorkspaceConfig.fromWorkspaceRoot(workspaceDir);
295+
296+
final melos = Melos(
297+
logger: logger,
298+
config: config,
299+
);
300+
await melos.analyze(concurrency: 2);
301+
302+
final regex =
303+
RegExp(r'\$ melos analyze\s+└> flutter analyze --concurrency 2');
304+
305+
expect(regex.hasMatch(logger.output.normalizeNewLines()), isTrue);
306+
});
307+
280308
test('should run analysis with --concurrency 2 flag', () async {
281309
await melos.analyze(concurrency: 2);
282310

0 commit comments

Comments
 (0)