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

Side by Side Diff: chrome/browser/resources/md_history/PRESUBMIT.py

Issue 2670723002: [MD History] Vulcanize as part of GN build. (Closed)
Patch Set: address nits Created 3 years, 10 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
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5
6 def CheckChangeOnUpload(input_api, output_api): 5 def CheckChangeOnUpload(input_api, output_api):
7 """Warn when changing md_history without vulcanizing.""" 6 return input_api.canned_checks.CheckPatchFormatted(
8 7 input_api, output_api, check_js=True)
9 def _is_history_source_file(file):
10 path = file.LocalPath()
11 return (not path.endswith('externs.js') and
12 not path.endswith('crisper.js') and
13 not path.endswith('vulcanized.html') and
14 (path.endswith('.js') or path.endswith('.html')))
15
16 os_path = input_api.os_path
17 earliest_vulcanize_change = min(os_path.getmtime(x) for x in
18 ['app.vulcanized.html',
19 'app.crisper.js',
20 'lazy_load.vulcanized.html',
21 'lazy_load.crisper.js'])
22
23 source_files = input_api.AffectedFiles(file_filter=_is_history_source_file)
24 latest_history_change = 0
25 if source_files:
26 latest_history_change = max(
27 os_path.getmtime(os_path.basename(f.LocalPath())) for f in source_files)
28
29 if latest_history_change > earliest_vulcanize_change:
30 return [output_api.PresubmitPromptWarning(
31 'Vulcanize must be run when changing files in md_history. See '
32 'docs/vulcanize.md.')]
33 return []
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698