Search in sources :

Example 6 with ProductFlavorContainer

use of com.android.builder.model.ProductFlavorContainer in project android by JetBrains.

the class IdeaSourceProviderTest method testSourceProviderContainsFile.

public void testSourceProviderContainsFile() throws Exception {
    assertNotNull(myAppFacet.getAndroidModel());
    ProductFlavorContainer paidFlavor = AndroidModuleModel.get(myAppFacet).findProductFlavor("paid");
    assertNotNull(paidFlavor);
    IdeaSourceProvider paidFlavorSourceProvider = IdeaSourceProvider.create(paidFlavor.getSourceProvider());
    assertNotNull(paidFlavorSourceProvider);
    VirtualFile moduleFile = myAppFacet.getAndroidModel().getRootDir();
    assertNotNull(moduleFile);
    VirtualFile javaSrcFile = moduleFile.findFileByRelativePath("src/paid/java/com/example/projectwithappandlib/app/paid");
    assertNotNull(javaSrcFile);
    assertTrue(paidFlavorSourceProvider.containsFile(javaSrcFile));
    VirtualFile javaMainSrcFile = moduleFile.findFileByRelativePath("src/main/java/com/example/projectwithappandlib/");
    assertNotNull(javaMainSrcFile);
    assertFalse(paidFlavorSourceProvider.containsFile(javaMainSrcFile));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ProductFlavorContainer(com.android.builder.model.ProductFlavorContainer)

Example 7 with ProductFlavorContainer

use of com.android.builder.model.ProductFlavorContainer in project android by JetBrains.

the class AndroidModuleModelTest method testFindProductFlavor.

public void testFindProductFlavor() throws Exception {
    String flavorName = "fa";
    ProductFlavorContainer flavor = myAndroidModel.findProductFlavor(flavorName);
    assertNotNull(flavor);
    assertSame(myAndroidProject.findProductFlavor(flavorName), flavor);
}
Also used : ProductFlavorContainer(com.android.builder.model.ProductFlavorContainer)

Aggregations

ProductFlavorContainer (com.android.builder.model.ProductFlavorContainer)7 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 AndroidProject (com.android.builder.model.AndroidProject)2 Nullable (com.android.annotations.Nullable)1 FilterData (com.android.build.FilterData)1 OutputFile (com.android.build.OutputFile)1 AndroidArtifact (com.android.builder.model.AndroidArtifact)1 AndroidArtifactOutput (com.android.builder.model.AndroidArtifactOutput)1 SourceProviderContainer (com.android.builder.model.SourceProviderContainer)1 Variant (com.android.builder.model.Variant)1 AndroidModel (com.android.tools.idea.model.AndroidModel)1 Location (com.android.tools.klint.detector.api.Location)1 Module (com.intellij.openapi.module.Module)1 File (java.io.File)1 IIOMetadataNode (javax.imageio.metadata.IIOMetadataNode)1 Element (org.w3c.dom.Element)1