diff --git a/examples/pubspec.yaml b/examples/pubspec.yaml index baaa0919ca..e5eff83499 100644 --- a/examples/pubspec.yaml +++ b/examples/pubspec.yaml @@ -1,6 +1,7 @@ name: examples_workspace publish_to: none +resolution: workspace environment: sdk: ^3.6.0 diff --git a/pubspec.yaml b/pubspec.yaml index 211dd166b3..b7b38f13d2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,6 +7,8 @@ environment: workspace: - tool/dart_site + - examples + - tool/get-dart dev_dependencies: dart_site: diff --git a/tool/dart_site/lib/src/commands/analyze_dart.dart b/tool/dart_site/lib/src/commands/analyze_dart.dart index 9937229f44..ccaf178944 100644 --- a/tool/dart_site/lib/src/commands/analyze_dart.dart +++ b/tool/dart_site/lib/src/commands/analyze_dart.dart @@ -5,7 +5,6 @@ import 'dart:io'; import 'package:args/command_runner.dart'; -import 'package:path/path.dart' as path; import '../utils.dart'; @@ -35,44 +34,26 @@ final class AnalyzeDartCommand extends Command { int analyzeDart({ bool verboseLogging = false, }) { - final directoriesToAnalyze = [ - path.join('tool', 'dart_site'), - path.join('examples'), - path.join('tool', 'get-dart'), - ]; - if (!verboseLogging) { print('Analyzing code...'); } - for (final directory in directoriesToAnalyze) { - if (verboseLogging) { - print("Analyzing code in '$directory' directory..."); - } - - if (runPubGetIfNecessary(directory) case final pubGetResult - when pubGetResult != 0) { - return pubGetResult; - } - - final dartAnalyzeOutput = Process.runSync( - Platform.executable, - const ['analyze', '.'], - workingDirectory: directory, - ); + final dartAnalyzeOutput = Process.runSync( + Platform.executable, + const ['analyze'], + ); - if (dartAnalyzeOutput.exitCode != 0) { - final normalOutput = dartAnalyzeOutput.stdout.toString(); - final errorOutput = dartAnalyzeOutput.stderr.toString(); + if (dartAnalyzeOutput.exitCode != 0) { + final normalOutput = dartAnalyzeOutput.stdout.toString(); + final errorOutput = dartAnalyzeOutput.stderr.toString(); - stderr.write(normalOutput); - stderr.write(errorOutput); - stderr.writeln("Error: Analysis on '$directory' directory failed."); - return 1; - } else { - if (verboseLogging) { - print("Successfully analyzed code in '$directory' directory!"); - } + stderr.write(normalOutput); + stderr.write(errorOutput); + stderr.writeln('Error: Analysis failed.'); + return 1; + } else { + if (verboseLogging) { + print('Successfully analyzed Dart code!'); } } diff --git a/tool/get-dart/pubspec.yaml b/tool/get-dart/pubspec.yaml index 461f0d1a8b..18c8b341b4 100644 --- a/tool/get-dart/pubspec.yaml +++ b/tool/get-dart/pubspec.yaml @@ -1,6 +1,7 @@ name: get_dart publish_to: none +resolution: workspace environment: sdk: ^3.6.0