use of com.google.idea.blaze.base.model.BlazeProjectData in project intellij by bazelbuild.
the class ProjectTargetFinder method findTarget.
@Override
public Future<TargetInfo> findTarget(Project project, Label label) {
BlazeProjectData projectData = BlazeProjectDataManager.getInstance(project).getBlazeProjectData();
TargetInfo target = projectData != null ? findTarget(projectData.targetMap, label) : null;
return Futures.immediateFuture(target);
}
use of com.google.idea.blaze.base.model.BlazeProjectData in project intellij by bazelbuild.
the class TestTargetHeuristicTest method doSetup.
@Before
public final void doSetup() {
BlazeProjectData blazeProjectData = MockBlazeProjectDataBuilder.builder(workspaceRoot).build();
registerProjectService(BlazeProjectDataManager.class, new MockBlazeProjectDataManager(blazeProjectData));
}
use of com.google.idea.blaze.base.model.BlazeProjectData in project intellij by bazelbuild.
the class BlazeBuildServiceTest method initTest.
@Override
protected void initTest(Container applicationServices, Container projectServices) {
BlazeImportSettingsManager importSettingsManager = new BlazeImportSettingsManager();
importSettingsManager.setImportSettings(new BlazeImportSettings("", "", "", "", Blaze.BuildSystem.Blaze));
projectServices.register(BlazeImportSettingsManager.class, importSettingsManager);
applicationServices.register(ExperimentService.class, new MockExperimentService());
ProjectView view = ProjectView.builder().add(ListSection.builder(TargetSection.KEY).add(TargetExpression.fromStringSafe("//view/target:one")).add(TargetExpression.fromStringSafe("//view/target:two"))).build();
viewSet = ProjectViewSet.builder().add(new File("view/target/.blazeproject"), view).build();
ProjectViewManager viewManager = new MockProjectViewManager(viewSet);
projectServices.register(ProjectViewManager.class, viewManager);
BlazeProjectData blazeProjectData = MockBlazeProjectDataBuilder.builder(workspaceRoot).build();
projectServices.register(BlazeProjectDataManager.class, new MockBlazeProjectDataManager(blazeProjectData));
applicationServices.register(BlazeBuildService.class, spy(new BlazeBuildService()));
service = BlazeBuildService.getInstance();
assertThat(service).isNotNull();
// Can't mock BlazeExecutor.submitTask.
doNothing().when(service).buildTargetExpressions(any(), any(), any(), any());
}
use of com.google.idea.blaze.base.model.BlazeProjectData in project intellij by bazelbuild.
the class FastBuildCompilerFactoryImplTest method configureTestForTargetMap.
private void configureTestForTargetMap(Map<TargetKey, TargetIdeInfo> targetMap) {
BlazeProjectData projectData = new BlazeProjectData(0, new TargetMap(ImmutableMap.copyOf(targetMap)), null, null, null, artifact -> new File(artifact.relativePath), null, null, null);
BlazeProjectDataManager projectDataManager = new MockBlazeProjectDataManager(projectData);
compilerFactory = new FastBuildCompilerFactoryImpl(projectDataManager);
}
use of com.google.idea.blaze.base.model.BlazeProjectData in project intellij by bazelbuild.
the class PluginDevSyncTest method testRunConfigurationCreatedDuringSync.
@Test
public void testRunConfigurationCreatedDuringSync() throws Exception {
setProjectView("directories:", " java/com/google", "targets:", " //java/com/google:lib", " //java/com/google:plugin", "workspace_type: intellij_plugin");
workspace.createFile(new WorkspacePath("java/com/google/ClassWithUniqueName1.java"), "package com.google;", "public class ClassWithUniqueName1 {}");
workspace.createFile(new WorkspacePath("java/com/google/ClassWithUniqueName2.java"), "package com.google;", "public class ClassWithUniqueName2 {}");
TargetMap targetMap = TargetMapBuilder.builder().addTarget(TargetIdeInfo.builder().setBuildFile(sourceRoot("java/com/google/BUILD")).setLabel("//java/com/google:lib").setKind("java_library").addSource(sourceRoot("java/com/google/ClassWithUniqueName1.java")).addSource(sourceRoot("java/com/google/ClassWithUniqueName2.java"))).addTarget(TargetIdeInfo.builder().setBuildFile(sourceRoot("java/com/google/BUILD")).setLabel("//java/com/google:plugin").setKind("intellij_plugin_debug_target")).build();
setTargetMap(targetMap);
runBlazeSync(new BlazeSyncParams.Builder("Sync", SyncMode.INCREMENTAL).addProjectViewTargets(true).build());
errorCollector.assertNoIssues();
BlazeProjectData blazeProjectData = BlazeProjectDataManager.getInstance(getProject()).getBlazeProjectData();
assertThat(blazeProjectData).isNotNull();
assertThat(blazeProjectData.targetMap).isEqualTo(targetMap);
assertThat(blazeProjectData.workspaceLanguageSettings.getWorkspaceType()).isEqualTo(WorkspaceType.INTELLIJ_PLUGIN);
List<RunConfiguration> runConfigs = RunManager.getInstance(getProject()).getAllConfigurationsList();
assertThat(runConfigs).hasSize(1);
assertThat(runConfigs.get(0)).isInstanceOf(BlazeIntellijPluginConfiguration.class);
}
Aggregations