build

package
v0.0.0-...-bbc9ce3 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrArgNotSet = errors.New("arg not set")

ErrArgNotSet represents an arg not having been set in the build.

View Source
var ErrBuildIDNotFound = errors.New("build ID not found")

ErrBuildIDNotFound is a sometimes expected error that a build ID was not found.

Functions

This section is empty.

Types

type Archive

type Archive struct {
	// Name is the canonical name of the image.
	Name string `json:"name"`

	// Path is the path to the archive within the build directory.
	Path string `json:"path"`

	// Type is the shorthand for the format of the archive (e.g. "tar" or "tgz").
	Type string `json:"type"`
}

type Args

type Args map[string]json.RawMessage

Args represents the GN arguments set in the build.

func (Args) BoolValue

func (args Args) BoolValue(name string) (bool, error)

BoolValue returns the value of a boolean GN arg set in the build. If unset, ErrArgNotSet will be returned.

type Binary

type Binary struct {
	// CPU is the CPU architecture of the binary.
	CPU string `json:"cpu"`

	// OS is the operating system that the binary is for.
	OS string `json:"os"`

	// Environment is the toolchain environment name of what specific execution
	// this was built for, e.g. "user", "host", "guest".
	Environment string `json:"environment"`

	// Label is the GN label of the binary target.
	Label string `json:"label"`

	// Type is the type of the binary.
	Type string `json:"type"`

	// Debug is the path to the unstripped or separate debug file is.
	Debug string `json:"debug"`

	// Dist is the path to the stripped binary for deployment/execution.
	Dist string `json:"dist,omitempty"`

	// BuildIDFile is the path to a file containing the lowercase ASCII
	// hexadecimal representation of the ELF build ID.
	BuildIDFile string `json:"elf_build_id,omitempty"`

	// Breakpad is the path to the breakpad symbol file for the debug binary, if
	// present.
	Breakpad string `json:"breakpad,omitempty"`

	// GSYM is the path to the GSYM symbol file for the debug binary, if
	// present.
	GSYM string `json:"gsym,omitempty"`
}

Binary represents a binary produced by the build.

func (Binary) ELFBuildID

func (binary Binary) ELFBuildID(buildDir string) (string, error)

ELFBuildID returns the build ID associated to a given binary. If no associated ID can be found - and no error unexpected error was experienced - ErrBuildIDNotFound is returned. build.GetBuildID() differs from elflib.GetBuildIDs() in that that former more statically determines the ID from build metadata, while the latter derives it directly from the ELF's notes section.

type CheckoutArtifact

type CheckoutArtifact struct {
	// Name is the canonical name of the artifact.
	Name string `json:"name"`

	// Path is the artifact, relative to the build directory.
	Path string `json:"path"`

	// Type is the shorthand for the type of the artifact.
	Type string `json:"type"`
}

CheckoutArtifact represents an entry in a checkout artifact manifest.

type DimensionSet

type DimensionSet struct {
	// DeviceType represents the class of device the test should run on.
	// This is a required field.
	DeviceType string `json:"device_type,omitempty"`

	// The OS to run the test on (e.g., "Linux" or "Mac"). Used for host-side testing.
	OS string `json:"os,omitempty"`

	// The CPU type that the test is meant to run on.
	CPU string `json:"cpu,omitempty"`

	// Testbed denotes a physical test device configuration to run a test on (e.g., multi-device set-ups or devices inside chambers for connectivity testing).
	Testbed string `json:"testbed,omitempty"`

	// Pool denotes the swarming pool to run a test in.
	Pool string `json:"pool,omitempty"`
}

DimensionSet encapsulates the Swarming dimensions a test wishes to target.

type Environment

type Environment struct {
	// Dimensions gives the Swarming dimensions a test wishes to target.
	Dimensions DimensionSet `json:"dimensions"`

	// Tags are keys given to an environment on which the testsharder may filter.
	Tags []string `json:"tags,omitempty"`

	// ServiceAccount gives a service account to attach to Swarming task.
	ServiceAccount string `json:"service_account,omitempty"`

	// Netboot tells whether to "netboot" instead of paving before running the tests.
	Netboot bool `json:"netboot,omitempty"`

	// IsEmu is true if this environment targets an emulator, false otherwise.
	IsEmu bool `json:"is_emu,omitempty"`
}

Environment describes the full environment a test requires. The GN environments specified by test authors in the Fuchsia source correspond directly to the Environment struct defined here.

type Image

type Image struct {
	// Name is the canonical name of the image.
	Name string `json:"name"`

	// Path is the path to the image within the build directory.
	Path string `json:"path"`

	// Label is the GN label of the image.
	Label string `json:"label"`

	// Type is the shorthand for the type of the image (e.g., "zbi" or "blk").
	Type string `json:"type"`

	// PaveArgs is the list of associated arguments to pass to the bootserver
	// when paving.
	PaveArgs []string `json:"bootserver_pave,omitempty"`

	// PaveZedbootArgs is the list of associated arguments to pass to the bootserver
	// when paving zedboot
	PaveZedbootArgs []string `json:"bootserver_pave_zedboot,omitempty"`

	// NetbootArgs is the list of associated arguments to pass to the bootserver
	// when netbooting.
	NetbootArgs []string `json:"bootserver_netboot,omitempty"`
}

Image represents an entry in an image manifest.

type ImageManifest

type ImageManifest = []Image

ImageManifest is a JSON list of images produced by the Fuchsia build.

type LogSettings

type LogSettings struct {
	// Max severity of logs produced by the test.
	MaxSeverity string `json:"max_severity,omitempty"`
}

type Modules

type Modules struct {
	// contains filtered or unexported fields
}

Modules is a convenience interface for accessing the various build API modules associated with a build.

For information about each build API module, see the corresponding `build_api_module` target in //BUILD.gn.

func NewModules

func NewModules(buildDir string) (*Modules, error)

NewModules returns a Modules associated with a given build directory.

func (Modules) APIs

func (m Modules) APIs() []string

APIs returns the build API module of available build API modules.

func (Modules) Archives

func (m Modules) Archives() []Archive

func (Modules) Args

func (m Modules) Args() Args

func (Modules) Binaries

func (m Modules) Binaries() []Binary

func (Modules) BuildDir

func (m Modules) BuildDir() string

BuildDir returns the fuchsia build directory root.

func (Modules) CheckoutArtifacts

func (m Modules) CheckoutArtifacts() []CheckoutArtifact

func (Modules) GeneratedSources

func (m Modules) GeneratedSources() []string

func (Modules) ImageManifest

func (m Modules) ImageManifest() string

ImageManifest returns the path to the images manifest.

func (Modules) Images

func (m Modules) Images() []Image

func (Modules) PackageManifests

func (m Modules) PackageManifests() []string

func (Modules) Platforms

func (m Modules) Platforms() []DimensionSet

Platforms returns the build API module of available platforms to test on.

func (Modules) PrebuiltBinarySets

func (m Modules) PrebuiltBinarySets() []PrebuiltBinarySet

PrebuiltBinarySets returns the build API module of prebuilt packages registered in the build.

func (Modules) SDKArchives

func (m Modules) SDKArchives() []SDKArchive

func (Modules) TestDurations

func (m Modules) TestDurations() []TestDuration

func (Modules) TestSpecs

func (m Modules) TestSpecs() []TestSpec

func (Modules) Tools

func (m Modules) Tools() Tools

func (Modules) ZBITests

func (m Modules) ZBITests() []ZBITest

type PrebuiltBinarySet

type PrebuiltBinarySet struct {
	// Name is the name of the set of prebuilt binaries.
	Name string `json:"package_name"`

	// Manifest is the path to a manifest of the associated debug binaries produced
	// by the build and in the format of binaries.json.
	Manifest string `json:"manifest"`
}

PrebuiltBinarySet represents a manifest referencing a set of prebuilt binaries.

func (*PrebuiltBinarySet) Get

func (pb *PrebuiltBinarySet) Get(buildDir string) ([]Binary, error)

Get returns the list of binaries in enumerated in the associated binary manifest. Returns os.ErrIsNotExist if the file does not exist.

type SDKArchive

type SDKArchive struct {
	// Name is the name of the SDK.
	Name string `json:"name"`

	// Label is the GN label of the associated `sdk` target. It does not include
	// the toolchain.
	Label string `json:"label"`

	// Path is the relative path to the archive within the build directory.
	Path string `json:"path"`

	// OS is the operating system which the SDK is built for. A value of "fuchsia"
	// indicates the SDK is host OS agnostic.
	OS string `json:"os"`

	// CPU is the CPU architecture which the SDK is built for.
	CPU string `json:"cpu"`
}

type Test

type Test struct {
	// Name is a human-readable identifier for this test. It should be unique
	// within any given TestSpec.
	Name string `json:"name"`

	// PackageURL is the fuchsia package URL for this test. It is only set for
	// tests targeting Fuchsia.
	PackageURL string `json:"package_url,omitempty"`

	// PackageLabel is the full GN label with toolchain of the fuchsia package
	// for this test.
	PackageLabel string `json:"package_label,omitempty"`

	// PackageManifests is a list of paths to manifests describing the
	// packages needed by the test. They are all relative to the build
	// directory.
	PackageManifests []string `json:"package_manifests,omitempty"`

	// Path is the path to the test on the target OS.
	Path string `json:"path"`

	// Label is the full GN label with toolchain for the test target.
	// E.g.: //src/foo/tests:foo_tests(//build/toolchain/fuchsia:x64)
	Label string `json:"label"`

	// OS is the operating system in which this test must be executed.
	OS string `json:"os"`

	// CPU architecture on which this test can execute.
	CPU string `json:"cpu"`

	// Settings of log produced by this test
	LogSettings LogSettings `json:"log_settings,omitempty"`

	// Number of test cases to run in parallel. This only works with v2 tests.
	Parallel uint16 `json:"parallel,omitempty"`

	// RuntimeDepsFile is a relative path within the build directory to a file
	// containing a JSON list of the test's runtime dependencies, Currently this
	// field only makes sense for Linux and Mac tests.
	RuntimeDepsFile string `json:"runtime_deps,omitempty"`
}

Test encapsulates details about a particular test.

type TestDuration

type TestDuration struct {
	Name           string `json:"name"`
	MedianDuration time.Duration
}

TestDuration encodes information about a test's running time. It implements the json.RawMessage interface for custom JSON decoding.

func (*TestDuration) MarshalJSON

func (d *TestDuration) MarshalJSON() ([]byte, error)

func (*TestDuration) UnmarshalJSON

func (d *TestDuration) UnmarshalJSON(data []byte) error

type TestSpec

type TestSpec struct {
	// Test is the test that this specification is for.
	Test `json:"test"`

	// Envs is a set of environments that the test should be executed in.
	Envs []Environment `json:"environments"`
}

TestSpec is the specification for a single test and the environments it should be executed in.

type Tool

type Tool struct {
	// Name is the canonical name of the image.
	Name string `json:"name"`

	// Path is relative path to the tool within the build directory.
	Path string `json:"path"`

	// OS is the operating system the tool is meant to run on.
	OS string `json:"os"`

	// CPU is the architecture the tool is meant to run on.
	CPU string `json:"cpu"`
}

Tool represents a host tool in the build.

type Tools

type Tools []Tool

func (Tools) LookupPath

func (t Tools) LookupPath(platform, name string) (string, error)

LookupPath returns the path (relative to the build directory) of the named tool built for the specified platform. It will return an error if the platform/tool combination cannot be found, generally because the platform is not supported or because the tool is not listed in tool_paths.json.

type ZBITest

type ZBITest struct {
	Name string `json:"name"`

	// Label is the label of the test's GN target.
	Label string `json:"label"`

	// Path is the path to the test's file within the build directory.
	Path string `json:"path"`

	// The list of device types that this test should be run on.
	DeviceTypes []string `json:"device_types"`

	// QEMUKernelLabel points to an override of the standard QEMU kernel.
	QEMUKernelLabel string `json:"qemu_kernel_label"`
}

Directories

Path Synopsis
fx-set
cmd
ninjago
buildstats
ninja_buildstats is an utility for extracting useful stats out of build artifacts from Ninja.
ninja_buildstats is an utility for extracting useful stats out of build artifacts from Ninja.
chrometrace
package chrometrace contains utilities for working with Chrome traces.
package chrometrace contains utilities for working with Chrome traces.
compdb
Package compdb provides compilation database parser.
Package compdb provides compilation database parser.
ninjagraph
ninjagraph provides utilities to parse the DOT output from Ninja's `-t graph` tool to a Go native format.
ninjagraph provides utilities to parse the DOT output from Ninja's `-t graph` tool to a Go native format.
ninjalog
Package ninjalog provides ninja_log parser It support ninja log v5.
Package ninjalog provides ninja_log parser It support ninja log v5.
ninjatrace/cmd
ninjatrace converts .ninja_log into trace-viewer formats.
ninjatrace converts .ninja_log into trace-viewer formats.
rbetrace
package rbetrace contains utilities for working with RBE traces.
package rbetrace contains utilities for working with RBE traces.

Jump to

Keyboard shortcuts

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