use of com.google.idea.blaze.base.model.primitives.WorkspaceRoot 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.workspacePathResolver;
}
// 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;
}
use of com.google.idea.blaze.base.model.primitives.WorkspaceRoot in project intellij by bazelbuild.
the class GitStatusLineProcessorTest method testGitStatusParser.
@Test
public void testGitStatusParser() {
GitStatusLineProcessor lineProcessor = new GitStatusLineProcessor(new WorkspaceRoot(new File("/usr/blah")), "/usr/blah");
for (String line : ImmutableList.of("D root/README", "M root/blaze-base/src/com/google/idea/blaze/base/root/citc/CitcUtil.java", "A root/blah", "A java/com/google/Test.java", "M java/com/other/")) {
lineProcessor.processLine(line);
}
assertThat(lineProcessor.addedFiles).containsExactly(new WorkspacePath("root/blah"), new WorkspacePath("java/com/google/Test.java"));
assertThat(lineProcessor.modifiedFiles).containsExactly(new WorkspacePath("root/blaze-base/src/com/google/idea/blaze/base/root/citc/CitcUtil.java"), new WorkspacePath("java/com/other"));
assertThat(lineProcessor.deletedFiles).containsExactly(new WorkspacePath("root/README"));
}
use of com.google.idea.blaze.base.model.primitives.WorkspaceRoot in project intellij by bazelbuild.
the class GitStatusLineProcessorTest method testGitStatusParserDifferentRoots.
@Test
public void testGitStatusParserDifferentRoots() {
GitStatusLineProcessor lineProcessor = new GitStatusLineProcessor(new WorkspaceRoot(new File("/usr/blah/root")), "/usr/blah");
for (String line : ImmutableList.of("D root/README", "M root/blaze-base/src/com/google/idea/blaze/base/root/citc/CitcUtil.java", "A root/blah", "A java/com/google/Test.java", "M java/com/other/")) {
lineProcessor.processLine(line);
}
assertThat(lineProcessor.addedFiles).containsExactly(new WorkspacePath("blah"));
assertThat(lineProcessor.modifiedFiles).containsExactly(new WorkspacePath("blaze-base/src/com/google/idea/blaze/base/root/citc/CitcUtil.java"));
assertThat(lineProcessor.deletedFiles).containsExactly(new WorkspacePath("README"));
}
use of com.google.idea.blaze.base.model.primitives.WorkspaceRoot in project intellij by bazelbuild.
the class RelatedWorkspacePathFinderTest method setUp.
@Before
public void setUp() throws IOException {
files = new MockFileOperationProvider();
relatedPathFinder = new RelatedWorkspacePathFinder(files);
workspacePathResolver = new WorkspacePathResolverImpl(new WorkspaceRoot(WORKSPACE_ROOT));
}
use of com.google.idea.blaze.base.model.primitives.WorkspaceRoot in project intellij by bazelbuild.
the class BlazeScalaWorkspaceImporterTest method importJava.
private BlazeJavaImportResult importJava(ProjectView projectView, TargetMap targetMap) {
ProjectViewSet projectViewSet = ProjectViewSet.builder().add(projectView).build();
WorkspaceLanguageSettings languageSettings = new WorkspaceLanguageSettings(WorkspaceType.JAVA, ImmutableSet.of(LanguageClass.GENERIC, LanguageClass.SCALA, LanguageClass.JAVA));
JavaSourceFilter sourceFilter = new JavaSourceFilter(project, workspaceRoot, projectViewSet, targetMap);
JdepsMap jdepsMap = key -> ImmutableList.of();
ArtifactLocationDecoder decoder = location -> new File(location.getRelativePath());
return new BlazeJavaWorkspaceImporter(project, workspaceRoot, projectViewSet, languageSettings, targetMap, sourceFilter, jdepsMap, null, decoder).importWorkspace(context);
}
Aggregations