use of com.google.idea.blaze.android.libraries.RenderJarCache in project intellij by bazelbuild.
the class RenderJarClassFileFinderTest method initTest.
@Before
public void initTest() throws ArtifactNotFoundException {
TargetMap targetMap = buildTargetMap();
setTargetMap(targetMap);
// Since this is not a light test, the ArtifactLocationDecoder points to the actual file in the
// File System
artifactLocationDecoder = new MockArtifactLocationDecoder() {
@Override
public File decode(ArtifactLocation artifactLocation) {
File f = new File(fileSystem.getRootDir(), artifactLocation.getExecutionRootRelativePath());
// Create the artifact if it does not exist
// This allows us to set fileModifiedTime for the file which is used by RenderJarCache
FileOperationProvider.getInstance().mkdirs(f);
// Set last modified time for RenderJarCache to use
FileOperationProvider.getInstance().setFileModifiedTime(f, 1000L);
return f;
}
};
registerProjectService(BlazeProjectDataManager.class, new MockBlazeProjectDataManager(MockBlazeProjectDataBuilder.builder(workspaceRoot).setTargetMap(targetMap).setArtifactLocationDecoder(artifactLocationDecoder).build()));
setProjectView("targets:", " //com/google/example/simple/bin_a:bin_a", " //com/google/example/simple/bin_b:bin_b", " //com/google/example/simple/bin_c:bin_c");
MockExperimentService experimentService = new MockExperimentService();
registerApplicationComponent(ExperimentService.class, experimentService);
experimentService.setExperiment(RenderResolveOutputGroupProvider.buildOnSync, true);
// Disable resource resolution from Render Jars
experimentService.setExperiment(RenderJarClassFileFinder.resolveResourceClasses, false);
ApplicationManager.getApplication().runWriteAction(this::createAndRegisterModules);
artifactCache = new MockArtifactCache();
registerExtension(FileCache.EP_NAME, new RenderJarCache.FileCacheAdapter());
registerProjectService(RenderJarCache.class, new RenderJarCache(getProject(), RenderJarCache.getCacheDirForProject(getProject()), artifactCache));
createBinaryJars();
FileCache.EP_NAME.extensions().forEach(ep -> ep.initialize(getProject()));
}
Aggregations