Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Side by Side Diff: pkg/analyzer_cli/lib/src/build_mode.dart

Issue 1859363003: allow --dart-sdk with --persisent_worker (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: code review updates Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analyzer_cli/lib/src/driver.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer_cli.src.build_mode; 5 library analyzer_cli.src.build_mode;
6 6
7 import 'dart:core' hide Resource; 7 import 'dart:core' hide Resource;
8 import 'dart:io' as io; 8 import 'dart:io' as io;
9 9
10 import 'package:protobuf/protobuf.dart'; 10 import 'package:protobuf/protobuf.dart';
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 */ 307 */
308 class WorkerLoop { 308 class WorkerLoop {
309 static const int EXIT_CODE_OK = 0; 309 static const int EXIT_CODE_OK = 0;
310 static const int EXIT_CODE_ERROR = 15; 310 static const int EXIT_CODE_ERROR = 15;
311 311
312 final WorkerConnection connection; 312 final WorkerConnection connection;
313 313
314 final StringBuffer errorBuffer = new StringBuffer(); 314 final StringBuffer errorBuffer = new StringBuffer();
315 final StringBuffer outBuffer = new StringBuffer(); 315 final StringBuffer outBuffer = new StringBuffer();
316 316
317 WorkerLoop(this.connection); 317 final String dartSdkPath;
318 318
319 factory WorkerLoop.std({io.Stdin stdinStream, io.Stdout stdoutStream}) { 319 WorkerLoop(this.connection, {this.dartSdkPath});
320
321 factory WorkerLoop.std(
322 {io.Stdin stdinStream, io.Stdout stdoutStream, String dartSdkPath}) {
320 stdinStream ??= io.stdin; 323 stdinStream ??= io.stdin;
321 stdoutStream ??= io.stdout; 324 stdoutStream ??= io.stdout;
322 WorkerConnection connection = 325 WorkerConnection connection =
323 new StdWorkerConnection(stdinStream, stdoutStream); 326 new StdWorkerConnection(stdinStream, stdoutStream);
324 return new WorkerLoop(connection); 327 return new WorkerLoop(connection, dartSdkPath: dartSdkPath);
325 } 328 }
326 329
327 /** 330 /**
328 * Performs analysis with given [options]. 331 * Performs analysis with given [options].
329 */ 332 */
330 void analyze(CommandLineOptions options) { 333 void analyze(CommandLineOptions options) {
334 options.dartSdkPath ??= dartSdkPath;
331 new BuildMode(options, new AnalysisStats()).analyze(); 335 new BuildMode(options, new AnalysisStats()).analyze();
332 } 336 }
333 337
334 /** 338 /**
335 * Perform a single loop step. Return `true` if should exit the loop. 339 * Perform a single loop step. Return `true` if should exit the loop.
336 */ 340 */
337 bool performSingle() { 341 bool performSingle() {
338 try { 342 try {
339 WorkRequest request = connection.readRequest(); 343 WorkRequest request = connection.readRequest();
340 if (request == null) { 344 if (request == null) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 void writeResponse(WorkResponse response) { 418 void writeResponse(WorkResponse response) {
415 var responseBuffer = response.writeToBuffer(); 419 var responseBuffer = response.writeToBuffer();
416 420
417 var writer = new CodedBufferWriter(); 421 var writer = new CodedBufferWriter();
418 writer.writeInt32NoTag(responseBuffer.length); 422 writer.writeInt32NoTag(responseBuffer.length);
419 writer.writeRawBytes(responseBuffer); 423 writer.writeRawBytes(responseBuffer);
420 424
421 _stdoutStream.add(writer.toBuffer()); 425 _stdoutStream.add(writer.toBuffer());
422 } 426 }
423 } 427 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer_cli/lib/src/driver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698