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 * 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; | |
| 36 | 37 |
| 37 // Parse the command-line arguments. | 38 // Parse the command-line arguments. |
| 38 for (int i = 0; i < args.length; i++) { | 39 for (int i = 0; i < args.length; i++) { |
| 39 final arg = args[i]; | 40 final arg = args[i]; |
| 40 | 41 |
| 41 switch (arg) { | 42 switch (arg) { |
| 42 case '--mode=static': | 43 case '--mode=static': |
| 43 mode = doc.MODE_STATIC; | 44 mode = doc.MODE_STATIC; |
| 44 break; | 45 break; |
| 45 | 46 |
| 46 case '--mode=live-nav': | 47 case '--mode=live-nav': |
| 47 mode = doc.MODE_LIVE_NAV; | 48 mode = doc.MODE_LIVE_NAV; |
| 48 break; | 49 break; |
| 49 | 50 |
| 50 default: | 51 default: |
| 51 if (arg.startsWith('--out=')) { | 52 if (arg.startsWith('--out=')) { |
| 52 outputDir = arg.substring('--out='.length); | 53 outputDir = arg.substring('--out='.length); |
| 54 } else if (arg.startsWith('--compiler=')) { | |
| 55 compilerPath = arg.substring('--compiler='.length); | |
| 53 } else { | 56 } else { |
| 54 print('Unknown option: $arg'); | 57 print('Unknown option: $arg'); |
| 55 return; | 58 return; |
| 56 } | 59 } |
| 57 break; | 60 break; |
| 58 } | 61 } |
| 59 } | 62 } |
| 60 | 63 |
| 61 final frogPath = joinPaths(doc.scriptDir, '../../frog/'); | 64 final frogPath = joinPaths(doc.scriptDir, '../../frog/'); |
| 62 final compilerPath = joinPaths(frogPath, 'minfrog'); | |
| 63 final libDir = joinPaths(frogPath, 'lib'); | 65 final libDir = joinPaths(frogPath, 'lib'); |
| 64 | 66 |
| 67 if (compilerPath === null) { | |
|
Bob Nystrom
2012/04/23 16:03:20
==
ahe
2012/04/24 10:31:02
Testing null with === is safer. Based on my person
Bob Nystrom
2012/04/24 16:38:08
Well, we're changing the semantics of "==" specifi
| |
| 68 compilerPath = joinPaths(frogPath, 'frog.py'); | |
| 69 } | |
| 70 | |
| 65 doc.cleanOutputDirectory(outputDir); | 71 doc.cleanOutputDirectory(outputDir); |
| 66 | 72 |
| 67 // Compile the client-side code to JS. | 73 // Compile the client-side code to JS. |
| 68 // TODO(bob): Right path. | 74 // TODO(bob): Right path. |
| 69 | 75 |
| 70 final clientScript = (mode == doc.MODE_STATIC) ? | 76 final clientScript = (mode == doc.MODE_STATIC) ? |
| 71 'static' : 'live-nav'; | 77 'static' : 'live-nav'; |
| 72 doc.compileScript(compilerPath, libDir, | 78 doc.compileScript(compilerPath, libDir, |
| 73 '${doc.scriptDir}/../../lib/dartdoc/client-$clientScript.dart', | 79 '${doc.scriptDir}/../../lib/dartdoc/client-$clientScript.dart', |
| 74 '${outputDir}/client-$clientScript.js'); | 80 '${outputDir}/client-$clientScript.js'); |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 489 return | 495 return |
| 490 ''' | 496 ''' |
| 491 <p class="correspond">This corresponds to $domTypesText in the | 497 <p class="correspond">This corresponds to $domTypesText in the |
| 492 ${a("dom.html", "dart:dom")} library.</p> | 498 ${a("dom.html", "dart:dom")} library.</p> |
| 493 '''; | 499 '''; |
| 494 } | 500 } |
| 495 | 501 |
| 496 return ''; | 502 return ''; |
| 497 } | 503 } |
| 498 } | 504 } |
| OLD | NEW |