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

Side by Side Diff: lib/component_build.dart

Issue 11611003: Fix #269 - detect correctly generated files that are indirectly under the out (Closed) Base URL: git@github.com:dart-lang/web-ui.git@master
Patch Set: Created 8 years 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 | pubspec.yaml » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 * Common logic to make it easy to create a `build.dart` for your project. 6 * Common logic to make it easy to create a `build.dart` for your project.
7 * 7 *
8 * The `build.dart` script is invoked automatically by the Editor whenever a 8 * The `build.dart` script is invoked automatically by the Editor whenever a
9 * file in the project changes. It must be placed in the root of a project 9 * file in the project changes. It must be placed in the root of a project
10 * (where pubspec.yaml lives) and should be named exactly 'build.dart'. 10 * (where pubspec.yaml lives) and should be named exactly 'build.dart'.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 } 66 }
67 } 67 }
68 } 68 }
69 69
70 String _outDir(String file) => 70 String _outDir(String file) =>
71 new Path(file).directoryPath.append('out').toString(); 71 new Path(file).directoryPath.append('out').toString();
72 72
73 bool _isGeneratedFile(String filePath, List<Directory> outputDirs) { 73 bool _isGeneratedFile(String filePath, List<Directory> outputDirs) {
74 var path = new Path.fromNative(filePath); 74 var path = new Path.fromNative(filePath);
75 var dirPrefix = path.directoryPath.toString();
75 for (var dir in outputDirs) { 76 for (var dir in outputDirs) {
76 if (path.directoryPath.toString() == dir.path) return true; 77 if (dirPrefix.startsWith(dir.path)) return true;
77 } 78 }
78 return path.filename.startsWith('_'); 79 return path.filename.startsWith('_');
79 } 80 }
80 81
81 bool _isInputFile(String path, List<Directory> outputDirs) { 82 bool _isInputFile(String path, List<Directory> outputDirs) {
82 return (path.endsWith(".dart") || path.endsWith(".html")) 83 return (path.endsWith(".dart") || path.endsWith(".html"))
83 && !_isGeneratedFile(path, outputDirs); 84 && !_isGeneratedFile(path, outputDirs);
84 } 85 }
85 86
86 /** Delete all generated files. */ 87 /** Delete all generated files. */
(...skipping 25 matching lines...) Expand all
112 ..addFlag("machine", negatable: false, 113 ..addFlag("machine", negatable: false,
113 help: "produce warnings in a machine parseable format") 114 help: "produce warnings in a machine parseable format")
114 ..addFlag("help", negatable: false, help: "displays this help and exit"); 115 ..addFlag("help", negatable: false, help: "displays this help and exit");
115 var args = parser.parse(arguments); 116 var args = parser.parse(arguments);
116 if (args["help"]) { 117 if (args["help"]) {
117 print(parser.getUsage()); 118 print(parser.getUsage());
118 exit(0); 119 exit(0);
119 } 120 }
120 return args; 121 return args;
121 } 122 }
OLDNEW
« no previous file with comments | « no previous file | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698