Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(502)

Side by Side Diff: runtime/tools/create_snapshot_bin.py

Issue 1304953004: Make build incremental (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/bin/bin.gypi ('k') | tools/observatory_tool.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 """Script to create snapshot bin file.""" 7 """Script to create snapshot bin file."""
8 8
9 import getopt 9 import getopt
10 import optparse 10 import optparse
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 "E.g.: --url_mapping=fileUri,/path/to/file.dart")) 45 "E.g.: --url_mapping=fileUri,/path/to/file.dart"))
46 result.add_option("-v", "--verbose", 46 result.add_option("-v", "--verbose",
47 help='Verbose output.', 47 help='Verbose output.',
48 default=False, action="store_true") 48 default=False, action="store_true")
49 result.add_option("--target_os", 49 result.add_option("--target_os",
50 action="store", type="string", 50 action="store", type="string",
51 help="Which os to run the executable on. Current choice is android") 51 help="Which os to run the executable on. Current choice is android")
52 result.add_option("--abi", 52 result.add_option("--abi",
53 action="store", type="string", 53 action="store", type="string",
54 help="Desired ABI for android target OS. armeabi-v7a or x86") 54 help="Desired ABI for android target OS. armeabi-v7a or x86")
55 result.add_option("--timestamp_file",
56 action="store", type="string",
57 help="Path to timestamp file that will be written",
58 default="")
55 return result 59 return result
56 60
57 61
58 def ProcessOptions(options): 62 def ProcessOptions(options):
59 if not options.executable: 63 if not options.executable:
60 sys.stderr.write('--executable not specified\n') 64 sys.stderr.write('--executable not specified\n')
61 return False 65 return False
62 if not options.vm_output_bin: 66 if not options.vm_output_bin:
63 sys.stderr.write('--vm_output_bin not specified\n') 67 sys.stderr.write('--vm_output_bin not specified\n')
64 return False 68 return False
65 if not options.output_bin: 69 if not options.output_bin:
66 sys.stderr.write('--output_bin not specified\n') 70 sys.stderr.write('--output_bin not specified\n')
67 return False 71 return False
68 if options.abi and not options.target_os == 'android': 72 if options.abi and not options.target_os == 'android':
69 sys.stderr.write('--abi requires --target_os android\n') 73 sys.stderr.write('--abi requires --target_os android\n')
70 return False 74 return False
71 return True 75 return True
72 76
73 77
78 def CreateTimestampFile(options):
79 if options.timestamp_file != '':
80 dir_name = os.path.dirname(options.timestamp_file)
81 if not os.path.exists(dir_name):
82 os.mkdir(dir_name)
83 open(options.timestamp_file, 'w').close()
84
85
74 def Main(): 86 def Main():
75 # Parse options. 87 # Parse options.
76 parser = BuildOptions() 88 parser = BuildOptions()
77 (options, args) = parser.parse_args() 89 (options, args) = parser.parse_args()
78 if not ProcessOptions(options): 90 if not ProcessOptions(options):
79 parser.print_help() 91 parser.print_help()
80 return 1 92 return 1
81 93
82 # If there are additional arguments, report error and exit. 94 # If there are additional arguments, report error and exit.
83 if args: 95 if args:
(...skipping 22 matching lines...) Expand all
106 script_args.append(options.script) 118 script_args.append(options.script)
107 119
108 # Construct command line to execute the snapshot generator binary and invoke. 120 # Construct command line to execute the snapshot generator binary and invoke.
109 command = [ options.executable ] + script_args 121 command = [ options.executable ] + script_args
110 try: 122 try:
111 utils.RunCommand(command, outStream=sys.stderr, errStream=sys.stderr, 123 utils.RunCommand(command, outStream=sys.stderr, errStream=sys.stderr,
112 verbose=options.verbose, printErrorInfo=True) 124 verbose=options.verbose, printErrorInfo=True)
113 except Exception as e: 125 except Exception as e:
114 return -1 126 return -1
115 127
128 # Success, update timestamp file.
129 CreateTimestampFile(options)
130
116 return 0 131 return 0
117 132
118 133
119 if __name__ == '__main__': 134 if __name__ == '__main__':
120 sys.exit(Main()) 135 sys.exit(Main())
OLDNEW
« no previous file with comments | « runtime/bin/bin.gypi ('k') | tools/observatory_tool.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698