Command

Struct Command 

Source
pub struct Command {
    pub arguments: Vec<String>,
    pub environment_variables: Vec<EnvironmentVariable>,
    pub output_files: Vec<String>,
    pub output_directories: Vec<String>,
    pub output_paths: Vec<String>,
    pub platform: Option<Platform>,
    pub working_directory: String,
    pub output_node_properties: Vec<String>,
    pub output_directory_format: i32,
}
Expand description

A Command is the actual command executed by a worker running an [Action][build.bazel.remote.execution.v2.Action] and specifications of its environment.

Except as otherwise required, the environment (such as which system libraries or binaries are available, and what filesystems are mounted where) is defined by and specific to the implementation of the remote execution API.

Fields§

§arguments: Vec<String>

The arguments to the command.

The first argument specifies the command to run, which may be either an absolute path, a path relative to the working directory, or an unqualified path (without path separators) which will be resolved using the operating system’s equivalent of the PATH environment variable. Path separators native to the operating system running on the worker SHOULD be used. If the environment_variables list contains an entry for the PATH environment variable, it SHOULD be respected. If not, the resolution process is implementation-defined.

Changed in v2.3. v2.2 and older require that no PATH lookups are performed, and that relative paths are resolved relative to the input root. This behavior can, however, not be relied upon, as most implementations already followed the rules described above.

§environment_variables: Vec<EnvironmentVariable>

The environment variables to set when running the program. The worker may provide its own default environment variables; these defaults can be overridden using this field. Additional variables can also be specified.

In order to ensure that equivalent [Command][build.bazel.remote.execution.v2.Command]s always hash to the same value, the environment variables MUST be lexicographically sorted by name. Sorting of strings is done by code point, equivalently, by the UTF-8 bytes.

§output_files: Vec<String>
👎Deprecated

A list of the output files that the client expects to retrieve from the action. Only the listed files, as well as directories listed in output_directories, will be returned to the client as output. Other files or directories that may be created during command execution are discarded.

The paths are relative to the working directory of the action execution. The paths are specified using a single forward slash (/) as a path separator, even if the execution platform natively uses a different separator. The path MUST NOT include a trailing slash, nor a leading slash, being a relative path.

In order to ensure consistent hashing of the same Action, the output paths MUST be sorted lexicographically by code point (or, equivalently, by UTF-8 bytes).

An output file cannot be duplicated, be a parent of another output file, or have the same path as any of the listed output directories.

Directories leading up to the output files are created by the worker prior to execution, even if they are not explicitly part of the input root.

DEPRECATED since v2.1: Use output_paths instead.

§output_directories: Vec<String>
👎Deprecated

A list of the output directories that the client expects to retrieve from the action. Only the listed directories will be returned (an entire directory structure will be returned as a [Tree][build.bazel.remote.execution.v2.Tree] message digest, see [OutputDirectory][build.bazel.remote.execution.v2.OutputDirectory]), as well as files listed in output_files. Other files or directories that may be created during command execution are discarded.

The paths are relative to the working directory of the action execution. The paths are specified using a single forward slash (/) as a path separator, even if the execution platform natively uses a different separator. The path MUST NOT include a trailing slash, nor a leading slash, being a relative path. The special value of empty string is allowed, although not recommended, and can be used to capture the entire working directory tree, including inputs.

In order to ensure consistent hashing of the same Action, the output paths MUST be sorted lexicographically by code point (or, equivalently, by UTF-8 bytes).

An output directory cannot be duplicated or have the same path as any of the listed output files. An output directory is allowed to be a parent of another output directory.

Directories leading up to the output directories (but not the output directories themselves) are created by the worker prior to execution, even if they are not explicitly part of the input root.

DEPRECATED since 2.1: Use output_paths instead.

§output_paths: Vec<String>

A list of the output paths that the client expects to retrieve from the action. Only the listed paths will be returned to the client as output. The type of the output (file or directory) is not specified, and will be determined by the server after action execution. If the resulting path is a file, it will be returned in an [OutputFile][build.bazel.remote.execution.v2.OutputFile] typed field. If the path is a directory, the entire directory structure will be returned as a [Tree][build.bazel.remote.execution.v2.Tree] message digest, see [OutputDirectory][build.bazel.remote.execution.v2.OutputDirectory] Other files or directories that may be created during command execution are discarded.

The paths are relative to the working directory of the action execution. The paths are specified using a single forward slash (/) as a path separator, even if the execution platform natively uses a different separator. The path MUST NOT include a trailing slash, nor a leading slash, being a relative path.

In order to ensure consistent hashing of the same Action, the output paths MUST be deduplicated and sorted lexicographically by code point (or, equivalently, by UTF-8 bytes).

Directories leading up to the output paths are created by the worker prior to execution, even if they are not explicitly part of the input root.

New in v2.1: this field supersedes the DEPRECATED output_files and output_directories fields. If output_paths is used, output_files and output_directories will be ignored!

§platform: Option<Platform>
👎Deprecated

The platform requirements for the execution environment. The server MAY choose to execute the action on any worker satisfying the requirements, so the client SHOULD ensure that running the action on any such worker will have the same result. A detailed lexicon for this can be found in the accompanying platform.md. DEPRECATED as of v2.2: platform properties are now specified directly in the action. See documentation note in the [Action][build.bazel.remote.execution.v2.Action] for migration.

§working_directory: String

The working directory, relative to the input root, for the command to run in. It must be a directory which exists in the input tree. If it is left empty, then the action is run in the input root.

§output_node_properties: Vec<String>

A list of keys for node properties the client expects to retrieve for output files and directories. Keys are either names of string-based [NodeProperty][build.bazel.remote.execution.v2.NodeProperty] or names of fields in [NodeProperties][build.bazel.remote.execution.v2.NodeProperties]. In order to ensure that equivalent Actions always hash to the same value, the node properties MUST be lexicographically sorted by name. Sorting of strings is done by code point, equivalently, by the UTF-8 bytes.

The interpretation of string-based properties is server-dependent. If a property is not recognized by the server, the server will return an INVALID_ARGUMENT.

§output_directory_format: i32

The format that the worker should use to store the contents of output directories.

In case this field is set to a value that is not supported by the worker, the worker SHOULD interpret this field as TREE_ONLY. The worker MAY store output directories in formats that are a superset of what was requested (e.g., interpreting DIRECTORY_ONLY as TREE_AND_DIRECTORY).

Implementations§

Source§

impl Command

Source

pub fn output_directory_format(&self) -> OutputDirectoryFormat

Returns the enum value of output_directory_format, or the default if the field is set to an invalid enum value.

Source

pub fn set_output_directory_format(&mut self, value: OutputDirectoryFormat)

Sets output_directory_format to the provided enum value.

Trait Implementations§

Source§

impl Clone for Command

Source§

fn clone(&self) -> Command

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Command

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Command

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Message for Command

Source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
Source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
Source§

fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message to a buffer. Read more
Source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
Source§

fn encode_length_delimited( &self, buf: &mut impl BufMut, ) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
Source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
Source§

fn decode(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes an instance of the message from a buffer. Read more
Source§

fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes a length-delimited instance of the message from the buffer.
Source§

fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
Source§

fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
Source§

impl PartialEq for Command

Source§

fn eq(&self, other: &Command) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Command

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more