diff --git a/recipe_modules/presubmit/__init__.py b/recipe_modules/presubmit/__init__.py new file mode 100644 index 000000000..9af297e58 --- /dev/null +++ b/recipe_modules/presubmit/__init__.py @@ -0,0 +1,3 @@ +DEPS = [ + 'recipe_engine/python', +] diff --git a/recipe_modules/presubmit/api.py b/recipe_modules/presubmit/api.py new file mode 100644 index 000000000..3fbf31690 --- /dev/null +++ b/recipe_modules/presubmit/api.py @@ -0,0 +1,13 @@ +# Copyright 2016 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +from recipe_engine import recipe_api + +class PresubmitApi(recipe_api.RecipeApi): + def __call__(self, *args, **kwargs): + """Return a presubmit step.""" + name = kwargs.pop('name', 'presubmit') + return self.m.python( + name, self.package_resource('presubmit_support.py'), list(args), + **kwargs) diff --git a/recipe_modules/presubmit/example.expected/basic.json b/recipe_modules/presubmit/example.expected/basic.json new file mode 100644 index 000000000..d19e769a8 --- /dev/null +++ b/recipe_modules/presubmit/example.expected/basic.json @@ -0,0 +1,16 @@ +[ + { + "cmd": [ + "python", + "-u", + "RECIPE_PACKAGE[depot_tools]/presubmit_support.py" + ], + "cwd": "[SLAVE_BUILD]", + "name": "presubmit" + }, + { + "name": "$result", + "recipe_result": null, + "status_code": 0 + } +] \ No newline at end of file diff --git a/recipe_modules/presubmit/example.py b/recipe_modules/presubmit/example.py new file mode 100755 index 000000000..1253519a3 --- /dev/null +++ b/recipe_modules/presubmit/example.py @@ -0,0 +1,15 @@ +# Copyright 2016 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +DEPS = [ + 'presubmit', +] + + +def RunSteps(api): + api.presubmit() + + +def GenTests(api): + yield api.test('basic')