Search in sources :

Example 6 with AndroidProjectPaths

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

the class BlazeAndroidProjectPathsTest method getWorkspaceSourceSetsWithNoTargetDirectory.

/**
 * If no target directory is given, and we have the workspace module, we'll just use the module
 * root.
 */
@Test
public void getWorkspaceSourceSetsWithNoTargetDirectory() {
    AndroidFacet facet = mockWorkspaceFacet();
    File rootFile = VfsUtilCore.virtualToIoFile(root);
    List<AndroidSourceSet> sourceSets = AndroidSourceSet.getSourceSets(facet, null);
    assertThat(sourceSets).hasSize(1);
    AndroidSourceSet sourceSet = sourceSets.get(0);
    AndroidProjectPaths paths = sourceSet.getPaths();
    assertThat(sourceSet.getName()).isEqualTo(".workspace");
    assertThat(paths.getModuleRoot()).isEqualTo(rootFile);
    assertThat(paths.getSrcDirectory(null)).isEqualTo(rootFile);
    assertThat(paths.getTestDirectory(null)).isEqualTo(rootFile);
    assertThat(paths.getResDirectory()).isEqualTo(new File(rootFile, "res"));
    assertThat(paths.getAidlDirectory(null)).isEqualTo(rootFile);
    assertThat(paths.getManifestDirectory()).isEqualTo(rootFile);
}
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)

Example 7 with AndroidProjectPaths

use of com.android.tools.idea.npw.project.AndroidProjectPaths 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

AndroidProjectPaths (com.android.tools.idea.npw.project.AndroidProjectPaths)7 File (java.io.File)7 AndroidSourceSet (com.android.tools.idea.npw.project.AndroidSourceSet)6 MockVirtualFile (com.intellij.mock.MockVirtualFile)4 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)4 Test (org.junit.Test)4 Project (com.intellij.openapi.project.Project)2 NotNull (org.jetbrains.annotations.NotNull)2 AndroidVersion (com.android.sdklib.AndroidVersion)1 AndroidModuleInfo (com.android.tools.idea.model.AndroidModuleInfo)1 AndroidVersionsInfo (com.android.tools.idea.npw.platform.AndroidVersionsInfo)1 ChooseActivityTypeStep (com.android.tools.idea.npw.template.ChooseActivityTypeStep)1 RenderTemplateModel (com.android.tools.idea.npw.template.RenderTemplateModel)1 TemplateHandle (com.android.tools.idea.npw.template.TemplateHandle)1 Result (com.intellij.openapi.application.Result)1 WriteCommandAction (com.intellij.openapi.command.WriteCommandAction)1 AndroidPlatform (org.jetbrains.android.sdk.AndroidPlatform)1