OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2016 the V8 project authors. All rights reserved. | 2 # Copyright 2016 the V8 project authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Script to generate V8's gn arguments based on common developer defaults | 6 """Script to generate V8's gn arguments based on common developer defaults |
7 or builder configurations. | 7 or builder configurations. |
8 | 8 |
9 Goma is used by default if detected. The compiler proxy is assumed to run. | 9 Goma is used by default if detected. The compiler proxy is assumed to run. |
10 | 10 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 self.verbose_print_1('Appending """\n%s\n""" to %s.' % ( | 262 self.verbose_print_1('Appending """\n%s\n""" to %s.' % ( |
263 more_gn_args, os.path.abspath(gn_args_path))) | 263 more_gn_args, os.path.abspath(gn_args_path))) |
264 with open(gn_args_path, 'a') as f: | 264 with open(gn_args_path, 'a') as f: |
265 f.write('\n# Additional %s args:\n' % type) | 265 f.write('\n# Additional %s args:\n' % type) |
266 f.write(more_gn_args) | 266 f.write(more_gn_args) |
267 f.write('\n') | 267 f.write('\n') |
268 | 268 |
269 # Artificially increment modification time as our modifications happen too | 269 # Artificially increment modification time as our modifications happen too |
270 # fast. This makes sure that gn is properly rebuilding the ninja files. | 270 # fast. This makes sure that gn is properly rebuilding the ninja files. |
271 mtime = os.path.getmtime(gn_args_path) + 1 | 271 mtime = os.path.getmtime(gn_args_path) + 1 |
272 with open(gn_args_path, 'aw'): | 272 with open(gn_args_path, 'a'): |
273 os.utime(gn_args_path, (mtime, mtime)) | 273 os.utime(gn_args_path, (mtime, mtime)) |
274 | 274 |
275 return True | 275 return True |
276 | 276 |
277 def main(self): | 277 def main(self): |
278 # Always operate relative to the base directory for better relative-path | 278 # Always operate relative to the base directory for better relative-path |
279 # handling. This script can be used in any v8 checkout. | 279 # handling. This script can be used in any v8 checkout. |
280 workdir = self._find_work_dir(os.getcwd()) | 280 workdir = self._find_work_dir(os.getcwd()) |
281 if workdir != os.getcwd(): | 281 if workdir != os.getcwd(): |
282 self.verbose_print_1('cd ' + workdir) | 282 self.verbose_print_1('cd ' + workdir) |
(...skipping 17 matching lines...) Expand all Loading... |
300 | 300 |
301 if __name__ == "__main__": | 301 if __name__ == "__main__": |
302 gen = GenerateGnArgs(sys.argv[1:]) | 302 gen = GenerateGnArgs(sys.argv[1:]) |
303 try: | 303 try: |
304 sys.exit(gen.main()) | 304 sys.exit(gen.main()) |
305 except Exception: | 305 except Exception: |
306 if gen._options.verbosity < 2: | 306 if gen._options.verbosity < 2: |
307 print ('\nHint: You can raise verbosity (-vv) to see the output of ' | 307 print ('\nHint: You can raise verbosity (-vv) to see the output of ' |
308 'failed commands.\n') | 308 'failed commands.\n') |
309 raise | 309 raise |
OLD | NEW |