Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 * To generate docs for a library, run this script with the path to an | 6 * To generate docs for a library, run this script with the path to an |
| 7 * entrypoint .dart file, like: | 7 * entrypoint .dart file, like: |
| 8 * | 8 * |
| 9 * $ dart dartdoc.dart foo.dart | 9 * $ dart dartdoc.dart foo.dart |
| 10 * | 10 * |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 }; | 168 }; |
| 169 fromDir.list(recursive: false); | 169 fromDir.list(recursive: false); |
| 170 } | 170 } |
| 171 | 171 |
| 172 /** | 172 /** |
| 173 * Compiles the given Dart script to a JavaScript file at [jsPath] using the | 173 * Compiles the given Dart script to a JavaScript file at [jsPath] using the |
| 174 * Dart-to-JS compiler located at [compilerPath]. | 174 * Dart-to-JS compiler located at [compilerPath]. |
| 175 */ | 175 */ |
| 176 void compileScript(String compilerPath, String libDir, | 176 void compileScript(String compilerPath, String libDir, |
| 177 String dartPath, String jsPath) { | 177 String dartPath, String jsPath) { |
| 178 final process = new Process.start(compilerPath, [ | 178 onExit(int exitCode, String stdout, String stderr) { |
| 179 if (exitCode != 0) { | |
| 180 print('non-zero exit code from $compilerPath'); | |
|
Bob Nystrom
2012/04/23 16:03:20
Nit, but please make this a full sentence:
'Unexp
ahe
2012/04/24 10:31:02
Done.
| |
| 181 print(stdout); | |
| 182 print(stderr); | |
| 183 throw 'non-zero exit code from $compilerPath'; | |
| 184 } | |
| 185 } | |
| 186 | |
| 187 print('Compiling $dartPath to $jsPath'); | |
| 188 new Process.run(compilerPath, [ | |
| 179 '--libdir=$libDir', '--out=$jsPath', | 189 '--libdir=$libDir', '--out=$jsPath', |
| 180 '--compile-only', '--enable-type-checks', '--warnings-as-errors', | 190 '--compile-only', '--enable-type-checks', '--warnings-as-errors', |
| 181 dartPath]); | 191 dartPath], null, onExit); |
| 182 | |
| 183 process.stdout.pipe(stdout, close: false); | |
| 184 | |
| 185 process.onError = (error) { | |
|
ahe
2012/04/24 10:31:02
After talking to sgjesse about this, I restored th
| |
| 186 print('Failed to compile $dartPath with $compilerPath. Error:'); | |
| 187 print(error); | |
| 188 }; | |
| 189 } | 192 } |
| 190 | 193 |
| 191 class Dartdoc { | 194 class Dartdoc { |
| 192 | 195 |
| 193 /** Set to `false` to not include the source code in the generated docs. */ | 196 /** Set to `false` to not include the source code in the generated docs. */ |
| 194 bool includeSource = true; | 197 bool includeSource = true; |
| 195 | 198 |
| 196 /** | 199 /** |
| 197 * Dartdoc can generate docs in a few different ways based on how dynamic you | 200 * Dartdoc can generate docs in a few different ways based on how dynamic you |
| 198 * want the client-side behavior to be. The value for this should be one of | 201 * want the client-side behavior to be. The value for this should be one of |
| (...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1280 | 1283 |
| 1281 return new md.Element.text('code', name); | 1284 return new md.Element.text('code', name); |
| 1282 } | 1285 } |
| 1283 | 1286 |
| 1284 // TODO(rnystrom): Move into SourceSpan? | 1287 // TODO(rnystrom): Move into SourceSpan? |
| 1285 int getSpanColumn(SourceSpan span) { | 1288 int getSpanColumn(SourceSpan span) { |
| 1286 final line = span.file.getLine(span.start); | 1289 final line = span.file.getLine(span.start); |
| 1287 return span.file.getColumn(line, span.start); | 1290 return span.file.getColumn(line, span.start); |
| 1288 } | 1291 } |
| 1289 } | 1292 } |
| OLD | NEW |