Search in sources :

Example 11 with AndroidSourceSet

use of com.android.tools.idea.npw.project.AndroidSourceSet in project intellij by bazelbuild.

the class BlazeAndroidProjectPathsTest method getResourceSourceSetsWithTargetDirectory.

/**
 * If we have a resource module and a target directory, then we can get the res dir from the
 * module, and use the target directory for everything else.
 */
@Test
public void getResourceSourceSetsWithTargetDirectory() {
    AndroidFacet facet = mockResourceFacet();
    File resourceFile = VfsUtilCore.virtualToIoFile(resource);
    File targetFile = VfsUtilCore.virtualToIoFile(target);
    List<AndroidSourceSet> sourceSets = AndroidSourceSet.getSourceSets(facet, target);
    assertThat(sourceSets).hasSize(1);
    AndroidSourceSet sourceSet = sourceSets.get(0);
    AndroidProjectPaths paths = sourceSet.getPaths();
    assertThat(sourceSet.getName()).isEqualTo("com.google.target");
    assertThat(paths.getModuleRoot()).isEqualTo(resourceFile);
    assertThat(paths.getSrcDirectory(null)).isEqualTo(targetFile);
    assertThat(paths.getTestDirectory(null)).isEqualTo(targetFile);
    assertThat(paths.getResDirectory()).isEqualTo(new File(resourceFile, "res"));
    assertThat(paths.getAidlDirectory(null)).isEqualTo(targetFile);
    assertThat(paths.getManifestDirectory()).isEqualTo(targetFile);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) MockVirtualFile(com.intellij.mock.MockVirtualFile) File(java.io.File) AndroidFacet(org.jetbrains.android.facet.AndroidFacet) AndroidSourceSet(com.android.tools.idea.npw.project.AndroidSourceSet) AndroidProjectPaths(com.android.tools.idea.npw.project.AndroidProjectPaths) Test(org.junit.Test)

Aggregations

AndroidSourceSet (com.android.tools.idea.npw.project.AndroidSourceSet)11 File (java.io.File)10 VirtualFile (com.intellij.openapi.vfs.VirtualFile)7 AndroidProjectPaths (com.android.tools.idea.npw.project.AndroidProjectPaths)6 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)6 MockVirtualFile (com.intellij.mock.MockVirtualFile)4 Module (com.intellij.openapi.module.Module)4 Test (org.junit.Test)4 RenderTemplateModel (com.android.tools.idea.npw.template.RenderTemplateModel)3 TemplateHandle (com.android.tools.idea.npw.template.TemplateHandle)3 Project (com.intellij.openapi.project.Project)3 NotNull (org.jetbrains.annotations.NotNull)3 ChooseActivityTypeStep (com.android.tools.idea.npw.template.ChooseActivityTypeStep)2 StudioWizardDialogBuilder (com.android.tools.idea.ui.wizard.StudioWizardDialogBuilder)2 ModelWizard (com.android.tools.idea.wizard.model.ModelWizard)2 SourceProvider (com.android.builder.model.SourceProvider)1 AndroidVersion (com.android.sdklib.AndroidVersion)1 NewAndroidComponentAction (com.android.tools.idea.actions.NewAndroidComponentAction)1 AndroidModuleInfo (com.android.tools.idea.model.AndroidModuleInfo)1 NewAndroidActivityWizard (com.android.tools.idea.npw.NewAndroidActivityWizard)1