Search in sources :

Example 1 with BuildSystemName

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

the class SuggestBuildShardingNotification method suggestIncreasingServerMemory.

private static void suggestIncreasingServerMemory(Project project, BlazeContext context) {
    BuildSystemName buildSystemName = Blaze.getBuildSystemName(project);
    String message = String.format("The %s server ran out of memory during sync. You can work around this by " + "allocating more memory to the %s server, for example by adding this line to " + "your %s:<br>" + "startup --host_jvm_args=-Xmx15g --host_jvm_args=-Xms15g", buildSystemName.getName(), buildSystemName.getName(), buildSystemName == BuildSystemName.Bazel ? ".bazelrc" : "~/.blazerc");
    IssueOutput.error(StringUtil.stripHtml(message, true)).submit(context);
    showNotification(project, message, p -> {
    });
}
Also used : BuildSystemName(com.google.idea.blaze.base.settings.BuildSystemName)

Example 2 with BuildSystemName

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

the class BlazeVcsHandler method vcsHandlerForProject.

@Nullable
static BlazeVcsHandler vcsHandlerForProject(Project project) {
    BuildSystemName buildSystemName = Blaze.getBuildSystemName(project);
    WorkspaceRoot workspaceRoot = WorkspaceRoot.fromProject(project);
    for (BlazeVcsHandler candidate : BlazeVcsHandler.EP_NAME.getExtensions()) {
        if (candidate.handlesProject(buildSystemName, workspaceRoot)) {
            return candidate;
        }
    }
    return null;
}
Also used : BuildSystemName(com.google.idea.blaze.base.settings.BuildSystemName) WorkspaceRoot(com.google.idea.blaze.base.model.primitives.WorkspaceRoot) Nullable(javax.annotation.Nullable)

Example 3 with BuildSystemName

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

the class BlazeCoverageProgramRunner method getBlazeInfo.

@Nullable
private static ListenableFuture<BlazeInfo> getBlazeInfo(Project project, BlazeCommandRunConfiguration config) {
    ProjectViewSet viewSet = ProjectViewManager.getInstance(project).getProjectViewSet();
    if (viewSet == null) {
        return null;
    }
    BlazeInvocationContext invocationContext = BlazeInvocationContext.runConfigContext(ExecutorType.COVERAGE, BlazeCommandRunConfigurationType.getInstance(), /* beforeRunTask= */
    false);
    List<String> infoFlags = BlazeFlags.blazeFlags(project, viewSet, BlazeCommandName.INFO, BlazeContext.create(), invocationContext);
    BuildSystemName buildSystemName = Blaze.getBuildSystemName(project);
    return Scope.push(null, (ScopedFunction<ListenableFuture<BlazeInfo>>) context -> BlazeInfoRunner.getInstance().runBlazeInfo(context, buildSystemName, getBlazeBinary(config), WorkspaceRoot.fromProject(project), infoFlags));
}
Also used : ProjectViewSet(com.google.idea.blaze.base.projectview.ProjectViewSet) BlazeInfoRunner(com.google.idea.blaze.base.command.info.BlazeInfoRunner) BlazeContext(com.google.idea.blaze.base.scope.BlazeContext) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) BlazeCommandRunConfigurationType(com.google.idea.blaze.base.run.BlazeCommandRunConfigurationType) ExecutionException(com.intellij.execution.ExecutionException) IntConsumer(java.util.function.IntConsumer) ProcessAdapter(com.intellij.execution.process.ProcessAdapter) ScopedFunction(com.google.idea.blaze.base.scope.ScopedFunction) ProjectViewManager(com.google.idea.blaze.base.projectview.ProjectViewManager) Supplier(java.util.function.Supplier) BlazeCommandRunConfiguration(com.google.idea.blaze.base.run.BlazeCommandRunConfiguration) CoverageHelper(com.intellij.coverage.CoverageHelper) RunProfileState(com.intellij.execution.configurations.RunProfileState) DefaultProgramRunner(com.intellij.execution.runners.DefaultProgramRunner) CoverageUtils(com.google.idea.blaze.base.run.coverage.CoverageUtils) ExecutionEnvironment(com.intellij.execution.runners.ExecutionEnvironment) Scope(com.google.idea.blaze.base.scope.Scope) Project(com.intellij.openapi.project.Project) Logger(com.intellij.openapi.diagnostic.Logger) REPLACE_EXISTING(java.nio.file.StandardCopyOption.REPLACE_EXISTING) CoverageEnabledConfiguration(com.intellij.execution.configurations.coverage.CoverageEnabledConfiguration) Nullable(javax.annotation.Nullable) CoverageRunnerData(com.intellij.coverage.CoverageRunnerData) Blaze(com.google.idea.blaze.base.settings.Blaze) ConfigurationInfoProvider(com.intellij.execution.configurations.ConfigurationInfoProvider) OutputStream(java.io.OutputStream) Files(java.nio.file.Files) BuildSystemName(com.google.idea.blaze.base.settings.BuildSystemName) RunProfile(com.intellij.execution.configurations.RunProfile) IOException(java.io.IOException) RunnerSettings(com.intellij.execution.configurations.RunnerSettings) BlazeCommandRunConfigurationCommonState(com.google.idea.blaze.base.run.state.BlazeCommandRunConfigurationCommonState) File(java.io.File) ProcessHandler(com.intellij.execution.process.ProcessHandler) BlazeCommandName(com.google.idea.blaze.base.command.BlazeCommandName) KillableProcess(com.intellij.execution.KillableProcess) ExecutorType(com.google.idea.blaze.base.run.ExecutorType) List(java.util.List) RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor) Paths(java.nio.file.Paths) EventLoggingService(com.google.idea.blaze.base.logging.EventLoggingService) ProjectViewSet(com.google.idea.blaze.base.projectview.ProjectViewSet) BlazeFlags(com.google.idea.blaze.base.command.BlazeFlags) WorkspaceRoot(com.google.idea.blaze.base.model.primitives.WorkspaceRoot) ProcessEvent(com.intellij.execution.process.ProcessEvent) BlazeInvocationContext(com.google.idea.blaze.base.command.BlazeInvocationContext) BlazeInfo(com.google.idea.blaze.base.command.info.BlazeInfo) BlazeInvocationContext(com.google.idea.blaze.base.command.BlazeInvocationContext) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) BuildSystemName(com.google.idea.blaze.base.settings.BuildSystemName) Nullable(javax.annotation.Nullable)

Example 4 with BuildSystemName

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

the class BlazeAndroidWorkspaceImporterTest method importJavaWorkspace.

private BlazeJavaImportResult importJavaWorkspace(WorkspaceRoot workspaceRoot, TargetMap targetMap, ProjectView projectView) {
    BuildSystemName buildSystemName = Blaze.getBuildSystemName(project);
    ProjectViewSet projectViewSet = ProjectViewSet.builder().add(projectView).build();
    JavaSourceFilter sourceFilter = new JavaSourceFilter(buildSystemName, workspaceRoot, projectViewSet, targetMap);
    BlazeJavaWorkspaceImporter blazeWorkspaceImporter = new BlazeJavaWorkspaceImporter(project, workspaceRoot, projectViewSet, workspaceLanguageSettings, targetMap, sourceFilter, jdepsMap, workingSet, FAKE_ARTIFACT_DECODER, /* oldSyncState= */
    null);
    return blazeWorkspaceImporter.importWorkspace(context);
}
Also used : ProjectViewSet(com.google.idea.blaze.base.projectview.ProjectViewSet) JavaSourceFilter(com.google.idea.blaze.java.sync.importer.JavaSourceFilter) BuildSystemName(com.google.idea.blaze.base.settings.BuildSystemName) BlazeJavaWorkspaceImporter(com.google.idea.blaze.java.sync.importer.BlazeJavaWorkspaceImporter)

Example 5 with BuildSystemName

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

the class BlazeEditProjectViewControl method modifyInitialProjectView.

private static String modifyInitialProjectView(BuildSystemName buildSystemName, String initialProjectViewText, WorkspacePathResolver workspacePathResolver) {
    BlazeContext context = BlazeContext.create();
    ProjectViewParser projectViewParser = new ProjectViewParser(context, workspacePathResolver);
    projectViewParser.parseProjectView(initialProjectViewText);
    ProjectViewSet projectViewSet = projectViewParser.getResult();
    ProjectViewFile projectViewFile = projectViewSet.getTopLevelProjectViewFile();
    if (projectViewFile == null) {
        return initialProjectViewText;
    }
    ProjectView projectView = projectViewFile.projectView;
    // Sort default value providers to match the section order
    List<SectionKey<?, ?>> sectionKeys = Sections.getParsers().stream().map(SectionParser::getSectionKey).collect(toList());
    List<ProjectViewDefaultValueProvider> defaultValueProviders = Lists.newArrayList(ProjectViewDefaultValueProvider.EP_NAME.getExtensions());
    defaultValueProviders.sort(Comparator.comparingInt(val -> sectionKeys.indexOf(val.getSectionKey())));
    for (ProjectViewDefaultValueProvider defaultValueProvider : defaultValueProviders) {
        projectView = defaultValueProvider.addProjectViewDefaultValue(buildSystemName, projectViewSet, projectView);
    }
    return ProjectViewParser.projectViewToString(projectView);
}
Also used : ProjectViewSet(com.google.idea.blaze.base.projectview.ProjectViewSet) ScalarSection(com.google.idea.blaze.base.projectview.section.ScalarSection) LanguageSupport(com.google.idea.blaze.base.sync.projectview.LanguageSupport) TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) Sections(com.google.idea.blaze.base.projectview.section.sections.Sections) JBLabel(com.intellij.ui.components.JBLabel) JPanelProvidingProject(com.google.idea.blaze.base.settings.ui.JPanelProvidingProject) UiUtil(com.google.idea.blaze.base.ui.UiUtil) ApplicationNamesInfo(com.intellij.openapi.application.ApplicationNamesInfo) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) Messages(com.intellij.openapi.ui.Messages) Logger(com.intellij.openapi.diagnostic.Logger) BorderLayout(java.awt.BorderLayout) ProgressManager(com.intellij.openapi.progress.ProgressManager) PropertiesComponent(com.intellij.ide.util.PropertiesComponent) BlazeValidationResult(com.google.idea.blaze.base.ui.BlazeValidationResult) RecentProjectsManager(com.intellij.ide.RecentProjectsManager) ProjectView(com.google.idea.blaze.base.projectview.ProjectView) BuildSystemName(com.google.idea.blaze.base.settings.BuildSystemName) WorkspaceLanguageSettings(com.google.idea.blaze.base.sync.projectview.WorkspaceLanguageSettings) BorderFactory(javax.swing.BorderFactory) ProjectViewDefaultValueProvider(com.google.idea.blaze.base.projectview.section.ProjectViewDefaultValueProvider) TextComponentAccessor(com.intellij.openapi.ui.TextComponentAccessor) Component(java.awt.Component) JRadioButton(javax.swing.JRadioButton) TargetSection(com.google.idea.blaze.base.projectview.section.sections.TargetSection) Propagation(com.google.idea.blaze.base.scope.OutputSink.Propagation) List(java.util.List) SystemProperties(com.intellij.util.SystemProperties) ImportSection(com.google.idea.blaze.base.projectview.section.sections.ImportSection) ProjectViewSet(com.google.idea.blaze.base.projectview.ProjectViewSet) WorkspaceRoot(com.google.idea.blaze.base.model.primitives.WorkspaceRoot) GridBagLayout(java.awt.GridBagLayout) WorkspaceTypeData(com.google.idea.blaze.base.wizard2.WorkspaceTypeData) JPanel(javax.swing.JPanel) SectionParser(com.google.idea.blaze.base.projectview.section.SectionParser) SectionKey(com.google.idea.blaze.base.projectview.section.SectionKey) BlazeContext(com.google.idea.blaze.base.scope.BlazeContext) JTextField(javax.swing.JTextField) DirectorySection(com.google.idea.blaze.base.projectview.section.sections.DirectorySection) Hashing(com.google.common.hash.Hashing) Lists(com.google.common.collect.Lists) Scope(com.google.idea.blaze.base.scope.Scope) BlazeDataStorage(com.google.idea.blaze.base.sync.data.BlazeDataStorage) BoolExperiment(com.google.idea.common.experiments.BoolExperiment) IssueOutput(com.google.idea.blaze.base.scope.output.IssueOutput) WorkspacePathResolver(com.google.idea.blaze.base.sync.workspace.WorkspacePathResolver) Nullable(javax.annotation.Nullable) ProjectViewFile(com.google.idea.blaze.base.projectview.ProjectViewSet.ProjectViewFile) ProjectDataDirectoryValidator(com.google.idea.blaze.base.wizard2.ProjectDataDirectoryValidator) ButtonGroup(javax.swing.ButtonGroup) HashCode(com.google.common.hash.HashCode) ProjectViewParser(com.google.idea.blaze.base.projectview.parser.ProjectViewParser) StringUtil(com.intellij.openapi.util.text.StringUtil) BlazeSelectProjectViewOption(com.google.idea.blaze.base.wizard2.BlazeSelectProjectViewOption) IOException(java.io.IOException) BlazeNewProjectBuilder(com.google.idea.blaze.base.wizard2.BlazeNewProjectBuilder) ProjectViewStorageManager(com.google.idea.blaze.base.projectview.ProjectViewStorageManager) Disposable(com.intellij.openapi.Disposable) File(java.io.File) Category(com.google.idea.blaze.base.scope.output.IssueOutput.Category) JScrollPane(javax.swing.JScrollPane) General(com.intellij.icons.AllIcons.General) Collectors.toList(java.util.stream.Collectors.toList) BlazeValidationError(com.google.idea.blaze.base.ui.BlazeValidationError) ProjectViewVerifier(com.google.idea.blaze.base.projectview.ProjectViewVerifier) DirectoryEntry(com.google.idea.blaze.base.projectview.section.sections.DirectoryEntry) ProjectViewUi(com.google.idea.blaze.base.settings.ui.ProjectViewUi) JLabel(javax.swing.JLabel) WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) PathUtil(com.intellij.util.PathUtil) Comparator(java.util.Comparator) BlazeContext(com.google.idea.blaze.base.scope.BlazeContext) ProjectViewFile(com.google.idea.blaze.base.projectview.ProjectViewSet.ProjectViewFile) SectionKey(com.google.idea.blaze.base.projectview.section.SectionKey) ProjectView(com.google.idea.blaze.base.projectview.ProjectView) ProjectViewDefaultValueProvider(com.google.idea.blaze.base.projectview.section.ProjectViewDefaultValueProvider) ProjectViewParser(com.google.idea.blaze.base.projectview.parser.ProjectViewParser)

Aggregations

BuildSystemName (com.google.idea.blaze.base.settings.BuildSystemName)11 File (java.io.File)5 IOException (java.io.IOException)4 WorkspacePath (com.google.idea.blaze.base.model.primitives.WorkspacePath)3 WorkspaceRoot (com.google.idea.blaze.base.model.primitives.WorkspaceRoot)3 ProjectViewSet (com.google.idea.blaze.base.projectview.ProjectViewSet)3 Nullable (javax.annotation.Nullable)3 GradleCoordinate (com.android.ide.common.repository.GradleCoordinate)2 MavenArtifactLocator (com.google.idea.blaze.android.projectsystem.MavenArtifactLocator)2 BlazeInfo (com.google.idea.blaze.base.command.info.BlazeInfo)2 FileOperationProvider (com.google.idea.blaze.base.io.FileOperationProvider)2 Label (com.google.idea.blaze.base.model.primitives.Label)2 BlazeContext (com.google.idea.blaze.base.scope.BlazeContext)2 Scope (com.google.idea.blaze.base.scope.Scope)2 Logger (com.intellij.openapi.diagnostic.Logger)2 List (java.util.List)2 Before (org.junit.Before)2 PathString (com.android.ide.common.util.PathString)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ImmutableMap (com.google.common.collect.ImmutableMap)1