Skip to content

Commit

Permalink
Allow to set third_party_path in go_repo
Browse files Browse the repository at this point in the history
  • Loading branch information
izissise committed Oct 27, 2023
1 parent 0e86470 commit 4360277
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions build_defs/go.build_defs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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= {
Expand Down

0 comments on commit 4360277

Please sign in to comment.