Search in sources :

Example 1 with ProductFlavorContainerStub

use of com.android.tools.idea.gradle.stubs.android.ProductFlavorContainerStub in project android by JetBrains.

the class ContentRootSourcePaths method storeExpectedSourcePaths.

/**
   * Stores the expected paths of all the source and test directories in the given {@code AndroidProject}.
   *
   * @param androidProject the given {@code AndroidProject}.
   */
public void storeExpectedSourcePaths(@NotNull AndroidProjectStub androidProject) {
    VariantStub selectedVariant = androidProject.getFirstVariant();
    Assert.assertNotNull(selectedVariant);
    addGeneratedDirPaths(selectedVariant);
    for (String flavorName : selectedVariant.getProductFlavors()) {
        ProductFlavorContainerStub flavor = androidProject.findProductFlavor(flavorName);
        if (flavor != null) {
            addSourceDirPaths(flavor);
        }
    }
    String buildTypeName = selectedVariant.getBuildType();
    BuildTypeContainer buildType = androidProject.findBuildType(buildTypeName);
    if (buildType != null) {
        addSourceDirPaths(buildType.getSourceProvider(), false);
    }
    addSourceDirPaths(androidProject.getDefaultConfig());
}
Also used : ProductFlavorContainerStub(com.android.tools.idea.gradle.stubs.android.ProductFlavorContainerStub) VariantStub(com.android.tools.idea.gradle.stubs.android.VariantStub) BuildTypeContainer(com.android.builder.model.BuildTypeContainer)

Aggregations

BuildTypeContainer (com.android.builder.model.BuildTypeContainer)1 ProductFlavorContainerStub (com.android.tools.idea.gradle.stubs.android.ProductFlavorContainerStub)1 VariantStub (com.android.tools.idea.gradle.stubs.android.VariantStub)1