Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
AW: AW: [cdt-dev] RE: Adding MakeTargets takes a long time andconsumesahuge amount of heap

>Hi Thomas,
>would you mind sharing your patch here? I need to do something 
>similar, and I would love to learn from your changes...
>  Achim

Hi Achim,

sure I don't mind sharing the patch here. I made the changes in the
package org.eclipse.cdt.make.core version 4.0.3. In the file
MakeTargetManager.java I added the following two methods:

public void addTargetNoWrite(IContainer container, IMakeTarget target)
throws CoreException {
      if (container instanceof IWorkspaceRoot) {
         throw new CoreException(new Status(IStatus.ERROR,
MakeCorePlugin.getUniqueIdentifier(), -1,
MakeMessages.getString("MakeTargetManager.add_to_workspace_root"),
null)); //$NON-NLS-1$
      }
      ProjectTargets projectTargets =
(ProjectTargets)projectMap.get(target.getProject());
      if (projectTargets == null) {
         projectTargets = readTargets(target.getProject());
      }
      ((MakeTarget) target).setContainer(container == null ?
target.getProject() : container);
      projectTargets.add((MakeTarget) target);
      notifyListeners(new MakeTargetEvent(this,
MakeTargetEvent.TARGET_ADD, target));
}

public void save(IProject prj) {
      ProjectTargets projectTargets =
(ProjectTargets)projectMap.get(prj);
      if (projectTargets == null) {
         projectTargets = readTargets(prj);
      }
      try {
         writeTargets(projectTargets);
      } catch (CoreException e) {
         e.printStackTrace();
      }
} 

The method addTargetNoWrite is nearly the same than the original
function addTarget, I only omitted the writeTargets call. 
In the job creating all my targets I now call 'addTargetNoWrite' instead
of 'addTarget' and after I finished adding all desired targets I call
the method 'save' once. 

I hope this helps for your project.

Regards,
Thomas 
 
*******************************************
Harman Becker Automotive Systems GmbH
Geschaeftsfuehrung:  Dr. Wolfgang Ptacek  -  Michael Mauser  -  Regis Baudot
Sitz der Gesellschaft: Karlsbad - Registergericht: Mannheim HRB 361395
 
*******************************************
Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und loeschen Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the contents in this e-mail is strictly forbidden.
*******************************************


Back to the top