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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 def _append_gn_args(self, type, gn_args_path, more_gn_args): | 258 def _append_gn_args(self, type, gn_args_path, more_gn_args): |
259 """Append extra gn arguments to the generated args.gn file.""" | 259 """Append extra gn arguments to the generated args.gn file.""" |
260 if not more_gn_args: | 260 if not more_gn_args: |
261 return False | 261 return False |
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 | |
269 # Artificially increment modification time as our modifications happen too | |
270 # fast. This makes sure that gn is properly rebuilding the ninja files. | |
271 mtime = os.path.getmtime(gn_args_path) + 1 | |
Michael Achenbach
2016/09/22 09:08:28
Really needs + 1, smaller increments don't trigger
| |
272 with open(gn_args_path, 'aw'): | |
273 os.utime(gn_args_path, (mtime, mtime)) | |
274 | |
268 return True | 275 return True |
269 | 276 |
270 def main(self): | 277 def main(self): |
271 # Always operate relative to the base directory for better relative-path | 278 # Always operate relative to the base directory for better relative-path |
272 # handling. This script can be used in any v8 checkout. | 279 # handling. This script can be used in any v8 checkout. |
273 workdir = self._find_work_dir(os.getcwd()) | 280 workdir = self._find_work_dir(os.getcwd()) |
274 if workdir != os.getcwd(): | 281 if workdir != os.getcwd(): |
275 self.verbose_print_1('cd ' + workdir) | 282 self.verbose_print_1('cd ' + workdir) |
276 os.chdir(workdir) | 283 os.chdir(workdir) |
277 | 284 |
(...skipping 15 matching lines...) Expand all Loading... | |
293 | 300 |
294 if __name__ == "__main__": | 301 if __name__ == "__main__": |
295 gen = GenerateGnArgs(sys.argv[1:]) | 302 gen = GenerateGnArgs(sys.argv[1:]) |
296 try: | 303 try: |
297 sys.exit(gen.main()) | 304 sys.exit(gen.main()) |
298 except Exception: | 305 except Exception: |
299 if gen._options.verbosity < 2: | 306 if gen._options.verbosity < 2: |
300 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 ' |
301 'failed commands.\n') | 308 'failed commands.\n') |
302 raise | 309 raise |
OLD | NEW |