| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 return dirname(new File(new Options().script).fullPathSync()); | 133 return dirname(new File(new Options().script).fullPathSync()); |
| 134 } | 134 } |
| 135 | 135 |
| 136 /** | 136 /** |
| 137 * Deletes and recreates the output directory at [path] if it exists. | 137 * Deletes and recreates the output directory at [path] if it exists. |
| 138 */ | 138 */ |
| 139 void cleanOutputDirectory(String path) { | 139 void cleanOutputDirectory(String path) { |
| 140 final outputDir = new Directory(path); | 140 final outputDir = new Directory(path); |
| 141 if (outputDir.existsSync()) { | 141 if (outputDir.existsSync()) { |
| 142 outputDir.deleteRecursivelySync(); | 142 outputDir.deleteRecursivelySync(); |
| 143 outputDir.createSync(); | |
| 144 } | 143 } |
| 144 |
| 145 outputDir.createSync(); |
| 145 } | 146 } |
| 146 | 147 |
| 147 /** | 148 /** |
| 148 * Copies all of the files in the directory [from] to [to]. Does *not* | 149 * Copies all of the files in the directory [from] to [to]. Does *not* |
| 149 * recursively copy subdirectories. | 150 * recursively copy subdirectories. |
| 150 * | 151 * |
| 151 * Note: runs asynchronously, so you won't see any files copied until after the | 152 * Note: runs asynchronously, so you won't see any files copied until after the |
| 152 * event loop has had a chance to pump (i.e. after `main()` has returned). | 153 * event loop has had a chance to pump (i.e. after `main()` has returned). |
| 153 */ | 154 */ |
| 154 void copyFiles(String from, String to) { | 155 void copyFiles(String from, String to) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 175 void compileScript(String compilerPath, String libDir, | 176 void compileScript(String compilerPath, String libDir, |
| 176 String dartPath, String jsPath) { | 177 String dartPath, String jsPath) { |
| 177 final process = new Process.start(compilerPath, [ | 178 final process = new Process.start(compilerPath, [ |
| 178 '--libdir=$libDir', '--out=$jsPath', | 179 '--libdir=$libDir', '--out=$jsPath', |
| 179 '--compile-only', '--enable-type-checks', '--warnings-as-errors', | 180 '--compile-only', '--enable-type-checks', '--warnings-as-errors', |
| 180 dartPath]); | 181 dartPath]); |
| 181 | 182 |
| 182 process.stdout.pipe(stdout, close: false); | 183 process.stdout.pipe(stdout, close: false); |
| 183 | 184 |
| 184 process.onError = (error) { | 185 process.onError = (error) { |
| 185 print('Failed to compile $dartPath. Error:'); | 186 print('Failed to compile $dartPath:'); |
| 186 print(error); | 187 print(error); |
| 187 }; | 188 }; |
| 188 } | 189 } |
| 189 | 190 |
| 190 class Dartdoc { | 191 class Dartdoc { |
| 191 /** Set to `false` to not include the source code in the generated docs. */ | 192 /** Set to `false` to not include the source code in the generated docs. */ |
| 192 bool includeSource = true; | 193 bool includeSource = true; |
| 193 | 194 |
| 194 /** | 195 /** |
| 195 * Dartdoc can generate docs in a few different ways based on how dynamic you | 196 * Dartdoc can generate docs in a few different ways based on how dynamic you |
| (...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 | 1273 |
| 1273 return new md.Element.text('code', name); | 1274 return new md.Element.text('code', name); |
| 1274 } | 1275 } |
| 1275 | 1276 |
| 1276 // TODO(rnystrom): Move into SourceSpan? | 1277 // TODO(rnystrom): Move into SourceSpan? |
| 1277 int getSpanColumn(SourceSpan span) { | 1278 int getSpanColumn(SourceSpan span) { |
| 1278 final line = span.file.getLine(span.start); | 1279 final line = span.file.getLine(span.start); |
| 1279 return span.file.getColumn(line, span.start); | 1280 return span.file.getColumn(line, span.start); |
| 1280 } | 1281 } |
| 1281 } | 1282 } |
| OLD | NEW |