Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

FAQ How do I add a builder to a given project?

To register the eScript builder for a given project, add the builder to the project’s build specification as follows:

   private void addBuilder(IProject project, String id) {
      IProjectDescription desc = project.getDescription();
      ICommand[] commands = desc.getBuildSpec();
      for (int i = 0; i < commands.length; ++i)
         if (commands[i].getBuilderName().equals(id))
            return;
      //add builder to project
      ICommand command = desc.newCommand();
      command.setBuilderName(id);
      ICommand[] nc = new ICommand[commands.length + 1];
      // Add it before other builders.
      System.arraycopy(commands, 0, nc, 1, commands.length);
      nc[0] = command;
      desc.setBuildSpec(nc);
      project.setDescription(desc, null);
   }

Alternatively, you could edit the project description directly on disk by modifying the .project file:

   <buildCommand>
      <name>org.eclipse.escript.builder.Builder</name> 
      <arguments> </arguments>
   </buildCommand>

A builder is normally added to a project in the project creation wizard but can be added later on.


See Also:

FAQ How do I implement an incremental project builder?


This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.

Back to the top