xref: /aosp_15_r20/external/bazelbuild-rules_go/go/providers.rst (revision 9bb1b549b6a84214c53be0924760be030e66b93a)
1*9bb1b549SSpandan DasGo providers
2*9bb1b549SSpandan Das============
3*9bb1b549SSpandan Das
4*9bb1b549SSpandan Das.. _providers: https://docs.bazel.build/versions/master/skylark/rules.html#providers
5*9bb1b549SSpandan Das
6*9bb1b549SSpandan Das.. _go_library: /docs/go/core/rules.md#go_library
7*9bb1b549SSpandan Das.. _go_binary: /docs/go/core/rules.md#go_binary
8*9bb1b549SSpandan Das.. _go_test: /docs/go/core/rules.md#go_test
9*9bb1b549SSpandan Das.. _go_path: /docs/go/core/rules.md#go_path
10*9bb1b549SSpandan Das.. _cc_library: https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library
11*9bb1b549SSpandan Das.. _flatbuffers: http://google.github.io/flatbuffers/
12*9bb1b549SSpandan Das.. _static linking: modes.rst#building-static-binaries
13*9bb1b549SSpandan Das.. _race detector: modes.rst#using-the-race-detector
14*9bb1b549SSpandan Das.. _runfiles: https://docs.bazel.build/versions/master/skylark/lib/runfiles.html
15*9bb1b549SSpandan Das.. _File: https://docs.bazel.build/versions/master/skylark/lib/File.html
16*9bb1b549SSpandan Das.. _new_library: toolchains.rst#new_library
17*9bb1b549SSpandan Das.. _library_to_source: toolchains.rst#library_to_source
18*9bb1b549SSpandan Das.. _archive: toolchains.rst#archive
19*9bb1b549SSpandan Das
20*9bb1b549SSpandan Das.. role:: param(kbd)
21*9bb1b549SSpandan Das.. role:: type(emphasis)
22*9bb1b549SSpandan Das.. role:: value(code)
23*9bb1b549SSpandan Das.. |mandatory| replace:: **mandatory value**
24*9bb1b549SSpandan Das
25*9bb1b549SSpandan Das
26*9bb1b549SSpandan DasThe providers_ are the outputs of the rules. You generaly get them by having a
27*9bb1b549SSpandan Dasdependency on a rule, and then asking for a provider of a specific type.
28*9bb1b549SSpandan Das
29*9bb1b549SSpandan Das.. contents:: :depth: 2
30*9bb1b549SSpandan Das
31*9bb1b549SSpandan Das-----
32*9bb1b549SSpandan Das
33*9bb1b549SSpandan DasDesign
34*9bb1b549SSpandan Das------
35*9bb1b549SSpandan Das
36*9bb1b549SSpandan DasThe Go providers are designed primarily for the efficiency of the Go rules. The
37*9bb1b549SSpandan Dasinformation they share is mostly there because it is required for the core rules
38*9bb1b549SSpandan Dasto work.
39*9bb1b549SSpandan Das
40*9bb1b549SSpandan DasAll the providers are designed to hold only immutable data. This is partly
41*9bb1b549SSpandan Dasbecause its a cleaner design choice to be able to assume a provider will never
42*9bb1b549SSpandan Daschange, but also because only immutable objects are allowed to be stored in a
43*9bb1b549SSpandan Dasdepset, and it's really useful to have depsets of providers.  Specifically the
44*9bb1b549SSpandan Das:param:`direct` and :param:`transitive` fields on GoLibrary_ only work because
45*9bb1b549SSpandan Dasit is immutable.
46*9bb1b549SSpandan Das
47*9bb1b549SSpandan DasAPI
48*9bb1b549SSpandan Das---
49*9bb1b549SSpandan Das
50*9bb1b549SSpandan DasGoLibrary
51*9bb1b549SSpandan Das~~~~~~~~~
52*9bb1b549SSpandan Das
53*9bb1b549SSpandan Das``GoLibrary`` contains metadata about an individual library. It is provided
54*9bb1b549SSpandan Dasby the `go_library`_ rule and other compatible rules. In general, you should
55*9bb1b549SSpandan Dasbuild ``GoLibrary`` with the `new_library`_ helper method. ``GoLibrary`` is
56*9bb1b549SSpandan Dasan input to the `library_to_source`_ helper method, which produces GoSource_.
57*9bb1b549SSpandan Das
58*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
59*9bb1b549SSpandan Das| **Name**                       | **Type**                                                        |
60*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
61*9bb1b549SSpandan Das| :param:`name`                  | :type:`string`                                                  |
62*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
63*9bb1b549SSpandan Das| The name of the library. Usually, this is the ``name`` attribute.                                |
64*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
65*9bb1b549SSpandan Das| :param:`label`                 | :type:`Label`                                                   |
66*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
67*9bb1b549SSpandan Das| The full label for the library.                                                                  |
68*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
69*9bb1b549SSpandan Das| :param:`importpath`            | :type:`string`                                                  |
70*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
71*9bb1b549SSpandan Das| The string used in ``import`` declarations in Go source code to import                           |
72*9bb1b549SSpandan Das| this library. Usually, this is the ``importpath`` attribute.                                     |
73*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
74*9bb1b549SSpandan Das| :param:`importmap`             | :type:`string`                                                  |
75*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
76*9bb1b549SSpandan Das| The package path for this library. The Go compiler and linker internally refer                   |
77*9bb1b549SSpandan Das| to the library using this string. It must be unique in any binary the library                    |
78*9bb1b549SSpandan Das| is linked into. This is usually the same as ``importpath``, but it may be                        |
79*9bb1b549SSpandan Das| different, especially for vendored libraries.                                                    |
80*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
81*9bb1b549SSpandan Das| :param:`pathtype`              | :type:`string`                                                  |
82*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
83*9bb1b549SSpandan Das| Information about the source of the importpath. Possible values are:                             |
84*9bb1b549SSpandan Das|                                                                                                  |
85*9bb1b549SSpandan Das| :value:`explicit`                                                                                |
86*9bb1b549SSpandan Das|     The importpath was explicitly supplied by the user and the library is importable.            |
87*9bb1b549SSpandan Das|     This is the normal case.                                                                     |
88*9bb1b549SSpandan Das| :value:`inferred`                                                                                |
89*9bb1b549SSpandan Das|     The importpath was inferred from the directory structure and rule name. The library may be   |
90*9bb1b549SSpandan Das|     importable.                                                                                  |
91*9bb1b549SSpandan Das|     This is normally true for rules that do not expect to be compiled directly to a library,     |
92*9bb1b549SSpandan Das|     embeded into another rule instead (source generators)                                        |
93*9bb1b549SSpandan Das| :value:`export`                                                                                  |
94*9bb1b549SSpandan Das|     The importpath was explicitly supplied by the user, but the library is                       |
95*9bb1b549SSpandan Das|     not importable. This is the case for binaries and tests. The importpath                      |
96*9bb1b549SSpandan Das|     may still be useful for `go_path`_ and other rules.                                          |
97*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
98*9bb1b549SSpandan Das| :param:`resolve`               | :type:`function (optional)`                                     |
99*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
100*9bb1b549SSpandan Das| A function called by `library_to_source`_ that can be used to resolve this                       |
101*9bb1b549SSpandan Das| library to a mode-specific GoSource_.                                                            |
102*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
103*9bb1b549SSpandan Das| :param:`is_main`               | :type:`bool`                                                    |
104*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
105*9bb1b549SSpandan Das| Indicates whether the library should be compiled as a `main` package.                            |
106*9bb1b549SSpandan Das| `main` packages may have arbitrary `importpath` and `importmap` values,                          |
107*9bb1b549SSpandan Das| but the compiler and linker must see them as `main`.                                             |
108*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
109*9bb1b549SSpandan Das
110*9bb1b549SSpandan DasGoSource
111*9bb1b549SSpandan Das~~~~~~~~
112*9bb1b549SSpandan Das
113*9bb1b549SSpandan DasGoSource represents a GoLibrary_ after mode-specific processing, ready to build
114*9bb1b549SSpandan Dasa GoArchive_. This is produced by calling the `library_to_source`_ helper
115*9bb1b549SSpandan Dasmethod. In general, only rules_go should need to build or handle these.
116*9bb1b549SSpandan Das
117*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
118*9bb1b549SSpandan Das| **Name**                       | **Type**                                                        |
119*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
120*9bb1b549SSpandan Das| :param:`library`               | :type:`GoLibrary`                                               |
121*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
122*9bb1b549SSpandan Das| The go library that this GoSource was generated from.                                            |
123*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
124*9bb1b549SSpandan Das| :param:`mode`                  | :type:`Mode`                                                    |
125*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
126*9bb1b549SSpandan Das| The mode this library is being built for.                                                        |
127*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
128*9bb1b549SSpandan Das| :param:`srcs`                  | :type:`list of File`                                            |
129*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
130*9bb1b549SSpandan Das| The sources to compile into the archive.                                                         |
131*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
132*9bb1b549SSpandan Das| :param:`orig_srcs`             | :type:`list of File`                                            |
133*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
134*9bb1b549SSpandan Das| The original source files this library is based on. This may differ from                         |
135*9bb1b549SSpandan Das| :param:`srcs` if processing tools such as cgo or cover are applied.                              |
136*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
137*9bb1b549SSpandan Das| :param:`orig_src_map`          | :type:`dict of File to File`                                    |
138*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
139*9bb1b549SSpandan Das| Maps generated files in :param:`srcs` back to :param:`orig_srcs`. Not all                        |
140*9bb1b549SSpandan Das| generated files may appear in here.                                                              |
141*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
142*9bb1b549SSpandan Das| :param:`embedsrcs`             | :type:`list of File`                                            |
143*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
144*9bb1b549SSpandan Das| Files that may be embedded into the compiled package using ``//go:embed``                        |
145*9bb1b549SSpandan Das| directives. All files must be in the same logical directory or a subdirectory                    |
146*9bb1b549SSpandan Das| as source files. However, it's okay to mix static and generated source files                     |
147*9bb1b549SSpandan Das| and static and generated embeddable files.                                                       |
148*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
149*9bb1b549SSpandan Das| :param:`cover`                 | :type:`list of File`                                            |
150*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
151*9bb1b549SSpandan Das| List of source files to instrument for code coverage.                                            |
152*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
153*9bb1b549SSpandan Das| :param:`x_defs`                | :type:`string_dict`                                             |
154*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
155*9bb1b549SSpandan Das| Map of defines to add to the go link command.                                                    |
156*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
157*9bb1b549SSpandan Das| :param:`deps`                  | :type:`list of Target`                                          |
158*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
159*9bb1b549SSpandan Das| The direct dependencies needed by this library.                                                  |
160*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
161*9bb1b549SSpandan Das| :param:`gc_goopts`             | :type:`list of string`                                          |
162*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
163*9bb1b549SSpandan Das| Go compilation options that should be used when compiling these sources.                         |
164*9bb1b549SSpandan Das| In general these will be used for *all* sources of any library this provider is embedded into.   |
165*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
166*9bb1b549SSpandan Das| :param:`runfiles`              | :type:`Runfiles`                                                |
167*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
168*9bb1b549SSpandan Das| The set of files needed by code in these sources at runtime.                                     |
169*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
170*9bb1b549SSpandan Das| :param:`cgo`                   | :type:`bool`                                                    |
171*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
172*9bb1b549SSpandan Das| True if the library may contain cgo sources or C/C++/ObjC sources.                               |
173*9bb1b549SSpandan Das| If true and cgo is enabled, cgo sources will be processed with cgo, and                          |
174*9bb1b549SSpandan Das| C/C++/ObjC will be compiled with the appropriate toolchain and packed into                       |
175*9bb1b549SSpandan Das| the final archive. If true and cgo is disabled, cgo sources are filtered                         |
176*9bb1b549SSpandan Das| out, and sources with ``// +build !cgo`` are included.                                           |
177*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
178*9bb1b549SSpandan Das| :param:`cdeps`                 | :type:`list of Target`                                          |
179*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
180*9bb1b549SSpandan Das| List of ``cc_library`` and ``objc_library`` targets this library depends on.                     |
181*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
182*9bb1b549SSpandan Das| :param:`cppopts`               | :type:`list of string`                                          |
183*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
184*9bb1b549SSpandan Das| List of additional flags to pass to the C preprocessor when invoking the                         |
185*9bb1b549SSpandan Das| C/C++/ObjC compilers.                                                                            |
186*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
187*9bb1b549SSpandan Das| :param:`copts`                 | :type:`list of string`                                          |
188*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
189*9bb1b549SSpandan Das| List of additional flags to pass to the C compiler.                                              |
190*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
191*9bb1b549SSpandan Das| :param:`cxxopts`               | :type:`list of string`                                          |
192*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
193*9bb1b549SSpandan Das| List of additional flags to pass to the C++ compiler.                                            |
194*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
195*9bb1b549SSpandan Das| :param:`clinkopts`             | :type:`list of string`                                          |
196*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
197*9bb1b549SSpandan Das| List of additional flags to pass to the external linker.                                         |
198*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
199*9bb1b549SSpandan Das| :param:`cgo_deps`              | :type:`list of File`                                            |
200*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
201*9bb1b549SSpandan Das| Deprecated; use ``cdeps`` instead. The direct cgo dependencies of this library.                  |
202*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
203*9bb1b549SSpandan Das| :param:`cgo_exports`           | :type:`list of File`                                            |
204*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
205*9bb1b549SSpandan Das| The exposed cc headers for these sources.                                                        |
206*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
207*9bb1b549SSpandan Das| :param:`cc_info`               | :type:`CcInfo`                                                  |
208*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
209*9bb1b549SSpandan Das| The result of merging the ``CcInfo``s of all `deps` and `cdeps`                                  |
210*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
211*9bb1b549SSpandan Das
212*9bb1b549SSpandan DasGoArchiveData
213*9bb1b549SSpandan Das~~~~~~~~~~~~~
214*9bb1b549SSpandan Das
215*9bb1b549SSpandan DasGoArchiveData contains information about a compiled Go package. GoArchiveData
216*9bb1b549SSpandan Dasonly contains immutable information about a package itself. It does not contain
217*9bb1b549SSpandan Dasany information about dependencies or references to other providers. This makes
218*9bb1b549SSpandan Dasit suitable to include in depsets. GoArchiveData is not directly returned by any
219*9bb1b549SSpandan Dasrule.  Instead, it's referenced in the ``data`` field of GoArchive_.
220*9bb1b549SSpandan Das
221*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
222*9bb1b549SSpandan Das| **Name**                       | **Type**                                                        |
223*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
224*9bb1b549SSpandan Das| :param:`name`                  | :type:`string`                                                  |
225*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
226*9bb1b549SSpandan Das| The name of the library. Usually the same as the ``name`` attribute.                             |
227*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
228*9bb1b549SSpandan Das| :param:`label`                 | :type:`Label`                                                   |
229*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
230*9bb1b549SSpandan Das| The full label for the library.                                                                  |
231*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
232*9bb1b549SSpandan Das| :param:`importpath`            | :type:`string`                                                  |
233*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
234*9bb1b549SSpandan Das| The string used in ``import`` declarations in Go source code to import this                      |
235*9bb1b549SSpandan Das| library. Usually, this is the ``importpath`` attribute.                                          |
236*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
237*9bb1b549SSpandan Das| :param:`importmap`             | :type:`string`                                                  |
238*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
239*9bb1b549SSpandan Das| The package path for this library. The Go compiler and linker internally refer                   |
240*9bb1b549SSpandan Das| to the library using this string. It must be unique in any binary the library                    |
241*9bb1b549SSpandan Das| is linked into. This is usually the same as ``importpath``, but it may be                        |
242*9bb1b549SSpandan Das| different, especially for vendored libraries.                                                    |
243*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
244*9bb1b549SSpandan Das| :param:`pathtype`              | :type:`string`                                                  |
245*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
246*9bb1b549SSpandan Das| Information about the source of the importpath. Possible values are:                             |
247*9bb1b549SSpandan Das|                                                                                                  |
248*9bb1b549SSpandan Das| :value:`explicit`                                                                                |
249*9bb1b549SSpandan Das|     The importpath was explicitly supplied by the user and the library is importable.            |
250*9bb1b549SSpandan Das|     This is the normal case.                                                                     |
251*9bb1b549SSpandan Das| :value:`inferred`                                                                                |
252*9bb1b549SSpandan Das|     The importpath was inferred from the directory structure and rule name. The library may be   |
253*9bb1b549SSpandan Das|     importable.                                                                                  |
254*9bb1b549SSpandan Das|     This is normally true for rules that do not expect to be compiled directly to a library,     |
255*9bb1b549SSpandan Das|     embeded into another rule instead (source generators)                                        |
256*9bb1b549SSpandan Das| :value:`export`                                                                                  |
257*9bb1b549SSpandan Das|     The importpath was explicitly supplied by the user, but the library is                       |
258*9bb1b549SSpandan Das|     not importable. This is the case for binaries and tests. The importpath                      |
259*9bb1b549SSpandan Das|     may still be useful for `go_path`_ and other rules.                                          |
260*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
261*9bb1b549SSpandan Das| :param:`file`                  | :type:`File`                                                    |
262*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
263*9bb1b549SSpandan Das| The archive file produced when this library is compiled.                                         |
264*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
265*9bb1b549SSpandan Das| :param:`srcs`                  | :type:`tuple of File`                                           |
266*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
267*9bb1b549SSpandan Das| The .go sources compiled into the archive. May have been generated or                            |
268*9bb1b549SSpandan Das| transformed with tools like cgo and cover.                                                       |
269*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
270*9bb1b549SSpandan Das| :param:`orig_srcs`             | :type:`tuple of File`                                           |
271*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
272*9bb1b549SSpandan Das| The unmodified sources provided to the rule, including .go, .s, .h, .c files.                    |
273*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
274*9bb1b549SSpandan Das| :param:`data_files`            | :type:`tuple of File`                                           |
275*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
276*9bb1b549SSpandan Das| Data files that should be available at runtime to binaries and tests built                       |
277*9bb1b549SSpandan Das| from this archive.                                                                               |
278*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
279*9bb1b549SSpandan Das
280*9bb1b549SSpandan DasGoArchive
281*9bb1b549SSpandan Das~~~~~~~~~
282*9bb1b549SSpandan Das
283*9bb1b549SSpandan Das``GoArchive`` contains information about a compiled archive and its dependencies
284*9bb1b549SSpandan Das(both direct and transitive). This is used when compiling and linking Go
285*9bb1b549SSpandan Daslibraries and binaries. It is produced by the archive_ toolchain function.
286*9bb1b549SSpandan Das
287*9bb1b549SSpandan DasMost of the metadata about the archive itself is available in GoArchiveData_,
288*9bb1b549SSpandan Daswhich is available through the :param:`data` field.
289*9bb1b549SSpandan Das
290*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
291*9bb1b549SSpandan Das| **Name**                       | **Type**                                                        |
292*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
293*9bb1b549SSpandan Das| :param:`source`                | :type:`GoSource`                                                |
294*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
295*9bb1b549SSpandan Das| The source provider this GoArchive was compiled from.                                            |
296*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
297*9bb1b549SSpandan Das| :param:`data`                  | :type:`GoArchiveData`                                           |
298*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
299*9bb1b549SSpandan Das| The non transitive data for this archive.                                                        |
300*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
301*9bb1b549SSpandan Das| :param:`direct`                | :type:`list of GoArchive`                                       |
302*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
303*9bb1b549SSpandan Das| The direct dependencies of this archive.                                                         |
304*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
305*9bb1b549SSpandan Das| :param:`libs`                  | :type:`depset of File`                                          |
306*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
307*9bb1b549SSpandan Das| The transitive set of libraries needed to link with this archive.                                |
308*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
309*9bb1b549SSpandan Das| :param:`transitive`            | :type:`depset of GoArchiveData`                                 |
310*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
311*9bb1b549SSpandan Das| The full set of transitive dependencies. This includes ``data`` for this                         |
312*9bb1b549SSpandan Das| archive and all ``data`` members transitively reachable through ``direct``.                      |
313*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
314*9bb1b549SSpandan Das| :param:`x_defs`                | :type:`string_dict`                                             |
315*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
316*9bb1b549SSpandan Das| The full transitive set of defines to add to the go link command.                                |
317*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
318*9bb1b549SSpandan Das| :param:`cgo_deps`              | :type:`depset(cc_library)`                                      |
319*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
320*9bb1b549SSpandan Das| The direct cgo dependencies of this library.                                                     |
321*9bb1b549SSpandan Das| This has the same constraints as things that can appear in the deps of a cc_library_.            |
322*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
323*9bb1b549SSpandan Das| :param:`cgo_exports`           | :type:`depset of GoSource`                                      |
324*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
325*9bb1b549SSpandan Das| The the transitive set of c headers needed to reference exports of this archive.                 |
326*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
327*9bb1b549SSpandan Das| :param:`runfiles`              | runfiles_                                                       |
328*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
329*9bb1b549SSpandan Das| The files needed to run anything that includes this library.                                     |
330*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
331*9bb1b549SSpandan Das| :param:`mode`                  | :type:`Mode`                                                    |
332*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
333*9bb1b549SSpandan Das| The mode this archive was compiled in.                                                           |
334*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
335*9bb1b549SSpandan Das
336*9bb1b549SSpandan DasGoPath
337*9bb1b549SSpandan Das~~~~~~
338*9bb1b549SSpandan Das
339*9bb1b549SSpandan DasGoPath is produced by the `go_path`_ rule. It gives a list of packages used to
340*9bb1b549SSpandan Dasbuild the ``go_path`` directory and provides a list of original files for each
341*9bb1b549SSpandan Daspackage.
342*9bb1b549SSpandan Das
343*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
344*9bb1b549SSpandan Das| **Name**                       | **Type**                                                        |
345*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
346*9bb1b549SSpandan Das| :param:`gopath`                | :type:`string`                                                  |
347*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
348*9bb1b549SSpandan Das| The short path to the output file or directory. Useful for constructing                          |
349*9bb1b549SSpandan Das| ``runfiles`` paths.                                                                              |
350*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
351*9bb1b549SSpandan Das| :param:`gopath_file`           | :type:`File`                                                    |
352*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
353*9bb1b549SSpandan Das| A Bazel File_ that points to the output directory.                                               |
354*9bb1b549SSpandan Das|                                                                                                  |
355*9bb1b549SSpandan Das| * In ``archive`` mode, this is the archive.                                                      |
356*9bb1b549SSpandan Das| * In ``copy`` mode, this is the output directory.                                                |
357*9bb1b549SSpandan Das| * In ``link`` mode, this is an empty file inside the output directory, so                        |
358*9bb1b549SSpandan Das|   you need to use .dirname to get the path to the directory.                                     |
359*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
360*9bb1b549SSpandan Das| :param:`packages`              | :type:`list of struct`                                          |
361*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
362*9bb1b549SSpandan Das| A list of structs representing packages used to build the ``go_path``                            |
363*9bb1b549SSpandan Das| directory. Each struct has the following fields:                                                 |
364*9bb1b549SSpandan Das|                                                                                                  |
365*9bb1b549SSpandan Das| * ``importpath``: the import path of the package.                                                |
366*9bb1b549SSpandan Das| * ``dir``: the subdirectory of the package within the ``go_path``, including                     |
367*9bb1b549SSpandan Das|   the ``src/`` prefix. May different from ``importpath`` due to vendoring.                       |
368*9bb1b549SSpandan Das| * ``srcs``: list of source ``File``s.                                                            |
369*9bb1b549SSpandan Das| * ``data``: list of data ``File``s.                                                              |
370*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
371*9bb1b549SSpandan Das
372*9bb1b549SSpandan DasGoSDK
373*9bb1b549SSpandan Das~~~~~
374*9bb1b549SSpandan Das
375*9bb1b549SSpandan Das``GoSDK`` contains information about the Go SDK used in the toolchain.
376*9bb1b549SSpandan Das
377*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
378*9bb1b549SSpandan Das| **Name**                       | **Type**                                                        |
379*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
380*9bb1b549SSpandan Das| :param:`goos`                  | :type:`string`                                                  |
381*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
382*9bb1b549SSpandan Das| The host operating system the SDK was built for.                                                 |
383*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
384*9bb1b549SSpandan Das| :param:`goarch`                | :type:`string`                                                  |
385*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
386*9bb1b549SSpandan Das| The host architecture the SDK was built for.                                                     |
387*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
388*9bb1b549SSpandan Das| :param:`root_file`             | :type:`File`                                                    |
389*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
390*9bb1b549SSpandan Das| A file in the SDK root directory. Used to determine ``GOROOT``.                                  |
391*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
392*9bb1b549SSpandan Das| :param:`libs`                  | :type:`list of File`                                            |
393*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
394*9bb1b549SSpandan Das| Pre-compiled .a files for the standard library, built for the                                    |
395*9bb1b549SSpandan Das| execution platform.                                                                              |
396*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
397*9bb1b549SSpandan Das| :param:`headers`               | :type:`list of File`                                            |
398*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
399*9bb1b549SSpandan Das| .h files from pkg/include that may be included in assembly sources.                              |
400*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
401*9bb1b549SSpandan Das| :param:`srcs`                  | :type:`list of File`                                            |
402*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
403*9bb1b549SSpandan Das| Source files for importable packages in the standard library.                                    |
404*9bb1b549SSpandan Das| Internal, vendored, and tool packages might not be included.                                     |
405*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
406*9bb1b549SSpandan Das| :param:`package_list`          | :type:`File`                                                    |
407*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
408*9bb1b549SSpandan Das| A file containing a list of importable packages in the standard library.                         |
409*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
410*9bb1b549SSpandan Das| :param:`tools`                 | :type:`list of File`                                            |
411*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
412*9bb1b549SSpandan Das| Executable files from pkg/tool built for the execution platform.                                 |
413*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
414*9bb1b549SSpandan Das| :param:`go`                    | :type:`File`                                                    |
415*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
416*9bb1b549SSpandan Das| The go binary file.                                                                              |
417*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
418*9bb1b549SSpandan Das
419*9bb1b549SSpandan DasGoStdLib
420*9bb1b549SSpandan Das~~~~~~~~
421*9bb1b549SSpandan Das
422*9bb1b549SSpandan Das``GoStdLib`` contains information about the standard library being used for
423*9bb1b549SSpandan Dascompiling and linking. The standard library may be the pre-compiled library
424*9bb1b549SSpandan Dasfrom GoSDK_, or it may be another library compiled for the target mode.
425*9bb1b549SSpandan Das
426*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
427*9bb1b549SSpandan Das| **Name**                       | **Type**                                                        |
428*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
429*9bb1b549SSpandan Das| :param:`root_file`             | :type:`File`                                                    |
430*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
431*9bb1b549SSpandan Das| A file or directory in the standard library root directory. Used to determine ``GOROOT``.                     |
432*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
433*9bb1b549SSpandan Das| :param:`libs`                  | :type:`list of File`                                            |
434*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
435*9bb1b549SSpandan Das| .a files for the standard library, built for the target platform.                                |
436*9bb1b549SSpandan Das+--------------------------------+-----------------------------------------------------------------+
437