use of com.google.idea.blaze.base.model.primitives.Kind.ApplicationState in project intellij by bazelbuild.
the class RenderJarCacheTest method initTest.
@Before
public void initTest() throws IOException {
errorCollector = new ErrorCollector();
outputSink = new WritingOutputSink();
context = BlazeContext.create();
context.addOutputSink(PrintOutput.class, outputSink);
workspaceRoot = new WorkspaceRoot(temporaryFolder.getRoot());
artifactLocationDecoder = new MockArtifactLocationDecoder() {
@Override
public File decode(ArtifactLocation artifactLocation) {
return new File(workspaceRoot.directory(), artifactLocation.getRelativePath());
}
};
registerMockBlazeImportSettings();
mockedArtifactCache = Mockito.mock(ArtifactCache.class);
intellijRule.registerProjectService(RenderJarCache.class, new RenderJarCache(intellijRule.getProject(), RenderJarCache.getCacheDirForProject(intellijRule.getProject()), mockedArtifactCache));
intellijRule.registerApplicationService(FileOperationProvider.class, new FileOperationProvider());
intellijRule.registerApplicationService(RemoteArtifactPrefetcher.class, new DefaultPrefetcher());
intellijRule.registerExtensionPoint(FileCache.EP_NAME, FileCache.class);
intellijRule.registerExtension(FileCache.EP_NAME, new FileCacheAdapter());
// Required to enable RenderJarClassFileFinder
MockExperimentService experimentService = new MockExperimentService();
experimentService.setExperiment(RenderResolveOutputGroupProvider.buildOnSync, true);
intellijRule.registerApplicationService(ExperimentService.class, experimentService);
// Setup needed for setting a projectview
intellijRule.registerExtensionPoint(BlazeSyncPlugin.EP_NAME, BlazeSyncPlugin.class);
intellijRule.registerExtension(BlazeSyncPlugin.EP_NAME, new BlazeJavaSyncPlugin());
// RenderJarCache looks at targets of `Kind`s with LanguageClass.ANDROID
// so we need to setup the framework for fetching a target's `Kind`
intellijRule.registerExtensionPoint(Kind.Provider.EP_NAME, Kind.Provider.class);
intellijRule.registerExtension(Kind.Provider.EP_NAME, new AndroidBlazeRules());
intellijRule.registerApplicationService(ApplicationState.class, new ApplicationState());
// registered because `RenderJarCache` uses it to filter source targets
projectViewManager = new MockProjectViewManager();
intellijRule.registerProjectService(ProjectViewManager.class, projectViewManager);
intellijRule.registerApplicationService(BlazeExecutor.class, new MockBlazeExecutor());
setupProjectData();
setProjectView("directories:", " com/foo/bar/baz", " com/foo/bar/qux", "targets:", " //com/foo/bar/baz:baz", " //com/foo/bar/qux:quz");
}
Aggregations