diff options
author | mtklein <mtklein@chromium.org> | 2016-08-03 14:18:22 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-03 14:18:23 -0700 |
commit | 4db3b7969f62f5ddbf32bd812b9510af018ece89 (patch) | |
tree | 4b5b2a2a350eb835c2a761982418e5fc1d3e3f51 | |
parent | 18e0cbc52a7a145cd6d915759ef9d611808960aa (diff) |
Require gn format in presubmit
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2203283003
Review-Url: https://codereview.chromium.org/2203283003
-rw-r--r-- | BUILD.gn | 12 | ||||
-rw-r--r-- | PRESUBMIT.py | 18 |
2 files changed, 24 insertions, 6 deletions
@@ -364,8 +364,8 @@ test_lib("gpu_tool_utils") { if (is_linux) { sources += [ - "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp", - "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp", + "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp", + "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp", ] libs += [ "GL", @@ -374,8 +374,8 @@ test_lib("gpu_tool_utils") { ] } else if (is_mac) { sources += [ - "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp", - "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp", + "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp", + "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp", ] libs += [ "OpenGL.framework" ] } @@ -458,8 +458,8 @@ test_lib("tests") { rebase_path("tests/FontMgrAndroidParserTest.cpp"), # Android only rebase_path("tests/PathOpsSkpClipTest.cpp"), # alternate main rebase_path("tests/RTConfRegistryTest.cpp"), # TODO: delete - rebase_path("tests/SkSLErrorTest.cpp"), # TODO: make work - rebase_path("tests/SkSLGLSLTest.cpp"), # TODO: make work + rebase_path("tests/SkSLErrorTest.cpp"), # TODO: make work + rebase_path("tests/SkSLGLSLTest.cpp"), # TODO: make work rebase_path("tests/SkpSkGrTest.cpp"), # doesn't compile rebase_path("tests/skia_test.cpp"), # alternate main ] diff --git a/PRESUBMIT.py b/PRESUBMIT.py index e0e01fb30f..95fea4f8db 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -185,6 +185,23 @@ def _RecipeSimulationTest(input_api, output_api): '`%s` failed:\n%s' % (' '.join(cmd), e.output))) return results +def _CheckGNFormatted(input_api, output_api): + """Make sure any .gn files we're changing have been formatted.""" + results = [] + for f in input_api.AffectedFiles(): + if not f.LocalPath().endswith('.gn'): + continue + + cmd = ['gn', 'format', '--dry-run', f.LocalPath()] + try: + subprocess.check_output(cmd) + except subprocess.CalledProcessError: + fix = cmd[:] + fix[2] = '--in-place' + results.append(output_api.PresubmitError( + '`%s` failed, try\n\t%s' % (' '.join(cmd), ' '.join(fix)))) + return results + def _CommonChecks(input_api, output_api): """Presubmit checks common to upload and commit.""" @@ -222,6 +239,7 @@ def CheckChangeOnUpload(input_api, output_api): # Run on upload, not commit, since the presubmit bot apparently doesn't have # coverage installed. results.extend(_RecipeSimulationTest(input_api, output_api)) + results.extend(_CheckGNFormatted(input_api, output_api)) return results |