Search in sources :

Example 11 with BlazeSyncParams

use of com.google.idea.blaze.base.sync.BlazeSyncParams in project intellij by bazelbuild.

the class JavascriptSyncTest method testSimpleTestSourcesIdentified.

@Test
public void testSimpleTestSourcesIdentified() {
    TestUtils.setPlatformPrefix(getTestRootDisposable(), PlatformUtils.IDEA_PREFIX);
    setProjectView("directories:", "  common/jslayout/calendar", "  common/jslayout/tests", "targets:", "  //common/jslayout/...:all", "test_sources:", "  common/jslayout/tests", "workspace_type: javascript");
    VirtualFile rootFile = workspace.createDirectory(new WorkspacePath("common/jslayout/calendar"));
    VirtualFile testFile = workspace.createFile(new WorkspacePath("common/jslayout/tests/date_formatter_test.js"));
    BlazeSyncParams syncParams = new BlazeSyncParams.Builder("Full Sync", BlazeSyncParams.SyncMode.FULL).addProjectViewTargets(true).build();
    runBlazeSync(syncParams);
    errorCollector.assertNoIssues();
    assertThat(getWorkspaceContentEntries()).hasSize(2);
    ContentEntry sourceEntry = findContentEntry(rootFile);
    assertThat(sourceEntry.getSourceFolders()).hasLength(1);
    SourceFolder nonTestSource = findSourceFolder(sourceEntry, rootFile);
    assertThat(nonTestSource.isTestSource()).isFalse();
    ContentEntry testEntry = findContentEntry(testFile.getParent());
    assertThat(testEntry.getSourceFolders()).hasLength(1);
    SourceFolder testSource = findSourceFolder(testEntry, testFile.getParent());
    assertThat(testSource.isTestSource()).isTrue();
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) SourceFolder(com.intellij.openapi.roots.SourceFolder) ContentEntry(com.intellij.openapi.roots.ContentEntry) BlazeSyncParams(com.google.idea.blaze.base.sync.BlazeSyncParams) Test(org.junit.Test)

Example 12 with BlazeSyncParams

use of com.google.idea.blaze.base.sync.BlazeSyncParams in project intellij by bazelbuild.

the class JavascriptSyncTest method testUsefulErrorMessageInCommunityEdition.

@Test
public void testUsefulErrorMessageInCommunityEdition() {
    TestUtils.setPlatformPrefix(getTestRootDisposable(), PlatformUtils.IDEA_CE_PREFIX);
    setProjectView("directories:", "  common/jslayout", "targets:", "  //common/jslayout/...:all", "workspace_type: javascript");
    workspace.createDirectory(new WorkspacePath("common/jslayout"));
    BlazeSyncParams syncParams = new BlazeSyncParams.Builder("Full Sync", BlazeSyncParams.SyncMode.FULL).addProjectViewTargets(true).build();
    runBlazeSync(syncParams);
    errorCollector.assertIssues("IntelliJ Ultimate needed for Javascript support.");
}
Also used : WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) BlazeSyncParams(com.google.idea.blaze.base.sync.BlazeSyncParams) Test(org.junit.Test)

Aggregations

WorkspacePath (com.google.idea.blaze.base.model.primitives.WorkspacePath)12 BlazeSyncParams (com.google.idea.blaze.base.sync.BlazeSyncParams)12 Test (org.junit.Test)12 TargetMapBuilder (com.google.idea.blaze.base.ideinfo.TargetMapBuilder)8 BlazeContentEntry (com.google.idea.blaze.java.sync.model.BlazeContentEntry)8 ContentEntry (com.intellij.openapi.roots.ContentEntry)8 VirtualFile (com.intellij.openapi.vfs.VirtualFile)8 SourceFolder (com.intellij.openapi.roots.SourceFolder)6 TargetMap (com.google.idea.blaze.base.ideinfo.TargetMap)3 BlazeProjectData (com.google.idea.blaze.base.model.BlazeProjectData)3 BlazeJavaSyncData (com.google.idea.blaze.java.sync.model.BlazeJavaSyncData)3 BlazeSourceDirectory (com.google.idea.blaze.java.sync.model.BlazeSourceDirectory)3 WorkspaceLanguageSettings (com.google.idea.blaze.base.sync.projectview.WorkspaceLanguageSettings)2