org.eclipse.xtext.builder.impl.IBuildFlag Java Examples
The following examples show how to use
org.eclipse.xtext.builder.impl.IBuildFlag.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XtextBuildTriggerTest.java From dsl-devkit with Eclipse Public License 1.0 | 6 votes |
@Test public void testTriggerRespectsAutoBuilding() { XtextBuildTrigger buildTrigger = get(XtextBuildTrigger.class); // auto-build disabled when(workspace.isAutoBuilding()).thenReturn(false); buildTrigger.scheduleFullBuild(); verify(scheduler, never()).scheduleBuildIfNecessary(Matchers.<Iterable<IProject>> any(), Matchers.<IBuildFlag> any()); reset(workspace); reset(scheduler); // auto-build enabled IWorkspaceRoot root = mock(IWorkspaceRoot.class); IProject[] projects = new IProject[0]; when(workspace.isAutoBuilding()).thenReturn(true); when(workspace.getRoot()).thenReturn(root); when(root.getProjects()).thenReturn(projects); buildTrigger.scheduleFullBuild(); verify(scheduler).scheduleBuildIfNecessary(eq(Arrays.asList(projects)), Matchers.<IBuildFlag[]> anyVararg()); }
Example #2
Source File: N4JSExternalLibraryStartup.java From n4js with Eclipse Public License 1.0 | 5 votes |
@Override public void earlyStartup() { // Client code can still clone the repository on demand. (Mind plug-in UI tests.) // TODO this should be a job that we can wait for new Thread(() -> { // trigger index loading which will potentially announce a recovery build on all projects to be // necessary // XXX it is crucial to call isEmpty before isRecoveryBuildRequired is checked, since isEmpty // will set internal state that is afterwards queried by isRecoveryBuildRequired boolean indexIsEmpty = builderState.isEmpty(); // check if this recovery build was really required if (descriptionPersister.isRecoveryBuildRequired() || indexIsEmpty) { // TODO return something like a Future that allows to say // descriptionPersister.scheduleRecoveryBuildOnContributions().andThen(buildManager...) descriptionPersister.scheduleRecoveryBuildOnContributions(); Map<String, String> args = Maps.newHashMap(); IBuildFlag.RECOVERY_BUILD.addToMap(args); builderStateDiscarder.forgetLastBuildState(Arrays.asList(workspace.getRoot().getProjects()), args); } }).start(); // Add listener to monitor Cut and Copy commands ICommandService commandService = PlatformUI.getWorkbench().getAdapter(ICommandService.class); if (commandService != null) { commandService.addExecutionListener(new CheckNodeModulesSyncOnRefresh()); } }
Example #3
Source File: EclipseExternalLibraryWorkspace.java From n4js with Eclipse Public License 1.0 | 5 votes |
@Override public void scheduleWorkspaceProjects(IProgressMonitor monitor, Set<SafeURI<?>> toBeScheduled) { Set<IProject> scheduledProjects = newHashSet(); for (SafeURI<?> scheduledURI : toBeScheduled) { IN4JSProject wsProject = core.findProject(scheduledURI.toURI()).orNull(); if (wsProject instanceof IN4JSEclipseProject) { IN4JSEclipseProject n4EclProject = (IN4JSEclipseProject) wsProject; scheduledProjects.add(n4EclProject.getProject()); } } Map<String, String> args = new HashMap<>(); IBuildFlag.FORGET_BUILD_STATE_ONLY.addToMap(args); builderStateDiscarder.forgetLastBuildState(scheduledProjects, args); }
Example #4
Source File: ExternalLibrariesReloadHelper.java From n4js with Eclipse Public License 1.0 | 5 votes |
private void reloadLibrariesInternal(final boolean refreshNpmDefinitions, final IProgressMonitor monitor) throws InvocationTargetException { final SubMonitor subMonitor = SubMonitor.convert(monitor, refreshNpmDefinitions ? 2 : 1); if (monitor instanceof Cancelable) { ((Cancelable) monitor).setCancelable(false); // No cancel is allowed from now on. } if (monitor.isCanceled()) { return; } // Refresh the type definitions for the npm packages if required. if (refreshNpmDefinitions) { final IStatus refreshStatus = libManager.registerAllExternalProjects(subMonitor.newChild(1)); if (!refreshStatus.isOK()) { throw new InvocationTargetException(new CoreException(refreshStatus)); } } // Make sure to rebuild only those external ones that are not in the workspace. // Get all accessible workspace projects... final Collection<String> workspaceProjectNames = from(asList(getWorkspace().getRoot().getProjects())) .filter(p -> p.isAccessible()) .transform(p -> p.getName()) .toSet(); // And build all those externals that has no corresponding workspace project. final Collection<N4JSExternalProject> toBuild = from(projectProvider.getProjects()) .filter(p -> !workspaceProjectNames.contains(p.getName())).toList(); final Collection<IProject> workspaceProjectsToRebuild = collector.getWSProjectsDependendingOn(toBuild); externalBuilder.build(toBuild, subMonitor.newChild(1)); Map<String, String> args = new HashMap<>(); IBuildFlag.FORGET_BUILD_STATE_ONLY.addToMap(args); builderStateDiscarder.forgetLastBuildState(workspaceProjectsToRebuild, args); }
Example #5
Source File: ListenerRegistrar.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public void initialize() { workspace.addResourceChangeListener(listener); // If there are no open projects in a workspace after a restart, a newly opened Xtext project will // trigger the infrastructure's initialization procedure. Since the listeners are than registered // after the fact, the project-open event is already done. Thus no build is triggered for the newly // opened project and the index state is corrupt. // thus we trigger a recovery build here class RecoveryBuildTrigger extends WorkspaceJob { public RecoveryBuildTrigger() { super("Schedule Xtext recovery build on start-up"); } @Override public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } if (builderState.isEmpty()) { buildManager.scheduleBuildIfNecessary(Arrays.asList(workspace.getRoot().getProjects()), IBuildFlag.RECOVERY_BUILD); } return Status.OK_STATUS; } } RecoveryBuildTrigger recoveryBuildTrigger = new RecoveryBuildTrigger(); recoveryBuildTrigger.schedule(); }
Example #6
Source File: UIResourceChangeRegistry.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
private void forgetBuildState() { final Function1<IProject, Boolean> _function = (IProject it) -> { try { return Boolean.valueOf(((it.isAccessible() && it.hasNature(XtextProjectHelper.NATURE_ID)) && it.hasNature(JavaCore.NATURE_ID))); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }; final Iterable<IProject> projects = IterableExtensions.<IProject>filter(((Iterable<IProject>)Conversions.doWrapArray(this.workspace.getRoot().getProjects())), _function); this.scheduler.scheduleBuildIfNecessary(projects, IBuildFlag.FORGET_BUILD_STATE_ONLY); }
Example #7
Source File: ProjectClasspathChangeListener.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Deprecated private void scheduleBuildIfNecessary(Set<IProject> projects) { buildManager.scheduleBuildIfNecessary(projects, IBuildFlag.FORGET_BUILD_STATE_ONLY); }
Example #8
Source File: EMFBasedPersister.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
protected void scheduleRecoveryBuild() { Iterable<IProject> projects = Lists.newArrayList(workspace.getRoot().getProjects()); buildManager.scheduleBuildIfNecessary(projects, IBuildFlag.RECOVERY_BUILD); }