BuildInfo

public class BuildInfo
extends Object implements IBuildInfo

java.lang.Object
   ↳ com.android.tradefed.build.BuildInfo
Known Direct Subclasses
AppBuildInfo A IBuildInfo that represents an Android application and its test package(s). 
AppDeviceBuildInfo A IDeviceBuildInfo that also contains a IAppBuildInfo
DeviceBuildInfo A IBuildInfo that represents a complete Android device build and (optionally) its tests. 
DeviceFolderBuildInfo A IDeviceBuildInfo that also contains other build artifacts contained in a directory on the local filesystem. 
FolderBuildInfo Concrete implementation of a IFolderBuildInfo
KernelBuildInfo A IBuildInfo that represents a kernel build. 
KernelDeviceBuildInfo A IBuildInfo that represents a kernel build paired with a complete Android build. 
OtatoolsBuildInfo An IBuildInfo that contains otatools artifacts. 
SdkBuildInfo Implementation of a ISdkBuildInfo  
SdkFolderBuildInfo A IBuildInfo that represents an extracted Android SDK and tests and additional build artifacts that are contained in a local file system directory. 


Generic implementation of a IBuildInfo that should be associated with a ITestDevice.

Summary

Public constructors

BuildInfo()

Creates a BuildInfo using default attribute values.

BuildInfo(String buildId, String buildTargetName)

Creates a BuildInfo

BuildInfo(String buildId, String testTag, String buildTargetName)

This constructor is deprecated. use BuildInfo(String, String) instead. test-tag should not be mandatory when instantiating the build info.

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 setBuildId(String buildId)

Sets the unique identifier of build under test.

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.

void setTestTag(String testTag)

Sets the unique name for the tests being run.

String toString()

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()

Public constructors

BuildInfo

BuildInfo ()

Creates a BuildInfo using default attribute values.

BuildInfo

BuildInfo (String buildId, 
                String buildTargetName)

Creates a BuildInfo

Parameters
buildId String: the build id

buildTargetName String: the build target name

BuildInfo

BuildInfo (String buildId, 
                String testTag, 
                String buildTargetName)

This constructor is deprecated.
use BuildInfo(String, String) instead. test-tag should not be mandatory when instantiating the build info.

Creates a BuildInfo

Parameters
buildId String: the build id

testTag String: the test tag name

buildTargetName String: the build target name

Public methods

addBuildAttribute

void addBuildAttribute (String attributeName, 
                String attributeValue)

Add a build attribute

Parameters
attributeName String: the unique attribute name

attributeValue String: the attribute value

cleanUp

void cleanUp ()

Clean up any temporary build files

clone

IBuildInfo clone ()

Returns
IBuildInfo

equals

boolean equals (Object obj)

Parameters
obj Object

Returns
boolean

getBuildAttributes

Map<String, String> getBuildAttributes ()

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

Returns
Map<String, String> a Map of build attributes. Will not be null, but may be empty.

getBuildBranch

String getBuildBranch ()

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

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

getBuildFlavor

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
String the build flavor or null if unset/not applicable

getBuildId

String getBuildId ()

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

Returns
String

getBuildTargetName

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)]

Returns
String

getDeviceSerial

String getDeviceSerial ()

Returns
String

getFile

File getFile (String name)

Helper method to retrieve a file with given name.

Returns
File the image file or null if not found

getFiles

Collection<VersionedFile> getFiles ()

Returns all VersionedFiles stored in this BuildInfo.

Returns
Collection<VersionedFile>

getTestTag

String getTestTag ()

Return a unique name for the tests being run.

Returns
String

getVersion

String getVersion (String name)

Helper method to retrieve a file version with given name.

Returns
String the image version or null if not found

hashCode

int hashCode ()

Returns
int

setBuildBranch

void setBuildBranch (String branch)

Set the build branch

Parameters
branch String: the branch name

setBuildFlavor

void setBuildFlavor (String buildFlavor)

Set the build flavor.

setBuildId

void setBuildId (String buildId)

Sets the unique identifier of build under test. Should never be null.

Parameters
buildId String

setDeviceSerial

void setDeviceSerial (String serial)

Set the ITestDevice serial associated with this build.

Parameters
serial String: the serial number of the ITestDevice that this build was executed with.

setFile

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

Stores an file with given name in this build info.

Parameters
name String: the unique name of the file

file File: the local File

version String: the file version

setTestTag

void setTestTag (String testTag)

Sets the unique name for the tests being run.

Parameters
testTag String

toString

String toString ()

Returns
String

Protected methods

addAllBuildAttributes

void addAllBuildAttributes (BuildInfo build)

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

Parameters
build BuildInfo

addAllFiles

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.

Parameters
build BuildInfo

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

getAttributesMultiMap

MultiMap<String, String> getAttributesMultiMap ()

Returns
MultiMap<String, String>

getVersionedFileMap

Map<String, VersionedFile> getVersionedFileMap ()

Returns
Map<String, VersionedFile>