Skip to content

Commit

Permalink
Check if the workspace is flutter & run flutter analyze instead of da…
Browse files Browse the repository at this point in the history
…rt analyze
  • Loading branch information
mnayef95 committed Nov 15, 2024
1 parent bc2da5f commit adb6939
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/melos/lib/src/commands/analyze.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ mixin _AnalyzeMixin on _Melos {
}) {
final options = _getOptionsArgs(fatalInfos, fatalWarnings, concurrency);
return <String>[
workspace.sdkTool('dart'),
if (workspace.isFlutterWorkspace)
workspace.sdkTool('flutter')
else
workspace.sdkTool('dart'),
'analyze',
options,
];
Expand Down
28 changes: 28 additions & 0 deletions packages/melos/test/commands/analyze_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,34 @@ $ melos analyze
expect(regex.hasMatch(logger.output.normalizeNewLines()), isTrue);
});

test('should run analysis with using flutter', () async {
final workspaceDir = await createTemporaryWorkspace();

await createProject(
workspaceDir,
PubSpec(
name: 'a',
dependencies: {
'c': HostedReference(VersionConstraint.any),
'flutter': const SdkReference('flutter'),
},
),
);

final config = await MelosWorkspaceConfig.fromWorkspaceRoot(workspaceDir);

final melos = Melos(
logger: logger,
config: config,
);
await melos.analyze(concurrency: 2);

final regex =
RegExp(r'\$ melos analyze\s+└> flutter analyze --concurrency 2');

expect(regex.hasMatch(logger.output.normalizeNewLines()), isTrue);
});

test('should run analysis with --concurrency 2 flag', () async {
await melos.analyze(concurrency: 2);

Expand Down

0 comments on commit adb6939

Please sign in to comment.