use of com.google.idea.blaze.android.sync.BlazeAndroidSyncPlugin in project intellij by bazelbuild.
the class UnpackedAarsTest method initTest.
@Override
protected void initTest(Container applicationServices, Container projectServices) {
writingOutputSink = new WritingOutputSink();
context = BlazeContext.create();
context.addOutputSink(PrintOutput.class, writingOutputSink);
workspaceRoot = new WorkspaceRoot(folder.getRoot());
localArtifactLocationDecoder = new MockArtifactLocationDecoder() {
@Override
public File decode(ArtifactLocation artifactLocation) {
return new File(workspaceRoot.directory(), artifactLocation.getRelativePath());
}
};
remoteArtifactLocationDecoder = new MockArtifactLocationDecoder() {
@Override
public File decode(ArtifactLocation artifactLocation) {
return new File(workspaceRoot.directory(), artifactLocation.getRelativePath());
}
@Override
public BlazeArtifact resolveOutput(ArtifactLocation artifact) {
if (!artifact.isSource()) {
File file = new File(workspaceRoot.directory(), artifact.getRelativePath());
// when the remote artifact cannot be resolved, it will guess it as local artifact.
return file.exists() ? new FakeRemoteOutputArtifact(file) : super.resolveOutput(artifact);
}
return super.resolveOutput(artifact);
}
};
projectServices.register(BlazeImportSettingsManager.class, new BlazeImportSettingsManager(project));
try {
File projectDataDirectory = folder.newFolder("projectdata");
BlazeImportSettings dummyImportSettings = new BlazeImportSettings("", "", projectDataDirectory.getAbsolutePath(), "", BuildSystemName.Bazel);
BlazeImportSettingsManager.getInstance(project).setImportSettings(dummyImportSettings);
} catch (IOException e) {
throw new AssertionError("Fail to create directory for test", e);
}
applicationServices.register(FileOperationProvider.class, new FileOperationProvider());
applicationServices.register(RemoteArtifactPrefetcher.class, new DefaultPrefetcher());
projectServices.register(UnpackedAars.class, new UnpackedAars(project));
registerExtensionPoint(FileCache.EP_NAME, FileCache.class).registerExtension(new FileCacheAdapter());
registerExtensionPoint(BlazeSyncPlugin.EP_NAME, BlazeSyncPlugin.class).registerExtension(new BlazeAndroidSyncPlugin());
registerExtensionPoint(BlazeLibrarySorter.EP_NAME, BlazeLibrarySorter.class);
applicationServices.register(ExperimentService.class, new MockExperimentService());
}
Aggregations