Java Code Examples for org.eclipse.core.resources.IBuildConfiguration

The following are top voted examples for showing how to use org.eclipse.core.resources.IBuildConfiguration. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: n4js   File: ExternalProjectBuildOrderProvider.java   Source Code and License 5 votes vote down vote up
/**
 * Converts the {@link VertexOrder vertex order} into the appropriate {@link ProjectBuildConfigOrder build
 * configuration order}.
 *
 * @param order
 *            the order to convert.
 * @return the converted vertex order as a build configuration order. The returning configuration can be consumed by
 *         the Eclipse build framework.
 */
private static ProjectBuildConfigOrder vertexOrderToProjectBuildConfigOrder(final VertexOrder order) {
	final IBuildConfiguration[] buildConfigs = new IBuildConfiguration[order.vertexes.length];
	System.arraycopy(order.vertexes, 0, buildConfigs, 0, order.vertexes.length);
	final IBuildConfiguration[][] knots = new IBuildConfiguration[order.knots.length][];
	for (int i = 0; i < order.knots.length; i++) {
		knots[i] = new IBuildConfiguration[order.knots[i].length];
		System.arraycopy(order.knots[i], 0, knots[i], 0, order.knots[i].length);
	}
	return new ProjectBuildConfigOrder(buildConfigs, order.hasCycles, knots);
}
 
Example 2
Project: n4js   File: ExternalProjectBuildOrderProvider.java   Source Code and License 5 votes vote down vote up
@Override
public int compare(final IBuildConfiguration px, final IBuildConfiguration py) {
	int cmp = py.getProject().getName().compareTo(px.getProject().getName());
	if (cmp == 0) {
		cmp = py.getName().compareTo(px.getName());
	}
	return cmp;
}
 
Example 3
Project: n4js   File: ExternalProject.java   Source Code and License 5 votes vote down vote up
/**
 * Like {@link #getActiveBuildConfig()} but doesn't check accessibility. Project must be accessible.
 *
 * @see #getActiveBuildConfig()
 */
/* default */ IBuildConfiguration unsafeGetActiveBuildConfig() {
	String configName = internalGetDescription().getActiveBuildConfig();
	try {
		if (configName != null)
			return getBuildConfig(configName);
	} catch (CoreException e) {
		// Build configuration doesn't exist; treat the first as active.
	}
	return internalGetBuildConfigs(false)[0];
}
 
Example 4
Project: n4js   File: RebuildWorkspaceProjectsJob.java   Source Code and License 5 votes vote down vote up
/**
 * Creates a new job with the already ordered configurations to builder.
 *
 * @param configs
 *            the configurations to build.
 *
 */
public RebuildWorkspaceProjectsJob(final IBuildConfiguration[] configs) {
	super("Building workspace");
	checkState(Platform.isRunning(), "This job requires a running platform");
	this.configs = checkNotNull(configs, "configs");
	setSystem(false);
	setUser(true);
	setRule(BUILD_RULE);
}
 
Example 5
Project: n4js   File: RebuildWorkspaceProjectsScheduler.java   Source Code and License 5 votes vote down vote up
/**
 * Schedules a build with the given projects. Does nothing if the {@link Platform platform} is not running, or the
 * iterable of projects is empty.
 *
 * @param toUpdate
 *            an iterable of projects to build.
 */
public void scheduleBuildIfNecessary(final Iterable<IProject> toUpdate) {
	if (Platform.isRunning() && !Iterables.isEmpty(toUpdate)) {
		final Workspace workspace = (Workspace) ResourcesPlugin.getWorkspace();
		final IBuildConfiguration[] projectsToReBuild = from(asList(workspace.getBuildOrder()))
				.filter(config -> Iterables.contains(toUpdate, config.getProject()))
				.toArray(IBuildConfiguration.class);

		if (!Arrays2.isEmpty(projectsToReBuild)) {
			new RebuildWorkspaceProjectsJob(projectsToReBuild).schedule();
		}
	}
}
 
Example 6
Project: n4js   File: N4JSExternalProject.java   Source Code and License 5 votes vote down vote up
@Override
public IBuildConfiguration[] internalGetReferencedBuildConfigs(final String configName,
		final boolean includeMissing) {

	final IBuildConfiguration[] filteredConfigs = from(referencedBuildConfigs)
			.filter(config -> !includeMissing ? config.getProject().exists() : true)
			.toArray(IBuildConfiguration.class);
	return filteredConfigs;
}
 
Example 7
Project: hybris-commerce-eclipse-plugin   File: EclipseRefreshAndBuildHandler.java   Source Code and License 5 votes vote down vote up
private void refreshAndFullBuild(IProgressMonitor monitor) throws InvocationTargetException {
	
	List<IProject> projects = Arrays.asList(ResourcesPlugin.getWorkspace().getRoot().getProjects());
	boolean isAutoBuildEnabled = isAutoBuildEnabled();	
	 try
     {
		 if (isAutoBuildEnabled)
		 {
			 enableAutoBuild(false);
		 }
		
		// refresh all projects one by one  
		for (IProject project : projects)
		{
			if (project.isOpen())
			{
				project.refreshLocal(IResource.DEPTH_INFINITE, null);
			}
		}
		// do a full build
        ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.CLEAN_BUILD, monitor);
        IBuildConfiguration[] platformBuildConfig = { ResourcesPlugin.getWorkspace().newBuildConfig("platform","platform-build")};
        // build the platform first since other projects depend on it
        ResourcesPlugin.getWorkspace().build(platformBuildConfig, IncrementalProjectBuilder.FULL_BUILD, true, monitor);
        ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, monitor);
      }
      catch (CoreException e)
      {
    	Activator.logError("Failed to synchronize with the platform", e);
        throw new InvocationTargetException(e);
      }
	 if (isAutoBuildEnabled)
	 {
		 enableAutoBuild(true);
	 }
}
 
Example 8
Project: che   File: Workspace.java   Source Code and License 5 votes vote down vote up
@Override
public void build(
    IBuildConfiguration[] iBuildConfigurations,
    int i,
    boolean b,
    IProgressMonitor iProgressMonitor)
    throws CoreException {
  throw new UnsupportedOperationException();
}
 
Example 9
Project: goclipse   File: LangProjectBuilder.java   Source Code and License 5 votes vote down vote up
protected boolean isFirstProjectOfKind() throws CoreException {
	for (IBuildConfiguration buildConfig : getContext().getAllReferencedBuildConfigs()) {
		if(buildConfig.getProject().hasNature(LangCore.NATURE_ID)) {
			return false;
		}
	}
	return true;
}
 
Example 10
Project: goclipse   File: LangProjectBuilder.java   Source Code and License 5 votes vote down vote up
protected boolean isLastProjectOfKind() throws CoreException {
	for (IBuildConfiguration buildConfig : getContext().getAllReferencingBuildConfigs()) {
		if(buildConfig.getProject().hasNature(LangCore.NATURE_ID)) {
			return false;
		}
	}
	return true;
}
 
Example 11
Project: n4js   File: ExternalProject.java   Source Code and License 4 votes vote down vote up
@Override
public IBuildConfiguration getActiveBuildConfig() throws CoreException {
	return new BuildConfiguration(this);
}
 
Example 12
Project: n4js   File: ExternalLibraryBuilderHelper.java   Source Code and License 4 votes vote down vote up
private void doPerformOperation(final IBuildConfiguration[] configs, final BuildOperation operation,
		final IProgressMonitor monitor) {

	if (Arrays2.isEmpty(configs)) {
		return;
	}

	final ISchedulingRule rule = getRule();
	try {
		Job.getJobManager().beginRule(rule, monitor);

		final List<ExternalProject> projects = transform(configs, config -> (ExternalProject) config.getProject());
		final List<IBuildConfiguration> buildOrder = newArrayList(getBuildOrder(projects));
		if (BuildOperation.CLEAN.equals(operation)) {
			Collections.reverse(buildOrder);
		}

		// Remove external projects that have the workspace counterpart if it is a build operation.
		if (BuildOperation.BUILD.equals(operation)) {
			for (final Iterator<IBuildConfiguration> itr = buildOrder.iterator(); itr.hasNext(); /**/) {
				if (hasWorkspaceCounterpart(itr.next())) {
					itr.remove();
				}
			}
		}

		checkState(buildOrder.size() == configs.length,
				"Inconsistency between build configuration and the ordered projects:" +
						"\n\tInput was: " + getProjectNames(configs) +
						"\n\tOrdered was: " + getProjectNames(buildOrder));

		ensureDynamicDependenciesSetForWorkspaceProjects();
		final String prefix = Strings.toFirstUpper(operation.toString().toLowerCase());
		final String projectNames = getProjectNames(buildOrder);
		LOGGER.info(prefix + "ing external libraries: " + projectNames);
		final SubMonitor subMonitor = SubMonitor.convert(monitor, buildOrder.size());
		for (final IBuildConfiguration configuration : buildOrder) {
			final IProject project = configuration.getProject();
			LOGGER.info(prefix + "ing external library: " + project.getName());
			operation.run(this, project, subMonitor.newChild(1));
		}
	} finally {
		Job.getJobManager().endRule(rule);
	}
}
 
Example 13
Project: n4js   File: ExternalLibraryBuilderHelper.java   Source Code and License 4 votes vote down vote up
/**
 * Returns with {@code true} if the external project is accessible in the workspace as well.
 */
private boolean hasWorkspaceCounterpart(IBuildConfiguration config) {
	final URI uri = URI.createPlatformResourceURI(config.getProject().getName(), true);
	final IN4JSProject n4Project = core.findProject(uri).orNull();
	return null != n4Project && n4Project.exists() && !n4Project.isExternal();
}
 
Example 14
Project: n4js   File: ExternalLibraryBuilderHelper.java   Source Code and License 4 votes vote down vote up
private String getProjectNames(final Iterable<IBuildConfiguration> buildOrder) {
	return Iterables.toString(from(buildOrder).transform(c -> c.getProject().getName()));
}
 
Example 15
Project: n4js   File: ExternalLibraryBuilderHelper.java   Source Code and License 4 votes vote down vote up
private String getProjectNames(final IBuildConfiguration[] buildOrder) {
	return Iterables.toString(transform(buildOrder, c -> c.getProject().getName()));
}
 
Example 16
Project: n4js   File: ExternalLibraryBuilderHelper.java   Source Code and License 4 votes vote down vote up
private IBuildConfiguration getBuildConfiguration(final IProject project) {
	return TO_CONFIG_FUNC.apply(project);
}
 
Example 17
Project: che   File: Project.java   Source Code and License 4 votes vote down vote up
@Override
public void build(
    IBuildConfiguration iBuildConfiguration, int i, IProgressMonitor iProgressMonitor)
    throws CoreException {
  throw new UnsupportedOperationException();
}
 
Example 18
Project: che   File: Project.java   Source Code and License 4 votes vote down vote up
@Override
public IBuildConfiguration getActiveBuildConfig() throws CoreException {
  throw new UnsupportedOperationException();
}
 
Example 19
Project: che   File: Project.java   Source Code and License 4 votes vote down vote up
@Override
public IBuildConfiguration getBuildConfig(String s) throws CoreException {
  throw new UnsupportedOperationException();
}
 
Example 20
Project: che   File: Project.java   Source Code and License 4 votes vote down vote up
@Override
public IBuildConfiguration[] getBuildConfigs() throws CoreException {
  throw new UnsupportedOperationException();
}
 
Example 21
Project: che   File: Project.java   Source Code and License 4 votes vote down vote up
@Override
public IBuildConfiguration[] getReferencedBuildConfigs(String s, boolean b) throws CoreException {
  throw new UnsupportedOperationException();
}
 
Example 22
Project: che   File: Workspace.java   Source Code and License 4 votes vote down vote up
@Override
public IBuildConfiguration newBuildConfig(String s, String s1) {
  throw new UnsupportedOperationException();
}
 
Example 23
Project: PerformanceHat   File: AbstractProjectDecorator.java   Source Code and License 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void build(final IBuildConfiguration config, final int kind, final IProgressMonitor monitor) throws CoreException {
  resource().build(config, kind, monitor);
}
 
Example 24
Project: PerformanceHat   File: AbstractProjectDecorator.java   Source Code and License 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public IBuildConfiguration getActiveBuildConfig() throws CoreException {
  return resource().getActiveBuildConfig();
}
 
Example 25
Project: PerformanceHat   File: AbstractProjectDecorator.java   Source Code and License 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public IBuildConfiguration getBuildConfig(final String configName) throws CoreException {
  return resource().getBuildConfig(configName);
}
 
Example 26
Project: PerformanceHat   File: AbstractProjectDecorator.java   Source Code and License 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public IBuildConfiguration[] getBuildConfigs() throws CoreException {
  return resource().getBuildConfigs();
}
 
Example 27
Project: PerformanceHat   File: AbstractProjectDecorator.java   Source Code and License 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public IBuildConfiguration[] getReferencedBuildConfigs(final String configName, final boolean includeMissing) throws CoreException {
  return resource().getReferencedBuildConfigs(configName, includeMissing);
}
 
Example 28
Project: Pydev   File: AbstractIProjectStub.java   Source Code and License 4 votes vote down vote up
@Override
public void build(IBuildConfiguration config, int kind, IProgressMonitor monitor) throws CoreException {
    throw new RuntimeException("Not implemented");
}
 
Example 29
Project: Pydev   File: AbstractIProjectStub.java   Source Code and License 4 votes vote down vote up
@Override
public IBuildConfiguration getActiveBuildConfig() throws CoreException {
    throw new RuntimeException("Not implemented");
}
 
Example 30
Project: Pydev   File: AbstractIProjectStub.java   Source Code and License 4 votes vote down vote up
@Override
public IBuildConfiguration getBuildConfig(String configName) throws CoreException {
    throw new RuntimeException("Not implemented");
}
 
Example 31
Project: Pydev   File: AbstractIProjectStub.java   Source Code and License 4 votes vote down vote up
@Override
public IBuildConfiguration[] getBuildConfigs() throws CoreException {
    throw new RuntimeException("Not implemented");
}
 
Example 32
Project: Pydev   File: AbstractIProjectStub.java   Source Code and License 4 votes vote down vote up
@Override
public IBuildConfiguration[] getReferencedBuildConfigs(String configName, boolean includeMissing)
        throws CoreException {
    throw new RuntimeException("Not implemented");
}
 
Example 33
Project: n4js   File: ExternalProjectBuildOrderProvider.java   Source Code and License 2 votes vote down vote up
/**
 * Computes the build order among specified projects given as the argument.
 *
 * @param projects
 *            the projects.
 * @return the build order as an array of build configuration instances.
 */
public static IBuildConfiguration[] getBuildOrder(final Iterable<ExternalProject> projects) {
	return vertexOrderToProjectBuildConfigOrder(computeActiveBuildConfigOrder(projects)).buildConfigurations;
}
 
Example 34
Project: n4js   File: ExternalLibraryBuilderHelper.java   Source Code and License 2 votes vote down vote up
/**
 * Performs a full build on the given project. Same as {@link #build(IProject)} but a monitor can be provided for
 * the running process.
 *
 * @param project
 *            the project to build.
 * @param monitor
 *            the monitor for the full build operation.
 */
public void build(final IProject project, final IProgressMonitor monitor) {
	build(new IBuildConfiguration[] { new BuildConfiguration(project) }, monitor);
}
 
Example 35
Project: n4js   File: ExternalLibraryBuilderHelper.java   Source Code and License 2 votes vote down vote up
/**
 * Full builds the projects given as an array of build configuration.
 * <p>
 * For information on locking see {@link #getRule()}.
 *
 * @param buildConfigs
 *            the build configurations representing the projects to be built.
 * @param monitor
 *            the monitor for the progress. Must not be {@code null}.
 *
 * @throws IllegalArgumentException
 *             if a scheduling rule is in effect that does not contain the rule returned by {@link #getRule()}. For
 *             more info, see {@link #getRule() here}.
 */
public void build(final IBuildConfiguration[] buildConfigs, final IProgressMonitor monitor) {
	doPerformOperation(buildConfigs, BuildOperation.BUILD, monitor);
}
 
Example 36
Project: n4js   File: ExternalLibraryBuilderHelper.java   Source Code and License 2 votes vote down vote up
/**
 * Cleans the given project. Same as {@link #clean(IProject)} but additional {@link IProgressMonitor monitor} can be
 * provided for the operation.
 *
 * @param project
 *            the project that has to be cleaned (without rebuilding it).
 * @param monitor
 *            monitor for the clean process.
 */
public void clean(final IProject project, final IProgressMonitor monitor) {
	clean(new IBuildConfiguration[] { getBuildConfiguration(project) }, monitor);
}
 
Example 37
Project: n4js   File: ExternalLibraryBuilderHelper.java   Source Code and License 2 votes vote down vote up
/**
 * Performs a clean (without rebuild) on the projects given as an array of build configuration. The clean order is
 * identical with the order of the elements in the {@code buildOrder} argument.
 * <p>
 * For information on locking see {@link #getRule()}.
 *
 * @param buildConfigs
 *            the build configurations representing the the projects to be cleaned.
 * @param monitor
 *            the monitor for the progress. Must not be {@code null}.
 *
 * @throws IllegalArgumentException
 *             if a scheduling rule is in effect that does not contain the rule returned by {@link #getRule()}. For
 *             more info, see {@link #getRule() here}.
 */
public void clean(final IBuildConfiguration[] buildConfigs, final IProgressMonitor monitor) {
	doPerformOperation(buildConfigs, BuildOperation.CLEAN, monitor);
}
 
Example 38
Project: n4js   File: N4JSExternalProject.java   Source Code and License 2 votes vote down vote up
/**
 * Attach the argument as a referenced build configuration to the project.
 *
 * @param config
 *            the configuration to attach.
 * @return {@link Set#add(Object)}.
 */
boolean add(final IBuildConfiguration config) {
	return referencedBuildConfigs.add(config);
}