Search in sources :

Example 81 with BlazeProjectData

use of com.google.idea.blaze.base.model.BlazeProjectData in project intellij by bazelbuild.

the class BlazeGoRootsProvider method getGoPathSourcesRoots.

@Override
public Collection<VirtualFile> getGoPathSourcesRoots(@Nullable Project project, @Nullable Module module) {
    if (project == null) {
        return ImmutableList.of();
    }
    BlazeProjectData projectData = BlazeProjectDataManager.getInstance(project).getBlazeProjectData();
    if (projectData == null || !projectData.workspaceLanguageSettings.isLanguageActive(LanguageClass.GO) || !BlazeGoSupport.blazeGoSupportEnabled.getValue()) {
        return ImmutableList.of();
    }
    File goRoot = getGoRoot(project);
    if (goRoot == null) {
        return ImmutableList.of();
    }
    VirtualFile goRootVF = VirtualFileSystemProvider.getInstance().getSystem().findFileByIoFile(goRoot);
    return goRootVF != null ? ImmutableList.of(goRootVF) : ImmutableList.of();
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) BlazeProjectData(com.google.idea.blaze.base.model.BlazeProjectData) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Example 82 with BlazeProjectData

use of com.google.idea.blaze.base.model.BlazeProjectData in project intellij by bazelbuild.

the class FastBuildServiceImpl method checkLabelIsSupported.

private void checkLabelIsSupported(Label label) {
    BlazeProjectData blazeProjectData = projectDataManager.getBlazeProjectData();
    checkState(blazeProjectData != null, "this is not a blaze project");
    TargetIdeInfo ideInfo = blazeProjectData.targetMap.get(TargetKey.forPlainTarget(label));
    checkArgument(ideInfo != null, "label %s is not found, run a blaze sync?", label);
    checkArgument(supportsFastBuilds(ideInfo.kind), "fast builds are not supported for %s targets", ideInfo.kind);
}
Also used : TargetIdeInfo(com.google.idea.blaze.base.ideinfo.TargetIdeInfo) BlazeProjectData(com.google.idea.blaze.base.model.BlazeProjectData)

Aggregations

BlazeProjectData (com.google.idea.blaze.base.model.BlazeProjectData)82 File (java.io.File)31 TargetMap (com.google.idea.blaze.base.ideinfo.TargetMap)28 Nullable (javax.annotation.Nullable)24 WorkspacePath (com.google.idea.blaze.base.model.primitives.WorkspacePath)23 Test (org.junit.Test)22 VirtualFile (com.intellij.openapi.vfs.VirtualFile)19 TargetIdeInfo (com.google.idea.blaze.base.ideinfo.TargetIdeInfo)17 ProjectViewSet (com.google.idea.blaze.base.projectview.ProjectViewSet)17 MockBlazeProjectDataManager (com.google.idea.blaze.base.model.MockBlazeProjectDataManager)15 BlazeSyncParams (com.google.idea.blaze.base.sync.BlazeSyncParams)13 WorkspaceLanguageSettings (com.google.idea.blaze.base.sync.projectview.WorkspaceLanguageSettings)13 ArtifactLocationDecoder (com.google.idea.blaze.base.sync.workspace.ArtifactLocationDecoder)13 Project (com.intellij.openapi.project.Project)13 TargetKey (com.google.idea.blaze.base.ideinfo.TargetKey)11 ImmutableList (com.google.common.collect.ImmutableList)10 BlazeContext (com.google.idea.blaze.base.scope.BlazeContext)10 ArtifactLocation (com.google.idea.blaze.base.ideinfo.ArtifactLocation)8 List (java.util.List)8 BlazeProjectDataManager (com.google.idea.blaze.base.sync.data.BlazeProjectDataManager)7