File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -187,17 +187,18 @@ def _merge_embed(source, embed):
187
187
source ["cgo_exports" ] = source ["cgo_exports" ] + s .cgo_exports
188
188
189
189
def _dedup_deps (deps ):
190
- """Returns a list of targets without duplicate import paths.
190
+ """Returns a list of deps without duplicate import paths.
191
191
192
192
Earlier targets take precedence over later targets. This is intended to
193
193
allow an embedding library to override the dependencies of its
194
194
embedded libraries.
195
+
196
+ Args:
197
+ deps: an iterable containing either Targets or GoArchives.
195
198
"""
196
199
deduped_deps = []
197
200
importpaths = {}
198
201
for dep in deps :
199
- # TODO(#1784): we allow deps to be a list of GoArchive since go_test and
200
- # nogo work this way. We should force deps to be a list of Targets.
201
202
if hasattr (dep , "data" ) and hasattr (dep .data , "importpath" ):
202
203
importpath = dep .data .importpath
203
204
else :
Original file line number Diff line number Diff line change @@ -879,8 +879,18 @@ build mode.
879
879
+--------------------------------+-----------------------------+-----------------------------------+
880
880
| :param: `attr ` | :type: `ctx.attr ` | |mandatory | |
881
881
+--------------------------------+-----------------------------+-----------------------------------+
882
- | The attributes of the rule being processed. In a normal rule implementation this would be |
883
- | ctx.attr. |
882
+ | The attributes of the target being analyzed. For most rules, this should be |
883
+ | ``ctx.attr ``. Rules can also pass in a ``struct `` with the same fields. |
884
+ | |
885
+ | ``library_to_source `` looks for fields corresponding to the attributes of |
886
+ | ``go_library `` and ``go_binary ``. This includes ``srcs ``, ``deps ``, ``embed ``, |
887
+ | and so on. All fields are optional (and may not be defined in the struct |
888
+ | argument at all), but if they are present, they must have the same types and |
889
+ | allowed values as in ``go_library `` and ``go_binary ``. For example, ``srcs `` |
890
+ | must be a list of ``Targets ``; ``gc_goopts `` must be a list of strings. |
891
+ | |
892
+ | As an exception, ``deps ``, if present, must be a list containing either |
893
+ | ``Targets `` or ``GoArchives ``. |
884
894
+--------------------------------+-----------------------------+-----------------------------------+
885
895
| :param: `library ` | :type: `GoLibrary ` | |mandatory | |
886
896
+--------------------------------+-----------------------------+-----------------------------------+
You can’t perform that action at this time.
0 commit comments