Search in sources :

Example 6 with BlazeImportSettings

use of com.google.idea.blaze.base.settings.BlazeImportSettings in project intellij by bazelbuild.

the class BlazeResolveConfigurationEquivalenceTest method initTest.

@Override
protected void initTest(Container applicationServices, Container projectServices) {
    super.initTest(applicationServices, projectServices);
    applicationServices.register(BlazeExecutor.class, new MockBlazeExecutor());
    CPPEnvironmentAdapter.registerForTest(applicationServices.getPicoContainer());
    applicationServices.register(ExperimentService.class, new MockExperimentService());
    applicationServices.register(CompilerVersionChecker.class, new MockCompilerVersionChecker("1234"));
    applicationServices.register(ProgressManager.class, new ProgressManagerImpl());
    applicationServices.register(VirtualFileManager.class, mock(VirtualFileManager.class));
    mockFileSystem = mock(LocalFileSystem.class);
    applicationServices.register(VirtualFileSystemProvider.class, mock(VirtualFileSystemProvider.class));
    when(VirtualFileSystemProvider.getInstance().getSystem()).thenReturn(mockFileSystem);
    projectServices.register(PsiManager.class, new MockPsiManager(project));
    projectServices.register(BlazeImportSettingsManager.class, new BlazeImportSettingsManager());
    BuildSystemProvider buildSystemProvider = new BazelBuildSystemProvider();
    registerExtensionPoint(BuildSystemProvider.EP_NAME, BuildSystemProvider.class).registerExtension(buildSystemProvider);
    BlazeImportSettingsManager.getInstance(getProject()).setImportSettings(new BlazeImportSettings("", "", "", "", buildSystemProvider.buildSystem()));
    context.addOutputSink(IssueOutput.class, errorCollector);
    resolver = new BlazeConfigurationResolver(project);
    resolverResult = BlazeConfigurationResolverResult.empty(project);
}
Also used : MockExperimentService(com.google.idea.common.experiments.MockExperimentService) BlazeImportSettingsManager(com.google.idea.blaze.base.settings.BlazeImportSettingsManager) BlazeImportSettings(com.google.idea.blaze.base.settings.BlazeImportSettings) VirtualFileManager(com.intellij.openapi.vfs.VirtualFileManager) ProgressManagerImpl(com.intellij.openapi.progress.impl.ProgressManagerImpl) BuildSystemProvider(com.google.idea.blaze.base.bazel.BuildSystemProvider) BazelBuildSystemProvider(com.google.idea.blaze.base.bazel.BazelBuildSystemProvider) MockPsiManager(com.intellij.mock.MockPsiManager) MockBlazeExecutor(com.google.idea.blaze.base.async.executor.MockBlazeExecutor) VirtualFileSystemProvider(com.google.idea.blaze.base.io.VirtualFileSystemProvider) LocalFileSystem(com.intellij.openapi.vfs.LocalFileSystem) BazelBuildSystemProvider(com.google.idea.blaze.base.bazel.BazelBuildSystemProvider)

Example 7 with BlazeImportSettings

use of com.google.idea.blaze.base.settings.BlazeImportSettings in project intellij by bazelbuild.

the class BlazeIntegrationTestCase method setUp.

@Before
public final void setUp() throws Exception {
    IdeaTestFixtureFactory factory = IdeaTestFixtureFactory.getFixtureFactory();
    TestFixtureBuilder<IdeaProjectTestFixture> fixtureBuilder = factory.createLightFixtureBuilder(LightCodeInsightFixtureTestCase.JAVA_8);
    final IdeaProjectTestFixture fixture = fixtureBuilder.getFixture();
    testFixture = factory.createCodeInsightFixture(fixture, new LightTempDirTestFixtureImpl(true));
    testFixture.setUp();
    fileSystem = new TestFileSystem(getProject(), testFixture.getTempDirFixture());
    runWriteAction(() -> {
        ProjectJdkTable.getInstance().addJdk(IdeaTestUtil.getMockJdk18());
        VirtualFile workspaceRootVirtualFile = fileSystem.createDirectory("workspace");
        workspaceRoot = new WorkspaceRoot(new File(workspaceRootVirtualFile.getPath()));
        projectDataDirectory = fileSystem.createDirectory("project-data-dir");
        workspace = new WorkspaceFileSystem(workspaceRoot, fileSystem);
    });
    BlazeImportSettingsManager.getInstance(getProject()).setImportSettings(new BlazeImportSettings(workspaceRoot.toString(), "test-project", projectDataDirectory.getPath(), workspaceRoot.fileForPath(new WorkspacePath("project-view-file")).getPath(), buildSystem()));
    registerApplicationService(FileOperationProvider.class, new TestFileSystem.MockFileOperationProvider());
    registerApplicationService(InputStreamProvider.class, file -> {
        VirtualFile vf = fileSystem.findFile(file.getPath());
        if (vf == null) {
            throw new FileNotFoundException();
        }
        return vf.getInputStream();
    });
    registerApplicationService(VirtualFileSystemProvider.class, new TestFileSystem.TempVirtualFileSystemProvider());
    String requiredPlugins = System.getProperty("idea.required.plugins.id");
    if (requiredPlugins != null) {
        VerifyRequiredPluginsEnabled.runCheck(requiredPlugins.split(","));
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) BlazeImportSettings(com.google.idea.blaze.base.settings.BlazeImportSettings) IdeaTestFixtureFactory(com.intellij.testFramework.fixtures.IdeaTestFixtureFactory) FileNotFoundException(java.io.FileNotFoundException) LightTempDirTestFixtureImpl(com.intellij.testFramework.fixtures.impl.LightTempDirTestFixtureImpl) WorkspaceRoot(com.google.idea.blaze.base.model.primitives.WorkspaceRoot) IdeaProjectTestFixture(com.intellij.testFramework.fixtures.IdeaProjectTestFixture) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) Before(org.junit.Before)

Example 8 with BlazeImportSettings

use of com.google.idea.blaze.base.settings.BlazeImportSettings in project intellij by bazelbuild.

the class BlazeAndroidProjectPathsTest method mockBlazeImportSettings.

private void mockBlazeImportSettings(Container projectServices) {
    BlazeImportSettingsManager importSettingsManager = new BlazeImportSettingsManager();
    importSettingsManager.setImportSettings(new BlazeImportSettings("", "", "", "", Blaze.BuildSystem.Blaze));
    projectServices.register(BlazeImportSettingsManager.class, importSettingsManager);
}
Also used : BlazeImportSettingsManager(com.google.idea.blaze.base.settings.BlazeImportSettingsManager) BlazeImportSettings(com.google.idea.blaze.base.settings.BlazeImportSettings)

Example 9 with BlazeImportSettings

use of com.google.idea.blaze.base.settings.BlazeImportSettings in project intellij by bazelbuild.

the class BlazeBuildSystemServiceTest method mockBlazeImportSettings.

private void mockBlazeImportSettings(Container projectServices) {
    BlazeImportSettingsManager importSettingsManager = new BlazeImportSettingsManager();
    importSettingsManager.setImportSettings(new BlazeImportSettings("", "", "", "", Blaze.BuildSystem.Blaze));
    projectServices.register(BlazeImportSettingsManager.class, importSettingsManager);
}
Also used : BlazeImportSettingsManager(com.google.idea.blaze.base.settings.BlazeImportSettingsManager) BlazeImportSettings(com.google.idea.blaze.base.settings.BlazeImportSettings)

Example 10 with BlazeImportSettings

use of com.google.idea.blaze.base.settings.BlazeImportSettings in project intellij by bazelbuild.

the class BlazeAndroidModelTest method initTest.

@Override
protected void initTest(Container applicationServices, Container projectServices) {
    applicationServices.register(FileTypeManager.class, new MockFileTypeManager());
    applicationServices.register(FileDocumentManager.class, new MockFileDocumentManagerImpl(null, null));
    applicationServices.register(VirtualFileManager.class, mock(VirtualFileManager.class));
    applicationServices.register(BlazeBuildService.class, new BlazeBuildService());
    projectServices.register(ProjectScopeBuilder.class, new ProjectScopeBuilderImpl(project));
    projectServices.register(ProjectViewManager.class, new MockProjectViewManager());
    projectServices.register(BlazeProjectDataManager.class, new BlazeProjectDataManagerImpl(project));
    BlazeImportSettingsManager manager = new BlazeImportSettingsManager();
    manager.setImportSettings(new BlazeImportSettings("", "", "", "", BuildSystem.Blaze));
    projectServices.register(BlazeImportSettingsManager.class, manager);
    facade = new MockJavaPsiFacade(project, new MockPsiManager(project), ImmutableList.of("com.google.example.Modified", "com.google.example.NotModified"));
    projectServices.register(JavaPsiFacade.class, facade);
    module = new MockModule(() -> {
    });
    model = new BlazeAndroidModel(project, module, null, mock(SourceProvider.class), null, "", 0);
}
Also used : BlazeImportSettingsManager(com.google.idea.blaze.base.settings.BlazeImportSettingsManager) MockFileDocumentManagerImpl(com.intellij.mock.MockFileDocumentManagerImpl) BlazeImportSettings(com.google.idea.blaze.base.settings.BlazeImportSettings) VirtualFileManager(com.intellij.openapi.vfs.VirtualFileManager) BlazeProjectDataManagerImpl(com.google.idea.blaze.base.sync.data.BlazeProjectDataManagerImpl) MockFileTypeManager(com.intellij.openapi.fileTypes.MockFileTypeManager) MockPsiManager(com.intellij.mock.MockPsiManager) MockModule(com.intellij.mock.MockModule) BlazeBuildService(com.google.idea.blaze.base.actions.BlazeBuildService) ProjectScopeBuilderImpl(com.intellij.psi.search.ProjectScopeBuilderImpl)

Aggregations

BlazeImportSettings (com.google.idea.blaze.base.settings.BlazeImportSettings)16 BlazeImportSettingsManager (com.google.idea.blaze.base.settings.BlazeImportSettingsManager)8 File (java.io.File)6 WorkspaceRoot (com.google.idea.blaze.base.model.primitives.WorkspaceRoot)4 Nullable (javax.annotation.Nullable)4 MockExperimentService (com.google.idea.common.experiments.MockExperimentService)3 VirtualFileManager (com.intellij.openapi.vfs.VirtualFileManager)3 MockBlazeExecutor (com.google.idea.blaze.base.async.executor.MockBlazeExecutor)2 BazelBuildSystemProvider (com.google.idea.blaze.base.bazel.BazelBuildSystemProvider)2 BuildSystemProvider (com.google.idea.blaze.base.bazel.BuildSystemProvider)2 VirtualFileSystemProvider (com.google.idea.blaze.base.io.VirtualFileSystemProvider)2 WorkspacePath (com.google.idea.blaze.base.model.primitives.WorkspacePath)2 MockModule (com.intellij.mock.MockModule)2 MockPsiManager (com.intellij.mock.MockPsiManager)2 MockFileTypeManager (com.intellij.openapi.fileTypes.MockFileTypeManager)2 ProgressManagerImpl (com.intellij.openapi.progress.impl.ProgressManagerImpl)2 LocalFileSystem (com.intellij.openapi.vfs.LocalFileSystem)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 ProjectScopeBuilderImpl (com.intellij.psi.search.ProjectScopeBuilderImpl)2 IOException (java.io.IOException)2