Search in sources :

Example 11 with WorkspacePathResolverImpl

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

the class MockBlazeProjectDataBuilder method build.

public BlazeProjectData build() {
    TargetMap targetMap = this.targetMap != null ? this.targetMap : new TargetMap(ImmutableMap.of());
    BlazeInfo blazeInfo = this.blazeInfo;
    if (blazeInfo == null) {
        String outputBase = this.outputBase != null ? this.outputBase : "/usr/workspace/1234";
        blazeInfo = BlazeInfo.createMockBlazeInfo(outputBase, outputBase + "/execroot", outputBase + "/execroot/bin", outputBase + "/execroot/gen", outputBase + "/execroot/testlogs");
    }
    BlazeVersionData blazeVersionData = this.blazeVersionData != null ? this.blazeVersionData : BlazeVersionData.builder().build();
    WorkspacePathResolver workspacePathResolver = this.workspacePathResolver != null ? this.workspacePathResolver : new WorkspacePathResolverImpl(workspaceRoot);
    ArtifactLocationDecoder artifactLocationDecoder = this.artifactLocationDecoder != null ? this.artifactLocationDecoder : new ArtifactLocationDecoderImpl(blazeInfo, workspacePathResolver, RemoteOutputArtifacts.EMPTY);
    WorkspaceLanguageSettings workspaceLanguageSettings = this.workspaceLanguageSettings != null ? this.workspaceLanguageSettings : new WorkspaceLanguageSettings(WorkspaceType.JAVA, ImmutableSet.of());
    SyncState syncState = this.syncState != null ? this.syncState : new SyncState(ImmutableMap.of());
    return new BlazeProjectData(new ProjectTargetData(targetMap, /* ideInterfaceState= */
    null, RemoteOutputArtifacts.EMPTY), blazeInfo, blazeVersionData, workspacePathResolver, artifactLocationDecoder, workspaceLanguageSettings, syncState);
}
Also used : BlazeInfo(com.google.idea.blaze.base.command.info.BlazeInfo) WorkspacePathResolverImpl(com.google.idea.blaze.base.sync.workspace.WorkspacePathResolverImpl) ArtifactLocationDecoder(com.google.idea.blaze.base.sync.workspace.ArtifactLocationDecoder) WorkspacePathResolver(com.google.idea.blaze.base.sync.workspace.WorkspacePathResolver) ArtifactLocationDecoderImpl(com.google.idea.blaze.base.sync.workspace.ArtifactLocationDecoderImpl) WorkspaceLanguageSettings(com.google.idea.blaze.base.sync.projectview.WorkspaceLanguageSettings) TargetMap(com.google.idea.blaze.base.ideinfo.TargetMap)

Example 12 with WorkspacePathResolverImpl

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

the class SourceDirectoryCalculatorTest method getDecoder.

private static ArtifactLocationDecoder getDecoder() {
    File root = new File("/root");
    WorkspaceRoot workspaceRoot = new WorkspaceRoot(root);
    BlazeInfo roots = BlazeInfo.createMockBlazeInfo("/", "/root", "/root/out/crosstool/bin", "/root/out/crosstool/gen", "/root/out/crosstool/testlogs");
    return new ArtifactLocationDecoderImpl(roots, new WorkspacePathResolverImpl(workspaceRoot), RemoteOutputArtifacts.EMPTY);
}
Also used : BlazeInfo(com.google.idea.blaze.base.command.info.BlazeInfo) WorkspacePathResolverImpl(com.google.idea.blaze.base.sync.workspace.WorkspacePathResolverImpl) ArtifactLocationDecoderImpl(com.google.idea.blaze.base.sync.workspace.ArtifactLocationDecoderImpl) WorkspaceRoot(com.google.idea.blaze.base.model.primitives.WorkspaceRoot) File(java.io.File)

Example 13 with WorkspacePathResolverImpl

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

the class RelatedWorkspacePathFinderTest method setUp.

@Before
public void setUp() throws IOException {
    files = new MockFileOperationProvider();
    intellij.registerApplicationService(FileOperationProvider.class, files);
    relatedPathFinder = new RelatedWorkspacePathFinder();
    workspacePathResolver = new WorkspacePathResolverImpl(new WorkspaceRoot(WORKSPACE_ROOT));
}
Also used : WorkspacePathResolverImpl(com.google.idea.blaze.base.sync.workspace.WorkspacePathResolverImpl) WorkspaceRoot(com.google.idea.blaze.base.model.primitives.WorkspaceRoot) Before(org.junit.Before)

Example 14 with WorkspacePathResolverImpl

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

the class ProjectViewManagerImpl method computeWorkspacePathResolver.

@Nullable
private static WorkspacePathResolver computeWorkspacePathResolver(Project project, BlazeContext context) {
    BlazeProjectData projectData = BlazeProjectDataManager.getInstance(project).getBlazeProjectData();
    if (projectData != null) {
        return projectData.getWorkspacePathResolver();
    }
    // otherwise try to compute the workspace path resolver from scratch
    WorkspaceRoot workspaceRoot = WorkspaceRoot.fromProject(project);
    BlazeVcsHandler vcsHandler = BlazeVcsHandler.vcsHandlerForProject(project);
    if (vcsHandler == null) {
        return null;
    }
    BlazeVcsHandler.BlazeVcsSyncHandler vcsSyncHandler = vcsHandler.createSyncHandler(project, workspaceRoot);
    if (vcsSyncHandler == null) {
        return new WorkspacePathResolverImpl(workspaceRoot);
    }
    boolean ok = vcsSyncHandler.update(context, BlazeExecutor.getInstance().getExecutor());
    return ok ? vcsSyncHandler.getWorkspacePathResolver() : null;
}
Also used : WorkspacePathResolverImpl(com.google.idea.blaze.base.sync.workspace.WorkspacePathResolverImpl) BlazeProjectData(com.google.idea.blaze.base.model.BlazeProjectData) WorkspaceRoot(com.google.idea.blaze.base.model.primitives.WorkspaceRoot) BlazeVcsHandler(com.google.idea.blaze.base.vcs.BlazeVcsHandler) Nullable(javax.annotation.Nullable)

Example 15 with WorkspacePathResolverImpl

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

the class AllInBuildFileTestContextProviderTest method setProjectView.

protected void setProjectView(String... contents) {
    ProjectViewParser projectViewParser = new ProjectViewParser(context, new WorkspacePathResolverImpl(workspaceRoot));
    projectViewParser.parseProjectView(Joiner.on("\n").join(contents));
    ProjectViewSet result = projectViewParser.getResult();
    assertThat(result.getProjectViewFiles()).isNotEmpty();
    errorCollector.assertNoIssues();
    projectViewManager.setProjectView(result);
}
Also used : ProjectViewSet(com.google.idea.blaze.base.projectview.ProjectViewSet) WorkspacePathResolverImpl(com.google.idea.blaze.base.sync.workspace.WorkspacePathResolverImpl) ProjectViewParser(com.google.idea.blaze.base.projectview.parser.ProjectViewParser)

Aggregations

WorkspacePathResolverImpl (com.google.idea.blaze.base.sync.workspace.WorkspacePathResolverImpl)15 ProjectViewSet (com.google.idea.blaze.base.projectview.ProjectViewSet)6 ProjectViewParser (com.google.idea.blaze.base.projectview.parser.ProjectViewParser)5 WorkspaceRoot (com.google.idea.blaze.base.model.primitives.WorkspaceRoot)4 BlazeContext (com.google.idea.blaze.base.scope.BlazeContext)4 BlazeProjectData (com.google.idea.blaze.base.model.BlazeProjectData)3 WorkspacePathResolver (com.google.idea.blaze.base.sync.workspace.WorkspacePathResolver)3 BlazeVcsHandler (com.google.idea.blaze.base.vcs.BlazeVcsHandler)3 BlazeInfo (com.google.idea.blaze.base.command.info.BlazeInfo)2 TargetMap (com.google.idea.blaze.base.ideinfo.TargetMap)2 MockBlazeProjectDataManager (com.google.idea.blaze.base.model.MockBlazeProjectDataManager)2 StatusOutput (com.google.idea.blaze.base.scope.output.StatusOutput)2 TimingScope (com.google.idea.blaze.base.scope.scopes.TimingScope)2 WorkspaceLanguageSettings (com.google.idea.blaze.base.sync.projectview.WorkspaceLanguageSettings)2 ArtifactLocationDecoderImpl (com.google.idea.blaze.base.sync.workspace.ArtifactLocationDecoderImpl)2 File (java.io.File)2 Before (org.junit.Before)2 GoFile (com.goide.psi.GoFile)1 GoTypeSpec (com.goide.psi.GoTypeSpec)1 GoSdkImpl (com.goide.sdk.GoSdkImpl)1