IBuildProvider接口中定义了三个方法
/*
* 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;
/**
* Responsible for providing info regarding the build under test.
*/
public interface IBuildProvider {
/**
* Retrieve the data for build under test.
*
* @return the {@link IBuildInfo} for build under test or null if no build is
* available for testing
* @throws BuildRetrieva lError if build info failed to be retrieved due to an unexpected error
*/
public IBuildInfo getBuild() throws BuildRetrieva lError;
/**
* Mark the given build as untested.
*
* Called in cases where TradeFederation has failed to complete testing on the build due to an
* environment problem.
*
* @param info the {@link IBuildInfo} to reset
*/
public void buildNotTested(IBuildInfo info);
/**
* Clean up any temporary build files.
*/
public void cleanUp(IBuildInfo info);
}
该类主要是为了提供IBuildInfo信息的。所以目光转到IBuildInfo接口中:
/*
* 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.device.ITestDevice;
import java.io.File;
import java.util.Collection;
import java.util.Map;
/**
* Holds information about the build under test.
*/
public interface IBuildInfo {
/**
* Default value when build ID is unknown.
*/
public final static String UNKNOWN_BUILD_ID = "-1";
/**
* Returns the unique identifier of build under test. Should never be null. Defaults to
* {@link #UNKNOWN_BUILD_ID}.
*/
public String getBuildId();
/**
* Return a unique name for the tests being run.
*/
public String getTestTag();
/**
* 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 getBuildTargetName();
/**
* 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
*
* @return the build flavor or null if unset/not applicable
*/
public String getBuildFlavor();
/**
* @return the {@link ITestDevice} serial that this build was executed on. Returns null
* if no device is associated with this build.
*/
public String getDeviceSerial();
/**
* Set the build flavor.
*
* @param buildF