1 /*
2  * Copyright (C) 2010 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.android.cts.tradefed.build;
17 
18 import com.android.tradefed.build.FolderBuildInfo;
19 import com.android.tradefed.build.IBuildInfo;
20 import com.android.tradefed.build.IBuildProvider;
21 import com.android.tradefed.build.IFolderBuildInfo;
22 import com.android.tradefed.config.Option;
23 
24 import java.io.File;
25 
26 /**
27  * A simple {@link IBuildProvider} that uses a pre-existing CTS install.
28  */
29 public class CtsBuildProvider implements IBuildProvider {
30 
31     @Option(name="cts-install-path", description="the path to the cts installation to use")
32     private String mCtsRootDirPath = System.getProperty("CTS_ROOT");
33 
34     public static final String CTS_BUILD_VERSION = "6.0_r0";
35     public static final String CTS_PACKAGE = "com.android.cts.tradefed.testtype";
36 
37     /**
38      * {@inheritDoc}
39      */
40     @Override
getBuild()41     public IBuildInfo getBuild() {
42         if (mCtsRootDirPath == null) {
43             throw new IllegalArgumentException("Missing --cts-install-path");
44         }
45         IFolderBuildInfo ctsBuild = new FolderBuildInfo(
46             Package.getPackage(CTS_PACKAGE).getImplementationVersion(),
47             "cts", "cts");
48         ctsBuild.setRootDir(new File(mCtsRootDirPath));
49         return ctsBuild;
50     }
51 
52     /**
53      * {@inheritDoc}
54      */
55     @Override
buildNotTested(IBuildInfo info)56     public void buildNotTested(IBuildInfo info) {
57         // ignore
58     }
59 
60     /**
61      * {@inheritDoc}
62      */
63     @Override
cleanUp(IBuildInfo info)64     public void cleanUp(IBuildInfo info) {
65         // ignore
66     }
67 }
68