From a870c9698af1d2fd4dbf11cbdc53f9313d1ee958 Mon Sep 17 00:00:00 2001 From: Yoshisato Yanagisawa Date: Thu, 1 Nov 2018 01:12:05 +0000 Subject: [PATCH] recipe_modules/depot_tools: export autoninja_path Make autoninja path also available via depot_tools recipe module, and make autoninja used where it is needed. Bug: b/77176746 Change-Id: I8553cb3fb32f98e2e3ff420c255461b7e7da7df6 Reviewed-on: https://chromium-review.googlesource.com/c/1293112 Reviewed-by: Fumitoshi Ukai Reviewed-by: Shinya Kawanaka Reviewed-by: Andrii Shyshkalov Commit-Queue: Yoshisato Yanagisawa --- recipes/README.recipes.md | 6 ++++-- recipes/recipe_modules/depot_tools/api.py | 5 +++++ .../depot_tools/examples/full.expected/basic.json | 7 +++++++ .../depot_tools/examples/full.expected/basic_luci.json | 7 +++++++ .../depot_tools/examples/full.expected/win.json | 7 +++++++ recipes/recipe_modules/depot_tools/examples/full.py | 3 +++ 6 files changed, 33 insertions(+), 2 deletions(-) diff --git a/recipes/README.recipes.md b/recipes/README.recipes.md index caa01efa8f..c8212b18be 100644 --- a/recipes/README.recipes.md +++ b/recipes/README.recipes.md @@ -207,6 +207,8 @@ the depot_tools repo. #### **class [DepotToolsApi](/recipes/recipe_modules/depot_tools/api.py#12)([RecipeApi][recipe_engine/wkt/RecipeApi]):** +  **@property**
— **def [autoninja\_path](/recipes/recipe_modules/depot_tools/api.py#45)(self):** +   **@property**
— **def [cros\_path](/recipes/recipe_modules/depot_tools/api.py#26)(self):**   **@property**
— **def [download\_from\_google\_storage\_path](/recipes/recipe_modules/depot_tools/api.py#13)(self):** @@ -217,7 +219,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#49)(self):** +  **@contextlib.contextmanager**
— **def [on\_path](/recipes/recipe_modules/depot_tools/api.py#54)(self):** Use this context manager to put depot_tools on $PATH. @@ -226,7 +228,7 @@ Example: with api.depot_tools.on_path(): # run some steps -  **@property**
— **def [presubmit\_support\_py\_path](/recipes/recipe_modules/depot_tools/api.py#45)(self):** +  **@property**
— **def [presubmit\_support\_py\_path](/recipes/recipe_modules/depot_tools/api.py#50)(self):**   **@property**
— **def [root](/recipes/recipe_modules/depot_tools/api.py#21)(self):** diff --git a/recipes/recipe_modules/depot_tools/api.py b/recipes/recipe_modules/depot_tools/api.py index e24e614823..c155711bee 100644 --- a/recipes/recipe_modules/depot_tools/api.py +++ b/recipes/recipe_modules/depot_tools/api.py @@ -42,6 +42,11 @@ class DepotToolsApi(recipe_api.RecipeApi): ninja_exe = 'ninja.exe' if self.m.platform.is_win else 'ninja' return self.package_repo_resource(ninja_exe) + @property + def autoninja_path(self): + autoninja = 'autoninja.bat' if self.m.platform.is_win else 'autoninja' + return self.package_repo_resource(autoninja) + @property def presubmit_support_py_path(self): return self.package_repo_resource('presubmit_support.py') 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 d0ff66e50b..b78d462923 100644 --- a/recipes/recipe_modules/depot_tools/examples/full.expected/basic.json +++ b/recipes/recipe_modules/depot_tools/examples/full.expected/basic.json @@ -48,6 +48,13 @@ ], "name": "ninja_path" }, + { + "cmd": [ + "ls", + "RECIPE_PACKAGE_REPO[depot_tools]/autoninja" + ], + "name": "autoninja_path" + }, { "cmd": [ "ls", diff --git a/recipes/recipe_modules/depot_tools/examples/full.expected/basic_luci.json b/recipes/recipe_modules/depot_tools/examples/full.expected/basic_luci.json index 235a4ba0c9..1524e68cbf 100644 --- a/recipes/recipe_modules/depot_tools/examples/full.expected/basic_luci.json +++ b/recipes/recipe_modules/depot_tools/examples/full.expected/basic_luci.json @@ -48,6 +48,13 @@ ], "name": "ninja_path" }, + { + "cmd": [ + "ls", + "RECIPE_PACKAGE_REPO[depot_tools]/autoninja" + ], + "name": "autoninja_path" + }, { "cmd": [ "ls", 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 486f161da0..50f4401933 100644 --- a/recipes/recipe_modules/depot_tools/examples/full.expected/win.json +++ b/recipes/recipe_modules/depot_tools/examples/full.expected/win.json @@ -48,6 +48,13 @@ ], "name": "ninja_path" }, + { + "cmd": [ + "ls", + "RECIPE_PACKAGE_REPO[depot_tools]\\autoninja.bat" + ], + "name": "autoninja_path" + }, { "cmd": [ "ls", diff --git a/recipes/recipe_modules/depot_tools/examples/full.py b/recipes/recipe_modules/depot_tools/examples/full.py index 71e5c12492..1ac214ca3e 100644 --- a/recipes/recipe_modules/depot_tools/examples/full.py +++ b/recipes/recipe_modules/depot_tools/examples/full.py @@ -33,6 +33,9 @@ def RunSteps(api): api.step( 'ninja_path', ['ls', api.depot_tools.ninja_path]) + api.step( + 'autoninja_path', ['ls', api.depot_tools.autoninja_path]) + api.step( 'presubmit_support_py_path', ['ls', api.depot_tools.presubmit_support_py_path])