Skip to content

Commit

Permalink
Provide pkginfo on go_libarary
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatskaari committed Jan 18, 2024
1 parent ea8801f commit c43d802
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions build_defs/go.build_defs
Original file line number Diff line number Diff line change
Expand Up @@ -443,16 +443,20 @@ def go_library(name:str, srcs:list, resources:list=[], asm_srcs:list=None, hdrs:
labels = labels + src_labels,
test_only=test_only,
)
provides = {'go': ':' + name, 'go_src': src_rule, 'modinfo': modinfo, 'hdrs': hdrs_rule}

# Package info rule for the Go packages driver
if _generate_pkg_info:
deps += [_go_pkg_info(
pkg_info = _go_pkg_info(
name = name,
srcs = srcs + resources,
import_path = import_path,
package = package,
test_only = test_only,
)]
visibility = visibility,
)
deps += []
provides["pkg_info"] = pkg_info

tools = { 'go': [CONFIG.GO.GO_TOOL] }
if filter_srcs or cover:
Expand All @@ -474,7 +478,6 @@ def go_library(name:str, srcs:list, resources:list=[], asm_srcs:list=None, hdrs:
if pgo_file:
srcs['pgo'] = [pgo_file]

provides = {'go': ':' + name, 'go_src': src_rule, 'modinfo': modinfo, 'hdrs': hdrs_rule}
if cover and not CONFIG.GO.COVERAGEREDESIGN:
provides['cover_vars'] = cover_vars
return build_rule(
Expand Down Expand Up @@ -1477,6 +1480,7 @@ def go_module(name:str='', module:str, version:str='', download:str='', deps:lis
module = module,
test_only = test_only,
install = installpkg,
visibility=visibility,
)
provides["pkg_info"] = pkg_info

Expand Down Expand Up @@ -1516,8 +1520,8 @@ def _go_modinfo(name:str, test_only:bool=False, deps:list):
)


def _go_pkg_info(name:str, srcs:list, importconfig:str=None, import_path:str="", package:str="",
module:str="", test_only:bool=False, install:list=[]):
def _go_pkg_info(name:str, srcs:list, visibility:list, importconfig:str=None, import_path:str="", package:str="",
module:str="", test_only:bool=False, install:list=[]):
"""Internal-only function for generating the pkg_info files"""


Expand Down Expand Up @@ -1550,6 +1554,7 @@ def _go_pkg_info(name:str, srcs:list, importconfig:str=None, import_path:str="",
cmd = f'{cmd} > "$OUTS"',
labels = ["go_pkg_info"],
test_only = test_only,
visibility=visibility,
)


Expand Down

0 comments on commit c43d802

Please sign in to comment.