Groovy Documentation

com.jcandksolutions.gradle.androidunittest
[Groovy] Class VariantWrapper

java.lang.Object
  com.jcandksolutions.gradle.androidunittest.VariantWrapper

abstract class VariantWrapper

Base class that wraps the info of the variant for easier retrieval of the actual data needed.


Field Summary
protected Configuration mConfiguration

protected ConfigurationContainer mConfigurations

protected Logger mLogger

protected Project mProject

protected TestVariant mTestVariant

protected java.util.ArrayList mTestsSourcePath

protected BaseVariant mVariant

 
Constructor Summary
VariantWrapper(BaseVariant variant, Project project, ConfigurationContainer configurations, java.lang.String bootClasspath, Logger logger, TestVariant testVariant)

Instantiates a new VariantWrapper.

 
Method Summary
void configureSourceSet()

Configures the SourceSet with the Sourcepath, Classpath and Runpath.

protected java.lang.String createRealMergedResourcesDirName()

Creates the path string where the resources are merged by the Android plugin.

Task getAndroidCompileTask()

Returns the compile task of the app's sources.

BaseVariant getBaseVariant()

Retrieves the Base variant of the Android plugin that this is wrapping.

protected java.lang.String getBuildTypeName()

Retrieves the build type of the variant.

FileCollection getClasspath()

Retrieves the Classpath used to compile the tests which includes the testCompile configuration, the app's class files, the app's classpath and a configuration for each flavor.

java.io.File getCompileDestinationDir()

Retrieves the path for the destination of the test's compilation.

groovy.lang.GString getCompleteName()

Retrieves the complete name of the variant which is the concatenation of the flavors plus the buildType.

Configuration getConfiguration()

Retrieves a configuration for the test variant based on the list of configurations that this variant uses.

java.lang.String getDirName()

Retrieves the dir name of the variant.

protected java.util.List getFlavorList()

Retrieves a list of the flavors of the variant.

protected java.lang.String getFlavorName()

Retrieves the concatenated name of all the flavors.

java.io.File getMergedAssetsDir()

Retrieves the output dir of the mergeAssets task.

java.io.File getMergedManifest()

Retrieves the path of the merged manifest of the variant.

java.io.File getMergedResourcesDir()

Retrieves the path where the merged resources are copied.

java.lang.String getProcessResourcesTaskName()

Retrieves the name of the task that process the test resources.

java.lang.String getRealMergedResourcesDir()

Retrieves the path string where the resources are merged by the Android plugin.

java.lang.String getResourcesCopyTaskName()

Retrieves the ResourcesCopyTask name.

protected FileCollection getRunPath()

Retrieves the Runpath which includes the classpath, the processsed resources and the destination dir of the compilation, that is, where the tests' class files are.

protected SourceSet getSourceSet()

Returns the test SourceSet for this variant.

FileCollection getTestClasspath()

Retrieves the classpath for the Test task.

protected java.util.ArrayList getTestsSourcePath()

Retrieves the sourcepath for the tests of this variant.

java.io.File getVariantReportDestination()

Retrieves the report destination dir where this variant's test results should go to.

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Field Detail

mConfiguration

protected Configuration mConfiguration


mConfigurations

protected final ConfigurationContainer mConfigurations


mLogger

protected final Logger mLogger


mProject

protected final Project mProject


mTestVariant

protected final TestVariant mTestVariant


mTestsSourcePath

protected java.util.ArrayList mTestsSourcePath


mVariant

protected final BaseVariant mVariant


 
Constructor Detail

VariantWrapper

VariantWrapper(BaseVariant variant, Project project, ConfigurationContainer configurations, java.lang.String bootClasspath, Logger logger, TestVariant testVariant)
Instantiates a new VariantWrapper.
Parameters:
variant - The Variant to wrap.
project - The project.
configurations - The Project Configurations.
bootClasspath - The bootClasspath.
logger - The Logger.
testVariant - The Test Variant of the variant. Can be null for library projects.


 
Method Detail

configureSourceSet

void configureSourceSet()
Configures the SourceSet with the Sourcepath, Classpath and Runpath.


createRealMergedResourcesDirName

protected java.lang.String createRealMergedResourcesDirName()
Creates the path string where the resources are merged by the Android plugin.
Returns:
The path string.


getAndroidCompileTask

Task getAndroidCompileTask()
Returns the compile task of the app's sources.
Returns:
the compile task of the app's sources


getBaseVariant

BaseVariant getBaseVariant()
Retrieves the Base variant of the Android plugin that this is wrapping.
Returns:
The Base variant.


getBuildTypeName

protected java.lang.String getBuildTypeName()
Retrieves the build type of the variant.
For example: Debug.
Returns:
The build type.


getClasspath

FileCollection getClasspath()
Retrieves the Classpath used to compile the tests which includes the testCompile configuration, the app's class files, the app's classpath and a configuration for each flavor.
Returns:
The classpath.


getCompileDestinationDir

java.io.File getCompileDestinationDir()
Retrieves the path for the destination of the test's compilation.
For example: build/test-classes/freeBeta/debug.
Returns:
The destination dir.


getCompleteName

groovy.lang.GString getCompleteName()
Retrieves the complete name of the variant which is the concatenation of the flavors plus the buildType. For example: FreeBetaDebug.
Returns:
The complete name.


getConfiguration

Configuration getConfiguration()
Retrieves a configuration for the test variant based on the list of configurations that this variant uses. Which are the build type configuration and a configuration for each flavor.
For example: testDebugCompile, testFreeCompile and testBetaCompile.
Returns:
The configuration for the test variant.


getDirName

java.lang.String getDirName()
Retrieves the dir name of the variant.
For example: freeBeta/debug.
Returns:
The dir name of the variant.


getFlavorList

protected java.util.List getFlavorList()
Retrieves a list of the flavors of the variant.
Returns:
The list of flavors. Empty if no flavors defined.


getFlavorName

protected java.lang.String getFlavorName()
Retrieves the concatenated name of all the flavors.
For example: FreeBeta.
Returns:
The flavor name.


getMergedAssetsDir

java.io.File getMergedAssetsDir()
Retrieves the output dir of the mergeAssets task. This has the merged assets of the variant.
Returns:
The merged assets dir.


getMergedManifest

java.io.File getMergedManifest()
Retrieves the path of the merged manifest of the variant.
Returns:
The path.


getMergedResourcesDir

java.io.File getMergedResourcesDir()
Retrieves the path where the merged resources are copied. Usually in build/test-resources/$variantName/res.
Returns:
The dir with the copied merged resources.


getProcessResourcesTaskName

java.lang.String getProcessResourcesTaskName()
Retrieves the name of the task that process the test resources.
For example: processTestFreeBetaDebugResources.
Returns:
The name of the task.


getRealMergedResourcesDir

java.lang.String getRealMergedResourcesDir()
Retrieves the path string where the resources are merged by the Android plugin.
Returns:
The path string.


getResourcesCopyTaskName

java.lang.String getResourcesCopyTaskName()
Retrieves the ResourcesCopyTask name.
For example: copyFreeNormalDebugTestResources.
Returns:
The ResourcesCopyTaskName.


getRunPath

protected FileCollection getRunPath()
Retrieves the Runpath which includes the classpath, the processsed resources and the destination dir of the compilation, that is, where the tests' class files are.
Returns:
The Runpath.


getSourceSet

protected SourceSet getSourceSet()
Returns the test SourceSet for this variant.
Returns:
The test SourceSet.


getTestClasspath

FileCollection getTestClasspath()
Retrieves the classpath for the Test task. This includes the runPath plus the bootClasspath.
Returns:
The testClasspath.


getTestsSourcePath

protected java.util.ArrayList getTestsSourcePath()
Retrieves the sourcepath for the tests of this variant. It includes the standard test dir that has tests for all flavors, a dir for the buildType tests, a dir for each flavor in the variant and a dir for the variant. For example, the variant FreeBetaDebug will have the following dirs:
Returns:
The sourcePath.


getVariantReportDestination

java.io.File getVariantReportDestination()
Retrieves the report destination dir where this variant's test results should go to.
For example: build/test-report/freeBeta/debug/.
Returns:
The report destination.


 

Groovy Documentation