| 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 * This generates the reference documentation for the core libraries that come | 6 * This generates the reference documentation for the core libraries that come |
| 7 * with dart. It is built on top of dartdoc, which is a general-purpose library | 7 * with dart. It is built on top of dartdoc, which is a general-purpose library |
| 8 * for generating docs from any Dart code. This library extends that to include | 8 * for generating docs from any Dart code. This library extends that to include |
| 9 * additional information and styling specific to our standard library. | 9 * additional information and styling specific to our standard library. |
| 10 * | 10 * |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 HtmlDiff _diff; | 27 HtmlDiff _diff; |
| 28 | 28 |
| 29 final GET_PREFIX = 'get:'; | 29 final GET_PREFIX = 'get:'; |
| 30 | 30 |
| 31 void main() { | 31 void main() { |
| 32 final args = new Options().arguments; | 32 final args = new Options().arguments; |
| 33 | 33 |
| 34 int mode = doc.MODE_STATIC; | 34 int mode = doc.MODE_STATIC; |
| 35 String outputDir = 'docs'; | 35 String outputDir = 'docs'; |
| 36 String compilerPath; | |
| 37 | 36 |
| 38 // Parse the command-line arguments. | 37 // Parse the command-line arguments. |
| 39 for (int i = 0; i < args.length; i++) { | 38 for (int i = 0; i < args.length; i++) { |
| 40 final arg = args[i]; | 39 final arg = args[i]; |
| 41 | 40 |
| 42 switch (arg) { | 41 switch (arg) { |
| 43 case '--mode=static': | 42 case '--mode=static': |
| 44 mode = doc.MODE_STATIC; | 43 mode = doc.MODE_STATIC; |
| 45 break; | 44 break; |
| 46 | 45 |
| 47 case '--mode=live-nav': | 46 case '--mode=live-nav': |
| 48 mode = doc.MODE_LIVE_NAV; | 47 mode = doc.MODE_LIVE_NAV; |
| 49 break; | 48 break; |
| 50 | 49 |
| 51 default: | 50 default: |
| 52 if (arg.startsWith('--out=')) { | 51 if (arg.startsWith('--out=')) { |
| 53 outputDir = arg.substring('--out='.length); | 52 outputDir = arg.substring('--out='.length); |
| 54 } else if (arg.startsWith('--compiler=')) { | |
| 55 compilerPath = arg.substring('--compiler='.length); | |
| 56 } else { | 53 } else { |
| 57 print('Unknown option: $arg'); | 54 print('Unknown option: $arg'); |
| 58 return; | 55 return; |
| 59 } | 56 } |
| 60 break; | 57 break; |
| 61 } | 58 } |
| 62 } | 59 } |
| 63 | 60 |
| 64 final frogPath = joinPaths(doc.scriptDir, '../../frog/'); | 61 final frogPath = joinPaths(doc.scriptDir, '../../frog/'); |
| 62 final compilerPath = joinPaths(frogPath, 'minfrog'); |
| 65 final libDir = joinPaths(frogPath, 'lib'); | 63 final libDir = joinPaths(frogPath, 'lib'); |
| 66 | 64 |
| 67 if (compilerPath === null) { | |
| 68 compilerPath = joinPaths(frogPath, 'frog.py'); | |
| 69 } | |
| 70 | |
| 71 doc.cleanOutputDirectory(outputDir); | 65 doc.cleanOutputDirectory(outputDir); |
| 72 | 66 |
| 73 // Compile the client-side code to JS. | 67 // Compile the client-side code to JS. |
| 74 // TODO(bob): Right path. | 68 // TODO(bob): Right path. |
| 75 | 69 |
| 76 final clientScript = (mode == doc.MODE_STATIC) ? | 70 final clientScript = (mode == doc.MODE_STATIC) ? |
| 77 'static' : 'live-nav'; | 71 'static' : 'live-nav'; |
| 78 doc.compileScript(compilerPath, libDir, | 72 doc.compileScript(compilerPath, libDir, |
| 79 '${doc.scriptDir}/../../lib/dartdoc/client-$clientScript.dart', | 73 '${doc.scriptDir}/../../lib/dartdoc/client-$clientScript.dart', |
| 80 '${outputDir}/client-$clientScript.js'); | 74 '${outputDir}/client-$clientScript.js'); |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 return | 489 return |
| 496 ''' | 490 ''' |
| 497 <p class="correspond">This corresponds to $domTypesText in the | 491 <p class="correspond">This corresponds to $domTypesText in the |
| 498 ${a("dom.html", "dart:dom")} library.</p> | 492 ${a("dom.html", "dart:dom")} library.</p> |
| 499 '''; | 493 '''; |
| 500 } | 494 } |
| 501 | 495 |
| 502 return ''; | 496 return ''; |
| 503 } | 497 } |
| 504 } | 498 } |
| OLD | NEW |