| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 | 6 |
| 7 """ | 7 """ |
| 8 Legpad is used to compile .dart files to javascript, using the dart2js compiler. | 8 Legpad is used to compile .dart files to javascript, using the dart2js compiler. |
| 9 | 9 |
| 10 This is accomplished by creating an html file (usually called | 10 This is accomplished by creating an html file (usually called |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 # match.group(1) = "import", "source" or "native" | 116 # match.group(1) = "import", "source" or "native" |
| 117 # match.group(2) = url of file being imported | 117 # match.group(2) = url of file being imported |
| 118 DIRECTIVE_RE = re.compile(r"^#(import|source|native)\([\"']([^\"']*)[\"']") | 118 DIRECTIVE_RE = re.compile(r"^#(import|source|native)\([\"']([^\"']*)[\"']") |
| 119 | 119 |
| 120 # id of script tag that holds name of the top dart file to be compiled, | 120 # id of script tag that holds name of the top dart file to be compiled, |
| 121 # (This file name passed will be passed to the leg compiler by legpad.dart.) | 121 # (This file name passed will be passed to the leg compiler by legpad.dart.) |
| 122 MAIN_ID = "main_id" | 122 MAIN_ID = "main_id" |
| 123 | 123 |
| 124 # TODO(mattsh): read this from some config file once ahe/zundel create it | 124 # TODO(mattsh): read this from some config file once ahe/zundel create it |
| 125 DART_LIBRARIES = { | 125 DART_LIBRARIES = { |
| 126 "core" : "lib/compiler/implementation/lib/core.dart", | 126 "core": "lib/compiler/implementation/lib/core.dart", |
| 127 "coreimpl" : "lib/compiler/implementation/lib/coreimpl.dart", | 127 "coreimpl": "lib/compiler/implementation/lib/coreimpl.dart", |
| 128 "dom" : "lib/dom/frog/dom_frog.dart", | 128 "_js_helper": "lib/compiler/implementation/lib/js_helper.dart", |
| 129 "html" : "lib/html/frog/html_frog.dart", | 129 "_interceptors": "lib/compiler/implementation/lib/interceptors.dart", |
| 130 "io" : "lib/compiler/implementation/lib/io.dart", | 130 "dom": "lib/dom/frog/dom_frog.dart", |
| 131 "isolate" : "lib/isolate/isolate_leg.dart", | 131 "html": "lib/html/frog/html_frog.dart", |
| 132 "json" : "lib/json/json.dart", | 132 "io": "lib/compiler/implementation/lib/io.dart", |
| 133 "uri" : "lib/uri/uri.dart", | 133 "isolate": "lib/isolate/isolate_leg.dart", |
| 134 "utf" : "lib/utf/utf.dart", | 134 "json": "lib/json/json.dart", |
| 135 "uri": "lib/uri/uri.dart", |
| 136 "utf": "lib/utf/utf.dart", |
| 135 } | 137 } |
| 136 | 138 |
| 137 class Pad(object): | 139 class Pad(object): |
| 138 """ | 140 """ |
| 139 Accumulates all source files that are needed to compile a dart program, | 141 Accumulates all source files that are needed to compile a dart program, |
| 140 and places them in <script> tags on an html page. | 142 and places them in <script> tags on an html page. |
| 141 """ | 143 """ |
| 142 | 144 |
| 143 def __init__(self, argv): | 145 def __init__(self, argv): |
| 144 parser = optparse.OptionParser(usage= | 146 parser = optparse.OptionParser(usage= |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 raise CommandFailedException(msg) | 359 raise CommandFailedException(msg) |
| 358 logging.debug("SUCCEEDED (%d bytes)" % len(stdout)) | 360 logging.debug("SUCCEEDED (%d bytes)" % len(stdout)) |
| 359 return stdout | 361 return stdout |
| 360 | 362 |
| 361 | 363 |
| 362 def main(argv): | 364 def main(argv): |
| 363 Pad(argv) | 365 Pad(argv) |
| 364 | 366 |
| 365 if __name__ == "__main__": | 367 if __name__ == "__main__": |
| 366 sys.exit(main(sys.argv)) | 368 sys.exit(main(sys.argv)) |
| OLD | NEW |