From 4360277e81ca3cb8c6135fcde126fb8807f1c052 Mon Sep 17 00:00:00 2001 From: Hugues Morisset Date: Fri, 27 Oct 2023 10:25:52 +0200 Subject: [PATCH] Allow to set third_party_path in go_repo --- build_defs/go.build_defs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build_defs/go.build_defs b/build_defs/go.build_defs index 77053ff9..fd748a81 100644 --- a/build_defs/go.build_defs +++ b/build_defs/go.build_defs @@ -1149,7 +1149,7 @@ def _module_rule_name(module): def go_repo(module: str, version:str='', download:str=None, name:str=None, install:list=[], requirements:list=[], - licences:list=None, patch:list=None, visibility:list=["PUBLIC"], deps:list=[]): + licences:list=None, patch:list=None, visibility:list=["PUBLIC"], deps:list=[], third_party_path:str="third_party/go"): """Adds a third party go module to the build graph as a subrepo. This is designed to be closer to how the `go.mod` file works, requiring only the module name and version to be specified. Unlike go_module, each package is compiled individually, and dependencies between packages are inferred by convention. @@ -1183,6 +1183,7 @@ def go_repo(module: str, version:str='', download:str=None, name:str=None, insta visibility(list): The visibility for the returned "install" rule. Doesn't affect the subrepo at all. deps(list): Any deps on other rule kinds that provide packages, for example go_module(). This can be used to migrate to go_repo incrementally, one module at a time. + third_party_path(str): Optional path of third_party directory. """ subrepo_name = _module_rule_name(module) @@ -1216,7 +1217,7 @@ def go_repo(module: str, version:str='', download:str=None, name:str=None, insta name = name, tag = "repo" if install else None, srcs = srcs, - cmd = f"rm -rf $SRCS_DOWNLOAD/.plzconfig && find $SRCS_DOWNLOAD -name BUILD -delete && $TOOL generate {modFileArg} --module {module} --version '{version}' --src_root=$SRCS_DOWNLOAD {install_args} {requirements} && mv $SRCS_DOWNLOAD $OUT", + cmd = f"rm -rf $SRCS_DOWNLOAD/.plzconfig && find $SRCS_DOWNLOAD -name BUILD -delete && $TOOL generate {modFileArg} --module {module} --version '{version}' --src_root=$SRCS_DOWNLOAD --third_part_folder='{third_party_path}' {install_args} {requirements} && mv $SRCS_DOWNLOAD $OUT", outs = [subrepo_name], tools = [CONFIG.GO.PLEASE_GO_TOOL], env= {