null if unset/not applicable
*/
public String getBuildBranch();
/**
* Set the build branch
*
* @param branch the branch name
*/
public void setBuildBranch(String branch);
/**
* Set the {@link ITestDevice} serial associated with this build.
*
* @param serial the serial number of the {@link ITestDevice} that this build was executed with.
*/
public void setDeviceSerial(String serial);
/**
* Get a set of name-value pairs of additional attributes describing the build.
*
* @return a {@link Map} of build attributes. Will not be null, but may be empty.
*/
public Map
null if not found
*/
public File getFile(String name);
/**
* Returns all {@link VersionedFile}s stored in this {@link BuildInfo}.
*/
public Collection
null if not found */ public String getVersion(String name); /** * Stores an file with given name in this build info. * * @param name the unique name of the file * @param file the local {@link File} * @param version the file version */ public void setFile(String name, File file, String version); /** * Clean up any temporary build files */ public void cleanUp(); /** * Clones the {@link IBuildInfo} object. */ public IBuildInfo clone(); }
该接口中定义了一些方法都是跟属性相关的,其实现在BuildInfo中。
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.tradefed.build;
import com.android.tradefed.log.LogUtil.CLog;
import com.android.tradefed.util.FileUtil;
import com.android.tradefed.util.MultiMap;
import com.android.tradefed.util.UniqueMultiMap;
import com.google.common.base.Objects;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.Hashtable;
import java.util.Map;
/**
* Generic implementation of a {@link IBuildInfo}.
*/
public class BuildInfo implements IBuildInfo {
private String mBuildId = "0";
private String mTestTag = "stub";
private String mBuildTargetName = "stub";
private final UniqueMultiMap
mBuildAttributes =
new UniqueMultiMap
(); private Map
mVersionedFileMap; private String mBuildFlavor = null; private String mBuildBranch = null; private String mDeviceSerial = null; /** * Creates a {@link BuildInfo} using default attribute values. */ public BuildInfo() { mVersionedFileMap = new Hashtable
(); } /** * Creates a {@link