use of com.google.idea.blaze.java.sync.importer.JavaSourceFilter in project intellij by bazelbuild.
the class BlazeAndroidWorkspaceImporterTest method importWorkspace.
private BlazeAndroidImportResult importWorkspace(WorkspaceRoot workspaceRoot, TargetMapBuilder targetMapBuilder, ProjectView projectView) {
ProjectViewSet projectViewSet = ProjectViewSet.builder().add(projectView).build();
TargetMap targetMap = targetMapBuilder.build();
JavaSourceFilter sourceFilter = new JavaSourceFilter(project, workspaceRoot, projectViewSet, targetMap);
BlazeAndroidWorkspaceImporter workspaceImporter = new BlazeAndroidWorkspaceImporter(project, context, workspaceRoot, projectViewSet, targetMap, sourceFilter, FAKE_ARTIFACT_DECODER);
return workspaceImporter.importWorkspace();
}
use of com.google.idea.blaze.java.sync.importer.JavaSourceFilter in project intellij by bazelbuild.
the class BlazeAndroidSyncPlugin method updateSyncState.
@Override
public void updateSyncState(Project project, BlazeContext context, WorkspaceRoot workspaceRoot, ProjectViewSet projectViewSet, WorkspaceLanguageSettings workspaceLanguageSettings, BlazeInfo blazeInfo, @Nullable WorkingSet workingSet, WorkspacePathResolver workspacePathResolver, ArtifactLocationDecoder artifactLocationDecoder, TargetMap targetMap, SyncState.Builder syncStateBuilder, @Nullable SyncState previousSyncState) {
if (!isAndroidWorkspace(workspaceLanguageSettings)) {
return;
}
AndroidSdkPlatform androidSdkPlatform = AndroidSdkFromProjectView.getAndroidSdkPlatform(context, projectViewSet);
JavaSourceFilter sourceFilter = new JavaSourceFilter(project, workspaceRoot, projectViewSet, targetMap);
BlazeAndroidWorkspaceImporter workspaceImporter = new BlazeAndroidWorkspaceImporter(project, context, workspaceRoot, projectViewSet, targetMap, sourceFilter, artifactLocationDecoder);
BlazeAndroidImportResult importResult = Scope.push(context, (childContext) -> {
childContext.push(new TimingScope("AndroidWorkspaceImporter", EventType.Other));
return workspaceImporter.importWorkspace();
});
BlazeAndroidSyncData syncData = new BlazeAndroidSyncData(importResult, androidSdkPlatform);
syncStateBuilder.put(BlazeAndroidSyncData.class, syncData);
}
use of com.google.idea.blaze.java.sync.importer.JavaSourceFilter in project intellij by bazelbuild.
the class BlazeAndroidWorkspaceImporterTest method importJavaWorkspace.
private BlazeJavaImportResult importJavaWorkspace(WorkspaceRoot workspaceRoot, TargetMapBuilder targetMapBuilder, ProjectView projectView) {
ProjectViewSet projectViewSet = ProjectViewSet.builder().add(projectView).build();
TargetMap targetMap = targetMapBuilder.build();
JavaSourceFilter sourceFilter = new JavaSourceFilter(project, workspaceRoot, projectViewSet, targetMap);
BlazeJavaWorkspaceImporter blazeWorkspaceImporter = new BlazeJavaWorkspaceImporter(project, workspaceRoot, projectViewSet, workspaceLanguageSettings, targetMap, sourceFilter, jdepsMap, workingSet, FAKE_ARTIFACT_DECODER);
return blazeWorkspaceImporter.importWorkspace(context);
}
use of com.google.idea.blaze.java.sync.importer.JavaSourceFilter in project intellij by bazelbuild.
the class BlazeJavaSyncPlugin method updateSyncState.
@Override
public void updateSyncState(Project project, BlazeContext context, WorkspaceRoot workspaceRoot, ProjectViewSet projectViewSet, WorkspaceLanguageSettings workspaceLanguageSettings, BlazeInfo blazeInfo, @Nullable WorkingSet workingSet, WorkspacePathResolver workspacePathResolver, ArtifactLocationDecoder artifactLocationDecoder, TargetMap targetMap, SyncState.Builder syncStateBuilder, @Nullable SyncState previousSyncState) {
JavaWorkingSet javaWorkingSet = null;
if (workingSet != null) {
javaWorkingSet = new JavaWorkingSet(workspaceRoot, workingSet, Blaze.getBuildSystemProvider(project)::isBuildFile);
}
JavaSourceFilter sourceFilter = new JavaSourceFilter(project, workspaceRoot, projectViewSet, targetMap);
JdepsMap jdepsMap = jdepsFileReader.loadJdepsFiles(project, context, artifactLocationDecoder, sourceFilter.getSourceTargets(), syncStateBuilder, previousSyncState);
if (context.isCancelled()) {
return;
}
BlazeJavaWorkspaceImporter blazeJavaWorkspaceImporter = new BlazeJavaWorkspaceImporter(project, workspaceRoot, projectViewSet, workspaceLanguageSettings, targetMap, sourceFilter, jdepsMap, javaWorkingSet, artifactLocationDecoder);
BlazeJavaImportResult importResult = Scope.push(context, (childContext) -> {
childContext.push(new TimingScope("JavaWorkspaceImporter", EventType.Other));
return blazeJavaWorkspaceImporter.importWorkspace(childContext);
});
Glob.GlobSet excludedLibraries = new Glob.GlobSet(ImmutableList.<Glob>builder().addAll(projectViewSet.listItems(ExcludeLibrarySection.KEY)).addAll(projectViewSet.listItems(ExcludedLibrarySection.KEY)).build());
BlazeJavaSyncData syncData = new BlazeJavaSyncData(importResult, excludedLibraries);
syncStateBuilder.put(BlazeJavaSyncData.class, syncData);
}
use of com.google.idea.blaze.java.sync.importer.JavaSourceFilter 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