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

Side by Side Diff: tools/dev/v8gen.py

Issue 2365573002: [build] Fix race in v8gen (Closed)
Patch Set: [build] Fix race in v8gen Created 4 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 | « no previous file | no next file » | 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 # 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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698