public class

BuildInfo

extends Object
implements IBuildInfo
java.lang.Object
   ↳ com.android.tradefed.build.BuildInfo
Known Direct Subclasses

Class Overview

Generic implementation of a IBuildInfo.

Summary

[Expand]
Inherited Constants
From interface com.android.tradefed.build.IBuildInfo
Public Constructors
BuildInfo()
Creates a BuildInfo using default attribute values.
BuildInfo(String buildId, String testTag, String buildTargetName)
Creates a BuildInfo
Public Methods
void addBuildAttribute(String attributeName, String attributeValue)
Add a build attribute
void cleanUp()
Clean up any temporary build files
IBuildInfo clone()
boolean equals(Object obj)
Map<String, String> getBuildAttributes()
Get a set of name-value pairs of additional attributes describing the build.
String getBuildBranch()
Optional method to return the source control branch that the build being tested was produced from.
String getBuildFlavor()
Optional method to return the type of build being tested.
String getBuildId()
Returns the unique identifier of build under test.
String getBuildTargetName()
Return complete name for the build being tested.
String getDeviceSerial()
File getFile(String name)
Helper method to retrieve a file with given name.
Collection<VersionedFile> getFiles()
Returns all VersionedFiles stored in this BuildInfo.
String getTestTag()
Return a unique name for the tests being run.
String getVersion(String name)
Helper method to retrieve a file version with given name.
int hashCode()
void setBuildBranch(String branch)
Set the build branch
void setBuildFlavor(String buildFlavor)
Set the build flavor.
void setDeviceSerial(String serial)
Set the ITestDevice serial associated with this build.
void setFile(String name, File file, String version)
Stores an file with given name in this build info.
Protected Methods
void addAllBuildAttributes(BuildInfo build)
Helper method to copy build attributes, branch, and flavor from other build.
void addAllFiles(BuildInfo build)
Helper method to copy all files from the other build.
MultiMap<String, String> getAttributesMultiMap()
Map<String, VersionedFile> getVersionedFileMap()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.android.tradefed.build.IBuildInfo

Public Constructors

public BuildInfo ()

Creates a BuildInfo using default attribute values.

public BuildInfo (String buildId, String testTag, String buildTargetName)

Creates a BuildInfo

Parameters
buildId the build id
testTag the test tag name
buildTargetName the build target name

Public Methods

public void addBuildAttribute (String attributeName, String attributeValue)

Add a build attribute

Parameters
attributeName the unique attribute name
attributeValue the attribute value

public void cleanUp ()

Clean up any temporary build files

public IBuildInfo clone ()

public boolean equals (Object obj)

public Map<String, String> getBuildAttributes ()

Get a set of name-value pairs of additional attributes describing the build.

Returns
  • a Map of build attributes. Will not be null, but may be empty.

public String getBuildBranch ()

Optional method to return the source control branch that the build being tested was produced from.

Returns
  • the build branch or null if unset/not applicable

public String getBuildFlavor ()

Optional method to return the type of build being tested.

A common implementation for Android platform builds is to return (build product)-(build os)-(build variant). ie generic-linux-userdebug

Returns
  • the build flavor or null if unset/not applicable

public String getBuildId ()

Returns the unique identifier of build under test. Should never be null. Defaults to UNKNOWN_BUILD_ID.

public String getBuildTargetName ()

Return complete name for the build being tested.

A common implementation is to construct the build target name from a combination of the build flavor and branch name. [ie (branch name)-(build flavor)]

public String getDeviceSerial ()

public File getFile (String name)

Helper method to retrieve a file with given name.

Returns
  • the image file or null if not found

public Collection<VersionedFile> getFiles ()

Returns all VersionedFiles stored in this BuildInfo.

public String getTestTag ()

Return a unique name for the tests being run.

public String getVersion (String name)

Helper method to retrieve a file version with given name.

Returns
  • the image version or null if not found

public int hashCode ()

public void setBuildBranch (String branch)

Set the build branch

Parameters
branch the branch name

public void setBuildFlavor (String buildFlavor)

Set the build flavor.

public void setDeviceSerial (String serial)

Set the ITestDevice serial associated with this build.

Parameters
serial the serial number of the ERROR(/ITestDevice) that this build was executed with.

public void setFile (String name, File file, String version)

Stores an file with given name in this build info.

Parameters
name the unique name of the file
file the local File
version the file version

Protected Methods

protected void addAllBuildAttributes (BuildInfo build)

Helper method to copy build attributes, branch, and flavor from other build.

protected void addAllFiles (BuildInfo build)

Helper method to copy all files from the other build.

Creates new hardlinks to the files so that each build will have a unique file path to the file.

Throws
IOException if an exception is thrown when creating the hardlinks.

protected MultiMap<String, String> getAttributesMultiMap ()

protected Map<String, VersionedFile> getVersionedFileMap ()