aboutsummaryrefslogtreecommitdiff
path: root/builder-model
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2013-07-09 19:21:59 -0700
committerXavier Ducrohet <xav@android.com>2013-07-09 19:46:39 -0700
commit473f535dd9d590b59d11c0991e50a864ea217862 (patch)
treee8edcd4fac824556b99659513bc35c2b0a38b076 /builder-model
parent5f2139198856019ac919e3074b522e29b2248369 (diff)
downloadbuild-473f535dd9d590b59d11c0991e50a864ea217862.tar.gz
Refactor model in single library.
Nothing in gradle-model is gradle specific (besides the test) so move all the classes in builder-model. Also add javadoc everywhere, and rename BuildConfig into BaseConfig. Change-Id: Ib1d647e8259c3ecc675bd643118174da1257df5a
Diffstat (limited to 'builder-model')
-rw-r--r--builder-model/src/main/java/com/android/builder/model/AndroidLibrary.java6
-rw-r--r--builder-model/src/main/java/com/android/builder/model/AndroidProject.java124
-rw-r--r--builder-model/src/main/java/com/android/builder/model/ArtifactInfo.java117
-rw-r--r--builder-model/src/main/java/com/android/builder/model/BaseConfig.java (renamed from builder-model/src/main/java/com/android/builder/model/BuildConfig.java)9
-rw-r--r--builder-model/src/main/java/com/android/builder/model/BuildType.java58
-rw-r--r--builder-model/src/main/java/com/android/builder/model/BuildTypeContainer.java41
-rw-r--r--builder-model/src/main/java/com/android/builder/model/Dependencies.java54
-rw-r--r--builder-model/src/main/java/com/android/builder/model/ProductFlavor.java66
-rw-r--r--builder-model/src/main/java/com/android/builder/model/ProductFlavorContainer.java49
-rw-r--r--builder-model/src/main/java/com/android/builder/model/SigningConfig.java35
-rw-r--r--builder-model/src/main/java/com/android/builder/model/SourceProvider.java40
-rw-r--r--builder-model/src/main/java/com/android/builder/model/Variant.java103
12 files changed, 692 insertions, 10 deletions
diff --git a/builder-model/src/main/java/com/android/builder/model/AndroidLibrary.java b/builder-model/src/main/java/com/android/builder/model/AndroidLibrary.java
index 0510899..64ac011 100644
--- a/builder-model/src/main/java/com/android/builder/model/AndroidLibrary.java
+++ b/builder-model/src/main/java/com/android/builder/model/AndroidLibrary.java
@@ -23,13 +23,14 @@ import java.io.File;
import java.util.List;
/**
- * Represents an Android Library, its content and its own dependencies
+ * Represents an Android Library dependency, its content and its own dependencies
*/
public interface AndroidLibrary {
/**
* Returns the project identifier if the library is output
* by a module.
+ *
* @return the project identifier
*/
@Nullable
@@ -42,7 +43,7 @@ public interface AndroidLibrary {
File getBundle();
/**
- * Returns the location of the unzipped archive.
+ * Returns the location of the unzipped bundle folder.
*/
@NonNull
File getFolder();
@@ -63,6 +64,7 @@ public interface AndroidLibrary {
/**
* Returns the list of local Jar files that are included in the dependency.
+ *
* @return a list of File. May be empty but not null.
*/
@NonNull
diff --git a/builder-model/src/main/java/com/android/builder/model/AndroidProject.java b/builder-model/src/main/java/com/android/builder/model/AndroidProject.java
new file mode 100644
index 0000000..f3929e1
--- /dev/null
+++ b/builder-model/src/main/java/com/android/builder/model/AndroidProject.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2013 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.builder.model;
+
+import com.android.annotations.NonNull;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Entry point for the model of the Android Projects. This models a single module, whether
+ * the module is an app project or a library project.
+ */
+public interface AndroidProject {
+
+ /**
+ * Returns the model version. This is a string in the format X.Y.Z
+ *
+ * @return a string containing the model version.
+ */
+ @NonNull
+ String getModelVersion();
+
+ /**
+ * Returns the name of the module.
+ *
+ * @return the name of the module.
+ */
+ @NonNull
+ String getName();
+
+ /**
+ * Returns whether this is a library.
+ * @return true for a library module.
+ */
+ boolean isLibrary();
+
+ /**
+ * Returns the {@link ProductFlavorContainer} for the 'main' default config.
+ *
+ * @return the product flavor.
+ */
+ @NonNull
+ ProductFlavorContainer getDefaultConfig();
+
+ /**
+ * Returns a map of all the {@link BuildType} in their container. The key is the build type
+ * name as returned by {@link BuildType#getName()}
+ *
+ * @return a map of build type containers.
+ */
+ @NonNull
+ Map<String, BuildTypeContainer> getBuildTypes();
+
+ /**
+ * Returns a map of all the {@link ProductFlavor} in their container. The key is the product
+ * flavor name as returned by {@link ProductFlavor#getName()}
+ *
+ * @return a map of product flavor containers.
+ */
+ @NonNull
+ Map<String, ProductFlavorContainer> getProductFlavors();
+
+ /**
+ * Returns a map of all the variants. The key is the variant name as returned by
+ * {@link Variant#getName()}.
+ *
+ * This does not include test variant. Instead the variant and its component each contribute
+ * their test part.
+ *
+ * @return a map of the variants.
+ */
+ @NonNull
+ Map<String, Variant> getVariants();
+
+ /**
+ * Returns the compilation target as a string. This is the full extended target hash string.
+ * (see com.android.sdklib.IAndroidTarget#hashString())
+ *
+ * @return the target hash string
+ */
+ @NonNull
+ String getCompileTarget();
+
+ /**
+ * Returns the boot classpath matching the compile target. This is typically android.jar plus
+ * other optional libraries.
+ *
+ * @return a list of jar files.
+ */
+ @NonNull
+ List<String> getBootClasspath();
+
+ /**
+ * Returns a map of {@link SigningConfig}. The key is the signing config name as returned by
+ * {@link SigningConfig#getName()}
+ *
+ * @return a map of signing config
+ */
+ @NonNull
+ Map<String, SigningConfig> getSigningConfigs();
+
+ /**
+ * Returns the aapt options.
+ *
+ * @return the aapt options.
+ */
+ @NonNull
+ AaptOptions getAaptOptions();
+}
diff --git a/builder-model/src/main/java/com/android/builder/model/ArtifactInfo.java b/builder-model/src/main/java/com/android/builder/model/ArtifactInfo.java
new file mode 100644
index 0000000..4a68755
--- /dev/null
+++ b/builder-model/src/main/java/com/android/builder/model/ArtifactInfo.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2013 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.builder.model;
+
+import com.android.annotations.NonNull;
+import com.android.annotations.Nullable;
+
+import java.io.File;
+import java.util.List;
+
+/**
+ * The information for a generated artifact.
+ */
+public interface ArtifactInfo {
+
+ /**
+ * Returns the output file for this artifact. Depending on whether the project is an app
+ * or a library project, this could be an apk or an aar file.
+ *
+ * For test artifact for a library project, this would also be an apk.
+ *
+ * @return the output file.
+ */
+ @NonNull
+ File getOutputFile();
+
+ /**
+ * Returns whether the output file is signed. This is always false for the main artifact
+ * of a library project.
+ *
+ * @return true if the app is signed.
+ */
+ boolean isSigned();
+
+ /**
+ * Returns the name of the {@link SigningConfig} used for the signing. If none are setup or
+ * if this is the main artifact of a library project, then this is null.
+ *
+ * @return the name of the setup signing config.
+ */
+ @Nullable
+ String getSigningConfigName();
+
+ /**
+ * Returns the package name of this artifact.
+ *
+ * @return the package name.
+ */
+ @NonNull
+ String getPackageName();
+
+ /**
+ * Returns the name of the task used to generate the source code. The actual value might
+ * depend on the build system front end.
+ *
+ * @return the name of the code generating task.
+ */
+ @NonNull
+ String getSourceGenTaskName();
+
+ /**
+ * Returns the name of the task used to generate the artifact.
+ *
+ * @return the name of the task.
+ */
+ @NonNull
+ String getAssembleTaskName();
+
+ /**
+ * Returns all the source folders that are generated. This is typically folders for the R,
+ * the aidl classes, and the renderscript classes.
+ *
+ * @return a list of folders.
+ */
+ @NonNull
+ List<File> getGeneratedSourceFolders();
+
+ /**
+ * Returns all the resource folders that are generated. This is typically the renderscript
+ * output and the merged resources.
+ *
+ * @return a list of folder.
+ */
+ @NonNull
+ List<File> getGeneratedResourceFolders();
+
+ /**
+ * Returns the folder containing the class files. This is the output of the java compilation.
+ *
+ * @return a folder.
+ */
+ @NonNull
+ File getClassesFolder();
+
+ /**
+ * Returns the resolved dependencies for this artifact. This is a composite of all the
+ * dependencies for that artifact: default config + build type + flavor(s).s
+ *
+ * @return The dependencies.
+ */
+ @NonNull
+ Dependencies getDependencies();
+}
diff --git a/builder-model/src/main/java/com/android/builder/model/BuildConfig.java b/builder-model/src/main/java/com/android/builder/model/BaseConfig.java
index 6c1c353..e876d17 100644
--- a/builder-model/src/main/java/com/android/builder/model/BuildConfig.java
+++ b/builder-model/src/main/java/com/android/builder/model/BaseConfig.java
@@ -21,9 +21,9 @@ import com.android.annotations.NonNull;
import java.util.List;
/**
- * An object that contain a BuildConfig configuration
+ * Base config object for Build Type and Product flavor.
*/
-public interface BuildConfig {
+public interface BaseConfig {
/**
* List of Build Config lines.
@@ -32,6 +32,11 @@ public interface BuildConfig {
@NonNull
List<String> getBuildConfig();
+ /**
+ * Returns the list of proguard rule files.
+ *
+ * @return a non-null list of files.
+ */
@NonNull
List<Object> getProguardFiles();
}
diff --git a/builder-model/src/main/java/com/android/builder/model/BuildType.java b/builder-model/src/main/java/com/android/builder/model/BuildType.java
index 99202fe..33d9ada 100644
--- a/builder-model/src/main/java/com/android/builder/model/BuildType.java
+++ b/builder-model/src/main/java/com/android/builder/model/BuildType.java
@@ -20,29 +20,81 @@ import com.android.annotations.NonNull;
import com.android.annotations.Nullable;
/**
- * a Build Type.
+ * a Build Type. This is only the configuration of the build type.
*
- * TODO add signing config
+ * It does not include the sources or the dependencies. Those are available on the container
+ * or in the artifact info.
+ *
+ * @see BuildTypeContainer
+ * @see ArtifactInfo#getDependencies()
*/
-public interface BuildType extends BuildConfig {
+public interface BuildType extends BaseConfig {
+
+ /**
+ * Returns the name of the build type.
+ *
+ * @return the name of the build type.
+ */
@NonNull
String getName();
+ /**
+ * Returns whether the build type is configured to generate a debuggable apk.
+ *
+ * @return true if the apk is debuggable
+ */
boolean isDebuggable();
+ /**
+ * Returns whether the build type is configured to generate an apk with debuggable native code.
+ *
+ * @return true if the apk is debuggable
+ */
boolean isJniDebugBuild();
+ /**
+ * Returns whether the build type is configured to generate an apk with debuggable
+ * renderscript code.
+ *
+ * @return true if the apk is debuggable
+ */
boolean isRenderscriptDebugBuild();
+ /**
+ * Returns the optimization level of the renderscript compilation.
+ *
+ * @return the optimization level.
+ */
int getRenderscriptOptimLevel();
+ /**
+ * Returns the package name suffix applied to this build type.
+ * To get the final package name, use {@link ArtifactInfo#getPackageName()}.
+ *
+ * @return the package name suffix.
+ */
@Nullable
String getPackageNameSuffix();
+ /**
+ * Returns the version name suffix.
+ *
+ * @return the version name suffix.
+ */
@Nullable
String getVersionNameSuffix();
+ /**
+ * Returns whether proguard is enabled for this build type.
+ *
+ * @return true if proguard is enabled.
+ */
boolean isRunProguard();
+ /**
+ * Return whether zipalign is enabled for this build type.
+ *
+ * @return true if zipalign is enabled.
+ */
boolean isZipAlign();
}
diff --git a/builder-model/src/main/java/com/android/builder/model/BuildTypeContainer.java b/builder-model/src/main/java/com/android/builder/model/BuildTypeContainer.java
new file mode 100644
index 0000000..4a0170d
--- /dev/null
+++ b/builder-model/src/main/java/com/android/builder/model/BuildTypeContainer.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2013 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.builder.model;
+
+import com.android.annotations.NonNull;
+
+/**
+ * A Container of all the data related to {@link BuildType}.
+ */
+public interface BuildTypeContainer {
+
+ /**
+ * The Build Type itself.
+ *
+ * @return the build type
+ */
+ @NonNull
+ BuildType getBuildType();
+
+ /**
+ * The associated sources of the build type.
+ *
+ * @return the build type source provider.
+ */
+ @NonNull
+ SourceProvider getSourceProvider();
+}
diff --git a/builder-model/src/main/java/com/android/builder/model/Dependencies.java b/builder-model/src/main/java/com/android/builder/model/Dependencies.java
new file mode 100644
index 0000000..b5a27d1
--- /dev/null
+++ b/builder-model/src/main/java/com/android/builder/model/Dependencies.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2013 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.builder.model;
+
+import com.android.annotations.NonNull;
+
+import java.io.File;
+import java.util.List;
+
+/**
+ * A set of dependencies for an {@link ArtifactInfo}.
+ */
+public interface Dependencies {
+
+ /**
+ * The list of Android library dependencies. This includes both modules and external
+ * dependencies.
+ *
+ * @return the list of libraries.
+ */
+ @NonNull
+ List<AndroidLibrary> getLibraries();
+
+ /**
+ * The list of jar dependencies. This only includes external dependencies.
+ *
+ * @return the list of jar files.
+ */
+ @NonNull
+ List<File> getJars();
+
+ /**
+ * The list of project dependencies. This is only for non Android module dependencies (which
+ * right now is Java-only modules).
+ *
+ * @return the list of projects.
+ */
+ @NonNull
+ List<String> getProjects();
+}
diff --git a/builder-model/src/main/java/com/android/builder/model/ProductFlavor.java b/builder-model/src/main/java/com/android/builder/model/ProductFlavor.java
index a80bc39..f1a6d16 100644
--- a/builder-model/src/main/java/com/android/builder/model/ProductFlavor.java
+++ b/builder-model/src/main/java/com/android/builder/model/ProductFlavor.java
@@ -20,31 +20,91 @@ import com.android.annotations.NonNull;
import com.android.annotations.Nullable;
/**
- * a Product Flavor
+ * a Product Flavor. This is only the configuration of the flavor.
*
- * TODO add signing config
+ * It does not include the sources or the dependencies. Those are available on the container
+ * or in the artifact info.
+ *
+ * @see ProductFlavorContainer
+ * @see ArtifactInfo#getDependencies()
*/
-public interface ProductFlavor extends BuildConfig {
+public interface ProductFlavor extends BaseConfig {
+
+ /**
+ * Returns the name of the flavor.
+ *
+ * @return the name of the flavor.
+ */
@NonNull
String getName();
+ /**
+ * Returns the name of the product flavor. This is only the value set on this product flavor.
+ * To get the final package name, use {@link ArtifactInfo#getPackageName()}.
+ *
+ * @return the package name.
+ */
@Nullable
String getPackageName();
+ /**
+ * Returns the version code. This is only the value set on this product flavor.
+ * To get the final value, use {@link Variant#getMergedFlavor()}
+ *
+ * @return the version code
+ */
int getVersionCode();
+ /**
+ * Returns the version name. This is only the value set on this product flavor.
+ * To get the final value, use {@link Variant#getMergedFlavor()} as well as
+ * {@link BuildType#getVersionNameSuffix()}
+ *
+ * @return the version name.
+ */
@Nullable
String getVersionName();
+ /**
+ * Returns the minSdkVersion. This is only the value set on this product flavor.
+ * TODO: make final minSdkVersion available through the model
+ *
+ * @return the minSdkVersion
+ */
int getMinSdkVersion();
+ /**
+ * Returns the targetSdkVersion. This is only the value set on this product flavor.
+ * TODO: make final targetSdkVersion available through the model
+ *
+ * @return the targetSdkVersion
+ */
int getTargetSdkVersion();
+ /**
+ * Returns the renderscript target api. This is only the value set on this product flavor.
+ * TODO: make final renderscript target api available through the model
+ *
+ * @return the renderscript target api
+ */
int getRenderscriptTargetApi();
+ /**
+ * Returns the test package name. This is only the value set on this product flavor.
+ * To get the final value, use {@link Variant#getTestArtifactInfo()} and
+ * {@link ArtifactInfo#getPackageName()}
+ *
+ * @return the test package name.
+ */
@Nullable
String getTestPackageName();
+ /**
+ * Returns the test package name. This is only the value set on this product flavor.
+ * TODO: make test instrumentation runner available through the model.
+ *
+ * @return the test package name.
+ */
@Nullable
String getTestInstrumentationRunner();
}
diff --git a/builder-model/src/main/java/com/android/builder/model/ProductFlavorContainer.java b/builder-model/src/main/java/com/android/builder/model/ProductFlavorContainer.java
new file mode 100644
index 0000000..f8cc7ed
--- /dev/null
+++ b/builder-model/src/main/java/com/android/builder/model/ProductFlavorContainer.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2013 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.builder.model;
+
+import com.android.annotations.NonNull;
+
+/**
+ * A Container of all the data related to {@link ProductFlavor}.
+ */
+public interface ProductFlavorContainer {
+
+ /**
+ * The Product Flavor itself.
+ *
+ * @return the product flavor
+ */
+ @NonNull
+ ProductFlavor getProductFlavor();
+
+ /**
+ * The associated main sources of the product flavor
+ *
+ * @return the main source provider.
+ */
+ @NonNull
+ SourceProvider getSourceProvider();
+
+ /**
+ * The associated test sources of the product flavor
+ *
+ * @return the test source provider.
+ */
+ @NonNull
+ SourceProvider getTestSourceProvider();
+}
diff --git a/builder-model/src/main/java/com/android/builder/model/SigningConfig.java b/builder-model/src/main/java/com/android/builder/model/SigningConfig.java
index ebfb7e0..99aedf3 100644
--- a/builder-model/src/main/java/com/android/builder/model/SigningConfig.java
+++ b/builder-model/src/main/java/com/android/builder/model/SigningConfig.java
@@ -26,23 +26,58 @@ import java.io.File;
*/
public interface SigningConfig {
+ /**
+ * Returns the name of the Signing config
+ *
+ * @return the name of the config
+ */
@NonNull
public String getName();
+ /**
+ * Returns the keystore file.
+ *
+ * @return the file.
+ */
@Nullable
File getStoreFile();
+ /**
+ * Returns the keystore password.
+ *
+ * @return the password.
+ */
@Nullable
String getStorePassword();
+ /**
+ * Returns the key alias name.
+ *
+ * @return the key alias name.
+ */
@Nullable
String getKeyAlias();
+ /**
+ * return the key password.
+ *
+ * @return the password.
+ */
@Nullable
String getKeyPassword();
+ /**
+ * Returns the store type.
+ *
+ * @return the store type.
+ */
@Nullable
String getStoreType();
+ /**
+ * Returns whether the config is fully configured for signing.
+ *
+ * @return true if all the required information are present.
+ */
boolean isSigningReady();
}
diff --git a/builder-model/src/main/java/com/android/builder/model/SourceProvider.java b/builder-model/src/main/java/com/android/builder/model/SourceProvider.java
index 0ae4d77..7ed06ef 100644
--- a/builder-model/src/main/java/com/android/builder/model/SourceProvider.java
+++ b/builder-model/src/main/java/com/android/builder/model/SourceProvider.java
@@ -27,27 +27,67 @@ import java.util.Set;
*/
public interface SourceProvider {
+ /**
+ * Returns the manifest file.
+ *
+ * @return the manifest file. It may not exist.
+ */
@NonNull
File getManifestFile();
+ /**
+ * Returns the java source folders.
+ *
+ * @return a list of folders. They may not all exist.
+ */
@NonNull
Set<File> getJavaDirectories();
+ /**
+ * Returns the java resources folders.
+ *
+ * @return a list of folders. They may not all exist.
+ */
@NonNull
Set<File> getResourcesDirectories();
+ /**
+ * Returns the aidl source folders.
+ *
+ * @return a list of folders. They may not all exist.
+ */
@NonNull
Set<File> getAidlDirectories();
+ /**
+ * Returns the renderscript source folders.
+ *
+ * @return a list of folders. They may not all exist.
+ */
@NonNull
Set<File> getRenderscriptDirectories();
+ /**
+ * Returns the jni source folders.
+ *
+ * @return a list of folders. They may not all exist.
+ */
@NonNull
Set<File> getJniDirectories();
+ /**
+ * Returns the android resources folders.
+ *
+ * @return a list of folders. They may not all exist.
+ */
@NonNull
Set<File> getResDirectories();
+ /**
+ * Returns the android assets folders.
+ *
+ * @return a list of folders. They may not all exist.
+ */
@NonNull
Set<File> getAssetsDirectories();
}
diff --git a/builder-model/src/main/java/com/android/builder/model/Variant.java b/builder-model/src/main/java/com/android/builder/model/Variant.java
new file mode 100644
index 0000000..21ef33e
--- /dev/null
+++ b/builder-model/src/main/java/com/android/builder/model/Variant.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2013 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.builder.model;
+
+import com.android.annotations.NonNull;
+import com.android.annotations.Nullable;
+
+import java.util.List;
+
+/**
+ * A build Variant.
+ */
+public interface Variant {
+
+ /**
+ * Returns the name of the variant. It is made up of the build type and flavors (if applicable)
+ *
+ * @return the name of the variant.
+ */
+ @NonNull
+ String getName();
+
+ /**
+ * Returns a display name for the variant. It is made up of the build type and flavors
+ * (if applicable)
+ *
+ * @return the name.
+ */
+ @NonNull
+ String getDisplayName();
+
+ /**
+ * Returns the main artifact for this variant.
+ *
+ * @return the artifact.
+ */
+ @NonNull
+ ArtifactInfo getMainArtifactInfo();
+
+ /**
+ * Returns the test artifact for this variant. This may be null if this particular variant
+ * is not configured to be tested.
+ *
+ * @return the test artifact.
+ */
+ @Nullable
+ ArtifactInfo getTestArtifactInfo();
+
+ /**
+ * Returns the build type. All variants have a build type, so this is never null.
+ *
+ * @return the name of the build type.
+ */
+ @NonNull
+ String getBuildType();
+
+ /**
+ * Returns the flavors for this variants. This can be empty if no flavors are configured.
+ *
+ * @return a list of flavors which can be empty.
+ */
+ @NonNull
+ List<String> getProductFlavors();
+
+ /**
+ * The result of the merge of all the flavors and of the main default config. If no flavors
+ * are defined then this is the same as the default config.
+ *
+ * This is directly a ProductFlavor instance of a ProdutFlavorContainer since this a composite
+ * of existing ProductFlavors.
+ *
+ * @return the merged flavors.
+ *
+ * @see AndroidProject#getDefaultConfig()
+ */
+ @NonNull
+ ProductFlavor getMergedFlavor();
+
+ /**
+ * Returns the resource configuration for this variant.
+ * TODO implement this.
+ *
+ * This is the list of -c parameters for aapt.
+ *
+ * @return the resource configuration options.
+ */
+ @NonNull
+ List<String> getResourceConfigurations();
+}