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

Side by Side Diff: pkg/analysis_server/tool/spec/codegen_tools.dart

Issue 474883002: Pub buildbot fix, TBR- Paul (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/tool/spec/check_all_test.dart ('k') | no next file » | 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 /** 5 /**
6 * Tools for code generation. 6 * Tools for code generation.
7 */ 7 */
8 library codegen.tools; 8 library codegen.tools;
9 9
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 } 299 }
300 300
301 /** 301 /**
302 * Type of functions used to compute the contents of generated files. 302 * Type of functions used to compute the contents of generated files.
303 */ 303 */
304 typedef String FileContentsComputer(); 304 typedef String FileContentsComputer();
305 305
306 typedef Map<String, FileContentsComputer> DirectoryContentsComputer(); 306 typedef Map<String, FileContentsComputer> DirectoryContentsComputer();
307 307
308 abstract class GeneratedContent { 308 abstract class GeneratedContent {
309 FileSystemEntity get outputFile;
309 bool check(); 310 bool check();
310 void generate(); 311 void generate();
311 } 312 }
312 313
313 /** 314 /**
314 * Class representing a single output file (either generated code or generated 315 * Class representing a single output file (either generated code or generated
315 * HTML). 316 * HTML).
316 */ 317 */
317 class GeneratedFile extends GeneratedContent { 318 class GeneratedFile extends GeneratedContent {
318 /** 319 /**
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 364
364 class GeneratedDirectory extends GeneratedContent { 365 class GeneratedDirectory extends GeneratedContent {
365 366
366 final String outputDirPath; 367 final String outputDirPath;
367 final DirectoryContentsComputer directoryContentsComputer; 368 final DirectoryContentsComputer directoryContentsComputer;
368 GeneratedDirectory(this.outputDirPath, this.directoryContentsComputer); 369 GeneratedDirectory(this.outputDirPath, this.directoryContentsComputer);
369 370
370 /** 371 /**
371 * Get a Directory object representing the output directory. 372 * Get a Directory object representing the output directory.
372 */ 373 */
373 Directory get outputDir => new Directory(joinAll(posix.split(outputDirPath))); 374 Directory get outputFile => new Directory(joinAll(posix.split(outputDirPath))) ;
374 375
375 @override 376 @override
376 bool check() { 377 bool check() {
377 // TODO (jwren) the lists of files in the directories need to be compared to 378 // TODO (jwren) the lists of files in the directories need to be compared to
378 // ensure no unexpected files have been added 379 // ensure no unexpected files have been added
379 Map<String, FileContentsComputer> map = directoryContentsComputer(); 380 Map<String, FileContentsComputer> map = directoryContentsComputer();
380 map.forEach((String file, FileContentsComputer fileContentsComputer) { 381 map.forEach((String file, FileContentsComputer fileContentsComputer) {
381 String expectedContents = fileContentsComputer(); 382 String expectedContents = fileContentsComputer();
382 File outputFile = new File(joinAll(posix.split(outputDirPath + file))); 383 File outputFile = new File(joinAll(posix.split(outputDirPath + file)));
383 try { 384 try {
(...skipping 13 matching lines...) Expand all
397 @override 398 @override
398 void generate() { 399 void generate() {
399 // TODO (jwren) Delete contents in the directory first. 400 // TODO (jwren) Delete contents in the directory first.
400 Map<String, FileContentsComputer> map = directoryContentsComputer(); 401 Map<String, FileContentsComputer> map = directoryContentsComputer();
401 map.forEach((String file, FileContentsComputer fileContentsComputer) { 402 map.forEach((String file, FileContentsComputer fileContentsComputer) {
402 File outputFile = new File(joinAll(posix.split(outputDirPath + file))); 403 File outputFile = new File(joinAll(posix.split(outputDirPath + file)));
403 outputFile.writeAsStringSync(fileContentsComputer()); 404 outputFile.writeAsStringSync(fileContentsComputer());
404 }); 405 });
405 } 406 }
406 } 407 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/tool/spec/check_all_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698