From 25b2cb499acda364da1ac789fa67197c21dc9a0d Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Fri, 29 Jan 2021 23:11:24 +0000 Subject: [PATCH] [recipe_modules/depot_tools] Add dirmd_path to api This is required to parse DIR_METADATA files. Bug: 1135347 Change-Id: I620656d4dbec5e918bfc0f535397869c869446b8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2644827 Commit-Queue: Henrique Nakashima Reviewed-by: Andrii Shyshkalov --- recipes/README.recipes.md | 4 +++- recipes/recipe_modules/depot_tools/api.py | 4 ++++ .../depot_tools/examples/full.expected/basic.json | 7 +++++++ .../depot_tools/examples/full.expected/win.json | 7 +++++++ recipes/recipe_modules/depot_tools/examples/full.py | 3 +++ 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/recipes/README.recipes.md b/recipes/README.recipes.md index 63c0c731f..90343f337 100644 --- a/recipes/README.recipes.md +++ b/recipes/README.recipes.md @@ -241,6 +241,8 @@ the depot_tools repo.   **@property**
— **def [cros\_path](/recipes/recipe_modules/depot_tools/api.py#26)(self):** +  **@property**
— **def [dirmd\_path](/recipes/recipe_modules/depot_tools/api.py#54)(self):** +   **@property**
— **def [download\_from\_google\_storage\_path](/recipes/recipe_modules/depot_tools/api.py#13)(self):**   **@property**
— **def [gn\_py\_path](/recipes/recipe_modules/depot_tools/api.py#30)(self):** @@ -249,7 +251,7 @@ the depot_tools repo.   **@property**
— **def [ninja\_path](/recipes/recipe_modules/depot_tools/api.py#40)(self):** -  **@contextlib.contextmanager**
— **def [on\_path](/recipes/recipe_modules/depot_tools/api.py#54)(self):** +  **@contextlib.contextmanager**
— **def [on\_path](/recipes/recipe_modules/depot_tools/api.py#58)(self):** Use this context manager to put depot_tools on $PATH. diff --git a/recipes/recipe_modules/depot_tools/api.py b/recipes/recipe_modules/depot_tools/api.py index 017526934..f73043370 100644 --- a/recipes/recipe_modules/depot_tools/api.py +++ b/recipes/recipe_modules/depot_tools/api.py @@ -51,6 +51,10 @@ class DepotToolsApi(recipe_api.RecipeApi): def presubmit_support_py_path(self): return self.repo_resource('presubmit_support.py') + @property + def dirmd_path(self): + return self.repo_resource('dirmd') + @contextlib.contextmanager def on_path(self): """Use this context manager to put depot_tools on $PATH. diff --git a/recipes/recipe_modules/depot_tools/examples/full.expected/basic.json b/recipes/recipe_modules/depot_tools/examples/full.expected/basic.json index 0826600bf..f8e2e05d3 100644 --- a/recipes/recipe_modules/depot_tools/examples/full.expected/basic.json +++ b/recipes/recipe_modules/depot_tools/examples/full.expected/basic.json @@ -62,6 +62,13 @@ ], "name": "presubmit_support_py_path" }, + { + "cmd": [ + "ls", + "RECIPE_REPO[depot_tools]/dirmd" + ], + "name": "dirmd_path" + }, { "cmd": [ "echo", diff --git a/recipes/recipe_modules/depot_tools/examples/full.expected/win.json b/recipes/recipe_modules/depot_tools/examples/full.expected/win.json index bce098696..a5d3dadd8 100644 --- a/recipes/recipe_modules/depot_tools/examples/full.expected/win.json +++ b/recipes/recipe_modules/depot_tools/examples/full.expected/win.json @@ -62,6 +62,13 @@ ], "name": "presubmit_support_py_path" }, + { + "cmd": [ + "ls", + "RECIPE_REPO[depot_tools]\\dirmd" + ], + "name": "dirmd_path" + }, { "cmd": [ "echo", diff --git a/recipes/recipe_modules/depot_tools/examples/full.py b/recipes/recipe_modules/depot_tools/examples/full.py index 9a9e21d9b..c68969245 100644 --- a/recipes/recipe_modules/depot_tools/examples/full.py +++ b/recipes/recipe_modules/depot_tools/examples/full.py @@ -40,6 +40,9 @@ def RunSteps(api): 'presubmit_support_py_path', ['ls', api.depot_tools.presubmit_support_py_path]) + api.step( + 'dirmd_path', ['ls', api.depot_tools.dirmd_path]) + with api.depot_tools.on_path(): api.step('on_path', ['echo', '$PATH'])