Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 2cddb14

Browse files
author
Dart CI
committed
Version 2.14.0-371.0.dev
Merge commit '58969783ba6b20b68c42da32a91a77e5862bbafb' into 'dev'
2 parents 406d207 + 5896978 commit 2cddb14

File tree

6 files changed

+20
-4
lines changed

6 files changed

+20
-4
lines changed

pkg/dartdev/lib/src/analysis_server.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,31 @@ import 'dart:io';
99
import 'package:analysis_server/src/server/driver.dart' show Driver;
1010
import 'package:analysis_server_client/protocol.dart'
1111
show EditBulkFixesResult, ResponseDecoder;
12+
import 'package:args/args.dart';
1213
import 'package:meta/meta.dart';
1314
import 'package:path/path.dart' as path;
1415

1516
import 'core.dart';
1617
import 'sdk.dart';
1718
import 'utils.dart';
1819

20+
/// When set, this function is executed just before the Analysis Server starts.
21+
void Function(String cmdName, List<FileSystemEntity> analysisRoots,
22+
ArgResults argResults) preAnalysisServerStart;
23+
1924
/// A class to provide an API wrapper around an analysis server process.
2025
class AnalysisServer {
2126
AnalysisServer(
2227
this.sdkPath,
2328
this.analysisRoots, {
2429
@required this.commandName,
30+
@required this.argResults,
2531
});
2632

2733
final Directory sdkPath;
2834
final List<FileSystemEntity> analysisRoots;
2935
final String commandName;
36+
final ArgResults argResults;
3037

3138
Process _process;
3239

@@ -69,6 +76,7 @@ class AnalysisServer {
6976
final Map<String, Completer<Map<String, dynamic>>> _requestCompleters = {};
7077

7178
Future<void> start() async {
79+
preAnalysisServerStart?.call(commandName, analysisRoots, argResults);
7280
final List<String> command = <String>[
7381
sdk.analysisServerSnapshot,
7482
'--${Driver.SUPPRESS_ANALYTICS_FLAG}',

pkg/dartdev/lib/src/commands/analyze.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ class AnalyzeCommand extends DartdevCommand {
100100
io.Directory(sdk.sdkPath),
101101
targets,
102102
commandName: 'analyze',
103+
argResults: argResults,
103104
);
104105

105106
server.onErrors.listen((FileAnalysisErrors fileErrors) {

pkg/dartdev/lib/src/commands/fix.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ To use the tool, run either ['dart fix --dry-run'] for a preview of the proposed
9393
io.Directory(sdk.sdkPath),
9494
[dir],
9595
commandName: 'fix',
96+
argResults: argResults,
9697
);
9798

9899
await server.start();

pkg/dartdev/lib/src/core.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ import 'utils.dart';
1818
Logger log;
1919
bool isDiagnostics = false;
2020

21+
/// When set, this function is executed from the [DartdevCommand] constructor to
22+
/// contribute additional flags.
23+
void Function(ArgParser argParser, String cmdName) flagContributor;
24+
2125
abstract class DartdevCommand extends Command<int> {
2226
final String _name;
2327
final String _description;
@@ -29,7 +33,9 @@ abstract class DartdevCommand extends Command<int> {
2933
final bool hidden;
3034

3135
DartdevCommand(this._name, this._description, this._verbose,
32-
{this.hidden = false});
36+
{this.hidden = false}) {
37+
flagContributor?.call(argParser, _name);
38+
}
3339

3440
@override
3541
String get name => _name;

pkg/dartdev/test/analysis_server_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ void main() {
2525

2626
test('can start', () async {
2727
AnalysisServer server = AnalysisServer(io.Directory(sdk.sdkPath), [p.dir],
28-
commandName: 'testing');
28+
commandName: 'testing', argResults: null);
2929
await server.start();
3030
await server.shutdown();
3131
});
3232

3333
test('can send message', () async {
3434
AnalysisServer server = AnalysisServer(io.Directory(sdk.sdkPath), [p.dir],
35-
commandName: 'testing');
35+
commandName: 'testing', argResults: null);
3636
await server.start();
3737

3838
final response = await server.getVersion();

tools/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ CHANNEL dev
2727
MAJOR 2
2828
MINOR 14
2929
PATCH 0
30-
PRERELEASE 370
30+
PRERELEASE 371
3131
PRERELEASE_PATCH 0

0 commit comments

Comments
 (0)