cross

command
v0.23.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

README

Cross compilation
=================

.. _go_binary: /go/core.rst#go_binary
.. _go_library: /go/core.rst#go_library

Tests to ensure that cross compilation is working as expected.

.. contents::

cross_test
----------


Tests that cross compilation controlled by the ``goos`` and ``goarch``
attributes on a `go_binary`_ produces executables for the correct platform.

This builds binaries using `main.go <main.go>`_ in multiple configurations, and
then passes them as data to a test `written in go <cross_test.go>`_.

The test executes the unix command "file" on the binaries to determine their
type, and checks they were built for the expected architecture.

The test also checks that `go_library`_ packages imoprted by `go_binary`_ with
``goos`` set are built in the correct configuration, and ``select`` is applied
in that configuration. Each binary depends on ``platform_lib``, which has a
different source file (determined by ``select``) for each platform. The source
files have a ``goos`` suffix, so they will only be built on the right platform.
If the wrong source file is used or if all files are filtered out, the
`go_binary`_ will not build.

ios_select_test
---------------

Tests that we can cross-compile a library for iOS. We should be able to select
a dependency using ``@io_bazel_rules_go//go/platform:darwin``, which is true
when building for iOS (tested by ``ios_select_test``) and macOS
(tested by ``use_ios_lib``).

proto_test
----------

Tests that a ``go_proto_library`` can be cross-compiled with ``--platforms``.

Documentation

Rendered for js/wasm
The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL