Jump to: navigation, search

Difference between revisions of "FAQ How do I add a builder to a given project?"

 
(Remove unnecessary underscores)
 
Line 33: Line 33:
  
 
== See Also: ==
 
== See Also: ==
[[FAQ_How_do_I_implement_an_incremental_project_builder%3F]]
+
[[FAQ How do I implement an incremental project builder?]]
  
 
<hr><font size=-2>This FAQ was originally published in [http://www.eclipsefaq.org Official Eclipse 3.0 FAQs]. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the [http://www.eclipse.org/legal/epl-v10.html Eclipse Public License v1.0].</font>
 
<hr><font size=-2>This FAQ was originally published in [http://www.eclipsefaq.org Official Eclipse 3.0 FAQs]. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the [http://www.eclipse.org/legal/epl-v10.html Eclipse Public License v1.0].</font>

Latest revision as of 08:52, 19 February 2007

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.