Add presubmit hook for new GYP files.
BUG=chromium:960215
TEST=manually tested with whitelisted and non-whitelisted project.
Change-Id: Ic22aff662eee06c1f8f47c7718ec9490f43adf95
Reviewed-on: https://chromium-review.googlesource.com/1598608
Commit-Ready: Keigo Oka <oka@chromium.org>
Tested-by: Keigo Oka <oka@chromium.org>
Reviewed-by: Shuhei Takahashi <nya@chromium.org>
Reviewed-by: Keigo Oka <oka@chromium.org>
diff --git a/pre-upload.py b/pre-upload.py
index 1ccd7d4..0625d89 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -11,7 +11,8 @@
from __future__ import print_function
-import argparse
+# TODO(crbug.com/960636): Remove pylint disable after linter is fixed.
+import argparse # pylint: disable=import-error
import collections
import ConfigParser
import fnmatch
@@ -1216,6 +1217,41 @@
return HookFailure(lines)
+def _check_no_new_gyp(_project, commit):
+ """Verifies no project starts to use GYP."""
+ whitelist = [
+ 'aosp/platform/system/update_engine',
+ 'chromeos/ap',
+ 'chromeos/ap-daemons',
+ 'chromeos/platform/actions',
+ 'chromeos/platform/arc-oemcrypto',
+ 'chromeos/platform/drivefs',
+ 'chromeos/platform/drivefs-google3',
+ 'chromeos/platform/experimental-touch-fw',
+ 'chromeos/platform/gdisp',
+ 'chromeos/platform/nest-nn',
+ 'chromeos/platform/whisper',
+ 'chromeos/thermald',
+ 'chromeos/vendor/fibocom-firmware',
+ 'chromiumos/platform/cfm-device-monitor',
+ 'chromiumos/platform/google-breakpad',
+ 'chromiumos/platform2',
+ 'chromiumos/third_party/atrusctl',
+ 'chromiumos/third_party/virtual-usb-printer',
+ 'weave/libweave',
+ ]
+ if _project.name in whitelist:
+ return None
+
+ gypfiles = _filter_files(
+ _get_affected_files(commit, include_symlinks=True, relative=True),
+ [r'\.gyp$'])
+
+ if gypfiles:
+ return HookFailure('GYP is deprecated and not allowed in a new project:',
+ gypfiles)
+
+
# Project-specific hooks
@@ -1587,6 +1623,7 @@
_check_gofmt,
_check_layout_conf,
_check_no_long_lines,
+ _check_no_new_gyp,
_check_no_stray_whitespace,
_check_no_tabs,
_check_portage_make_use_var,