Lines Matching +full:windows +full:- +full:build +full:- +full:rules

1 Go rules for Bazel_
5 .. _//tests/core/cross: https://github.com/bazelbuild/rules_go/blob/master/tests/core/cross/BUILD.b…
6 .. _Avoiding conflicts: proto/core.rst#avoiding-conflicts
7 .. _Bazel labels: https://docs.bazel.build/versions/master/build-ref.html#labels
8 .. _Bazel: https://bazel.build/
10 .. _Bzlmod: https://bazel.build/external/overview#bzlmod
12 .. _Core rules: docs/go/core/rules.md
15 .. _Deprecation schedule: https://github.com/bazelbuild/rules_go/wiki/Deprecation-schedule
17 .. _gopls integration: https://github.com/bazelbuild/rules_go/wiki/Editor-setup
18 .. _Overriding dependencies: go/dependencies.rst#overriding-dependencies
19 .. _Proto dependencies: go/dependencies.rst#proto-dependencies
20 .. _Proto rules: proto/core.rst
22 .. _Running Bazel Tests on Travis CI: https://kev.inburke.com/kevin/bazel-tests-on-travis-ci/
24 .. _Using rules_go on Windows: windows.rst
25 .. _bazel-go-discuss: https://groups.google.com/forum/#!forum/bazel-go-discuss
26 .. _configuration transition: https://docs.bazel.build/versions/master/skylark/lib/transition.html
27 .. _gRPC dependencies: go/dependencies.rst#grpc-dependencies
28 .. _gazelle update-repos: https://github.com/bazelbuild/bazel-gazelle#update-repos
29 .. _gazelle: https://github.com/bazelbuild/bazel-gazelle
30 .. _github.com/bazelbuild/bazel-gazelle: https://github.com/bazelbuild/bazel-gazelle
32 .. _korfuri/bazel-travis Use Bazel with Travis CI: https://github.com/korfuri/bazel-travis
33 .. _nogo build-time static analysis: go/nogo.rst
39 .. Go rules
40 .. _go_binary: docs/go/core/rules.md#go_binary
45 .. _go_library: docs/go/core/rules.md#go_library
47 .. _go_path: docs/go/core/rules.md#go_path
51 .. _go_repository: https://github.com/bazelbuild/bazel-gazelle/blob/master/repository.md#go_reposit…
53 .. _go_source: docs/go/core/rules.md#go_source
54 .. _go_test: docs/go/core/rules.md#go_test
58 .. External rules
59 .. _git_repository: https://docs.bazel.build/versions/master/repo/git.html
60 .. _http_archive: https://docs.bazel.build/versions/master/repo/http.html#http_archive
71 Mailing list: `bazel-go-discuss`_
76 -------------
77 2023-03-27
84 2022-12-06
90 2022-11-22
96 2022-09-11
100 build flag. Starting this release, rules_go requires Bazel 5.1.0, because
104 2022-07-19
110 2022-06-06
115 2022-05-11
123 --------
133 * `Core rules`_
141 * `Proto rules`_
161 * `Extra rules <docs/go/extras/extras.md>`_
165 * `nogo build-time static analysis`_
166 * `Build modes <go/modes.rst>`_
173 * `Using rules_go on Windows`_
176 --------
178 The rules are in the beta stage of development. They support:
184 * Cross-compilation
185 * Generating BUILD files via gazelle_
186 * Build-time code analysis via nogo_
197 The Go rules are tested and supported on the following host platforms:
199 * Linux, macOS, Windows
202 Users have reported success on several other platforms, but the rules are
211 -----
216 To build Go code with Bazel, you will need:
225 See `Using rules_go on Windows`_ for Windows-specific setup instructions.
247 …"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.0/rules_go-v0.3…
248 "https://github.com/bazelbuild/rules_go/releases/download/v0.39.0/rules_go-v0.39.0.zip",
261 Add a file named ``BUILD.bazel`` in the root directory of your project.
262 You'll need a build file in each directory with Go code, but you'll also need
275 You can build this target with ``bazel build //:hello``.
277 Generating build files
280 If your project can be built with ``go build``, you can generate and update your
281 build files automatically using gazelle_.
294 …"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.0/rules_go-v0.3…
295 "https://github.com/bazelbuild/rules_go/releases/download/v0.39.0/rules_go-v0.39.0.zip",
303 …"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-ga…
304 …"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.g…
317 Add the code below to the ``BUILD.bazel`` file in your project's root directory.
336 This will generate a ``BUILD.bazel`` file with `go_library`_, `go_binary`_, and
338 command in the future to update existing build files with new source files,
341 Writing build files by hand
344 If your project doesn't follow ``go build`` conventions or you prefer not to use
345 gazelle_, you can write build files by hand.
347 In each directory that contains Go code, create a file named ``BUILD.bazel``
348 Add a ``load`` statement at the top of the file for the rules you use.
357 corresponding `go_library`_ rules. The library's import path must be specified
408 load it. `gazelle update-repos`_ can generate or update these rules
415 # Download the Go rules.
420 …"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.0/rules_go-v0.3…
421 "https://github.com/bazelbuild/rules_go/releases/download/v0.39.0/rules_go-v0.39.0.zip",
430 …"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-ga…
431 …"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.g…
435 # Load macros and repository rules.
444 version = "v0.0.0-20200813134508-3edf25e44fcc",
456 -----------------
468 strip_prefix = "protobuf-3.14.0",
470 "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v3.14.0.tar.gz",
480 platform where Bazel runs actions) to build protoc.
483 ``protoc-gen-go``, the Go proto compiler plugin, is provided by the
491 `gazelle update-repos`_ to import them from ``go.mod``.
497 and `go_proto_library`_ rules to generate and compile Go code from .proto
525 ``github.com/golang/protobuf/cmd/protoc-gen-gen`` for compatibility with both
529 ---
536 * `How do I cross-compile?`_
557 described with `go_binary`_ and other rules. Bazel and rules_go together
564 and your project can be depended on by non-Bazel projects.
568 invocation to run the ``go`` binary of the Bazel-configured Go SDK:
572 bazel run @io_bazel_rules_go//go -- <args>
582 described with `go_library`_ and other rules.
586 generate build files using gazelle_.
588 You can import `go_repository`_ rules from a ``go.mod`` file using
589 `gazelle update-repos`_.
595 with ``go build`` before the ``importpath`` attribute was available.
605 incompatible with ``go build``, so if the label name was ``go_default_library``,
614 How do I cross-compile?
617 You can cross-compile by setting the ``--platforms`` flag on the command line.
622 $ bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //cmd
624 By default, cgo is disabled when cross-compiling. To cross-compile with cgo,
626 cross-compiling C/C++ toolchain with Bazel for this to work.
630 $ bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64_cgo //cmd
632 Platform-specific sources with build tags or filename suffixes are filtered
633 automatically at compile time. You can selectively include platform-specific
655 To build a specific `go_binary`_ or `go_test`_ target for a target platform,
657 producing multiple binaries for different platforms in a single build.
678 By default, tests are run in the directory of the build file that defined them.
686 build files, in which case, ``testdata`` is treated as a normal package.
688 Note that on Windows, data files are not directly available to tests, since test
689 data files rely on symbolic links, and by default, Windows doesn't let
700 basename may also be platform-dependent: on Windows, we add an .exe extension.
754 or anywhere else, you may experience conflicts at compile or run-time.
762 using ``go_proto_library`` altogether. You can check in pre-generated .pb.go
763 files and build them with ``go_library`` rules. Gazelle will generate these
764 rules when proto rule generation is disabled (add ``# gazelle:proto
765 disable_global`` to your root build file).
780 * `korfuri/bazel-travis Use Bazel with Travis CI`_
788 * ``--host_jvm_args=-Xmx500m --host_jvm_args=-Xms500m``: Set the maximum and
792 a faster build, but higher risk of OOM kill.
793 * ``--bazelrc=.test-bazelrc``: Use a Bazel configuration file specific to
795 * ``build --spawn_strategy=standalone --genrule_strategy=standalone``: Disable
796 sandboxing for the build. Sandboxing may fail inside of Travis's containers
798 * ``test --test_strategy=standalone``: Disable sandboxing for tests as well.
799 * ``--local_resources=1536,1.5,0.5``: Set Bazel limits on available RAM in MB,
801 mean a faster build, but higher contention and risk of OOM kill.
802 * ``--noshow_progress``: Suppress progress messages in output for cleaner logs.
803 * ``--verbose_failures``: Get more detailed failure messages.
804 * ``--test_output=errors``: Show test stderr in the Travis log. Normally,
809 your build. Downloading Bazel and a Go SDK is a huge part of that. To
812 ``go_register_toolchains(go_version = "host")`` in a Travis-specific
816 can speed up your build significantly, Travis stores its cache on Amazon, and