OLD | NEW |
| (Empty) |
1 # Copyright 2011 Google Inc. All Rights Reserved. | |
2 | |
3 import os | |
4 import platform | |
5 import shutil | |
6 import stat | |
7 import sys | |
8 | |
9 DART_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), | |
10 os.pardir, os.pardir, os.pardir) | |
11 FROG_DIR = os.path.join(DART_DIR, "frog") | |
12 | |
13 sys.path.append(FROG_DIR) | |
14 import frog | |
15 | |
16 # Runs frog.dart on the dart vm to compile frogpad.dart to frogpad.js | |
17 def main(args): | |
18 product_dir = args[1] | |
19 frogpad_js = os.path.join(product_dir, 'frog', 'bin', 'frogpad.js') | |
20 | |
21 if platform.system() == "Windows": | |
22 with open(frogpad_js, 'w') as f: | |
23 f.write("frogpad is not supported on Windows") | |
24 return 0 | |
25 | |
26 vm = os.path.join(product_dir, 'dart') | |
27 frogpad_dart = os.path.join( | |
28 DART_DIR, 'tools', 'testing', 'frogpad', 'frogpad.dart') | |
29 | |
30 if not os.path.exists(vm): | |
31 raise Exception("cannot find dart vm '%s'" % vm) | |
32 | |
33 args = ['frog.py', | |
34 '--verbose', | |
35 '--vm=' + vm, | |
36 '--', | |
37 '--out=' + frogpad_js, | |
38 frogpad_dart] | |
39 | |
40 exit_code = frog.main(args) | |
41 if exit_code: | |
42 return exit_code | |
43 | |
44 if not os.path.exists(frogpad_js): | |
45 raise Exception("didn't generate '%s'" % frogpad_js) | |
46 | |
47 return 0 | |
48 | |
49 | |
50 if __name__ == '__main__': | |
51 sys.exit(main(sys.argv)) | |
OLD | NEW |