# HG changeset patch # User fturovic # Date 1246385065 18000 # Node ID 31403302c38ea99e8fcfb7c93158bc0406247153 # Parent 653e5573ae3c5fc969df428cfe4f3a17f20e0b03# Parent d40e42540f1f7da958dca9f89d3531cf9db7d189 merged Tims changes diff -r 653e5573ae3c -r 31403302c38e builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/builder/CarbideCommandLauncher.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/builder/CarbideCommandLauncher.java Tue Jun 30 12:44:21 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/builder/CarbideCommandLauncher.java Tue Jun 30 13:04:25 2009 -0500 @@ -16,29 +16,20 @@ */ package com.nokia.carbide.cdt.builder.builder; -import java.io.IOException; -import java.util.Properties; +import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.CommandLauncher; -import org.eclipse.cdt.core.ConsoleOutputStream; -import org.eclipse.cdt.core.ErrorParserManager; -import org.eclipse.cdt.core.IMarkerGenerator; -import org.eclipse.cdt.core.ProblemMarkerInfo; +import org.eclipse.cdt.core.*; import org.eclipse.cdt.core.model.ICModelMarker; import org.eclipse.cdt.core.resources.IConsole; import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.utils.spawner.EnvironmentReader; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.core.internal.resources.MarkerInfo; +import org.eclipse.core.internal.resources.Workspace; +import org.eclipse.core.resources.*; +import org.eclipse.core.runtime.*; -import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; +import java.io.IOException; +import java.util.*; /** * A utility class to handle windows process execution. This utility class handles all the execution, @@ -46,6 +37,53 @@ */ public class CarbideCommandLauncher extends CommandLauncher implements IMarkerGenerator { + public class MarkerCacheElement { + private int line; + private int severity; + private String message; + + public MarkerCacheElement(IMarker marker) throws CoreException { + line = marker.getAttribute(IMarker.LINE_NUMBER, -1); + severity = ((Integer) marker.getAttribute(IMarker.SEVERITY)).intValue(); + message = (String) marker.getAttribute(IMarker.MESSAGE); + } + + public MarkerCacheElement(ProblemMarkerInfo problemMarkerInfo) { + line = problemMarkerInfo.lineNumber; + severity = mapMarkerSeverity(problemMarkerInfo.severity); + message = problemMarkerInfo.description; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + line; + result = prime * result + severity; + result = prime * result + + ((message == null) ? 0 : message.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof MarkerCacheElement)) + return false; + MarkerCacheElement other = (MarkerCacheElement) obj; + if (line != other.line) + return false; + if (severity != other.severity) + return false; + if (message == null) { + if (other.message != null) + return false; + } + else if (!message.equals(other.message)) + return false; + return true; + } + } + protected IProgressMonitor monitor; protected IConsole console; protected ErrorParserManager stdoutStream; @@ -56,6 +94,8 @@ protected IProject project; protected String[] errorParserIds; protected IMarkerGenerator markerGen; + private Map> markerCache; + private long markerCreationTime; /** * Location of tool execution @@ -212,6 +252,8 @@ * @return 0 (zero) on success. returns the actual tool return status */ public int executeCommand(IPath command, String[] args, String[] env, IPath workingDir){ + markerCache = null; + markerCreationTime = System.currentTimeMillis(); int exitValue = -1; String errMsg; try { @@ -299,35 +341,27 @@ } public void addMarker(ProblemMarkerInfo problemMarkerInfo) { - + if (markerCache == null) + markerCache = new HashMap>(); + try { IResource markerResource = problemMarkerInfo.file ; if (markerResource == null) { markerResource = stdoutStream.getProject(); } - IMarker[] cur = markerResource.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_ONE); - - /* - * Try to find matching markers and don't put in duplicates - */ - if ((cur != null) && (cur.length > 0)) { - for (int i = 0; i < cur.length; i++) { - int line = cur[i].getAttribute(IMarker.LINE_NUMBER, -1); - int sev = ((Integer) cur[i].getAttribute(IMarker.SEVERITY)).intValue(); - String mesg = (String) cur[i].getAttribute(IMarker.MESSAGE); - if (line == problemMarkerInfo.lineNumber && sev == mapMarkerSeverity(problemMarkerInfo.severity) && mesg.equals(problemMarkerInfo.description)) { - return; - } + + Set cacheElements = markerCache.get(markerResource); + if (cacheElements == null) { + cacheElements = new HashSet(); + markerCache.put(markerResource, cacheElements); + IMarker[] cur = markerResource.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_ONE); + for (IMarker marker : cur) { + cacheElements.add(new MarkerCacheElement(marker)); } } - - // need to pause briefly between marker creations so the creation timestamps - // are unique and sorting the problems view by creation time works properly. - try { - Thread.sleep(20); - } catch (InterruptedException e1) { - e1.printStackTrace(); - } + + if (!cacheElements.add(new MarkerCacheElement(problemMarkerInfo))) + return; IMarker marker = markerResource.createMarker(ICModelMarker.C_MODEL_PROBLEM_MARKER); marker.setAttribute(IMarker.MESSAGE, problemMarkerInfo.description); @@ -356,6 +390,7 @@ } marker.setAttribute(ICModelMarker.C_MODEL_MARKER_EXTERNAL_LOCATION, absolutePath.toOSString()); } + setUniqueCreationTime(marker); } catch (CoreException e) { CCorePlugin.log(e.getStatus()); @@ -363,6 +398,16 @@ } + private void setUniqueCreationTime(IMarker marker) { + // This is using internal platform APIs to avoid putting a delay into every marker creation + // to ensure each marker gets a unique creation time (for sorting in the problems view). + // The total delay could be significant when there are many problem markers + IResource resource = marker.getResource(); + Workspace workspace = (Workspace) resource.getWorkspace(); + MarkerInfo markerInfo = workspace.getMarkerManager().findMarkerInfo(resource, marker.getId()); + markerInfo.setCreationTime(markerCreationTime++); + } + int mapMarkerSeverity(int severity) { switch (severity) { diff -r 653e5573ae3c -r 31403302c38e builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/CarbideCPPBuilderUIHelpIds.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/CarbideCPPBuilderUIHelpIds.java Tue Jun 30 12:44:21 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/CarbideCPPBuilderUIHelpIds.java Tue Jun 30 13:04:25 2009 -0500 @@ -32,4 +32,5 @@ public static final String CARBIDE_BUILDER_SIS_DIALOG = CarbideBuilderPlugin.PLUGIN_ID + ".builder_sis_dialog"; //$NON-NLS-1$ public static final String CARBIDE_BUILDER_MMP_CHANGED_ACTION_DIALOG = CarbideBuilderPlugin.PLUGIN_ID + ".builder_mmp_changed_action_dialog"; //$NON-NLS-1$ public static final String CARBIDE_BUILDER_MMP_SELECTION_DIALOG = CarbideBuilderPlugin.PLUGIN_ID + ".builder_mmp_selection_dialog"; //$NON-NLS-1$ + public static final String CARBIDE_BUILDER_TRACK_DEPENDENCIES_QUERY_DIALOG = CarbideBuilderPlugin.PLUGIN_ID + ".dependency_tracking_dialog"; //$NON-NLS-1$ } diff -r 653e5573ae3c -r 31403302c38e builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/TrackDependenciesQueryDialog.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/TrackDependenciesQueryDialog.java Tue Jun 30 12:44:21 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/TrackDependenciesQueryDialog.java Tue Jun 30 13:04:25 2009 -0500 @@ -25,6 +25,7 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.*; +import org.eclipse.ui.PlatformUI; import com.nokia.carbide.cdt.builder.BuilderPreferenceConstants; import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; @@ -57,6 +58,7 @@ public TrackDependenciesQueryDialog(Shell shell, ICarbideProjectInfo cpi) { super(shell); this.cpi = cpi; + setShellStyle(getShellStyle() | SWT.RESIZE); } /** @@ -113,6 +115,7 @@ */ protected void configureShell(Shell shell) { super.configureShell(shell); + PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, CarbideCPPBuilderUIHelpIds.CARBIDE_BUILDER_TRACK_DEPENDENCIES_QUERY_DIALOG); shell.setText("Project rebuild notification"); //$NON-NLS-1$ } diff -r 653e5573ae3c -r 31403302c38e builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/messages.properties --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/messages.properties Tue Jun 30 12:44:21 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/messages.properties Tue Jun 30 13:04:25 2009 -0500 @@ -200,7 +200,7 @@ TrackDependenciesQueryDialog.0=This project was previously built from the command-line. Carbide can manage the makefile dependencies in this project for faster incremental builds, but a full rebuild wil be required. TrackDependenciesQueryDialog.1=Improve Carbide build times (forces a rebuild) TrackDependenciesQueryDialog.2=Carbide will make dependency file for each source file and update makefiles accordingly. -TrackDependenciesQueryDialog.3=Don't do anything (slower builds from Carbide) +TrackDependenciesQueryDialog.3=Do not update dependencies (slower builds from Carbide, no rebuild) TrackDependenciesQueryDialog.4=Source dependencies will be managed as they currently exist in abld-generated makefiles. TrackDependenciesQueryDialog.5=Don't ask me again for any project TrackDependenciesQueryDialog.6=Carbide will not try to override dependency tracking for projects that are built with abld first. diff -r 653e5573ae3c -r 31403302c38e core/com.nokia.carbide.cpp.doc.user/html/concepts/dependency_tracking.htm --- a/core/com.nokia.carbide.cpp.doc.user/html/concepts/dependency_tracking.htm Tue Jun 30 12:44:21 2009 -0500 +++ b/core/com.nokia.carbide.cpp.doc.user/html/concepts/dependency_tracking.htm Tue Jun 30 13:04:25 2009 -0500 @@ -1,22 +1,31 @@ - - - - - - -Dependency Tracking - - - -

Dependency Tracking

-

blah blah blah

-

 

-

Figure 1 -Dependency Tracking dialog

-
Related references
-
    -
  • ???
  • -
- - - - + + + + + + +Dependency Tracking + + + + +

Dependency Tracking

+

This section only applies to the SBSv1 (abld) build system. If you are using the Raptor (SBSv2) build system Carbide does not perform any build system modifications to optimize dependency tracking.

+

Carbide has made some performance improvements over command-line builds when performing incremental builds. Once a project has been built, many users will invoke 'abld build' on their project, not knowing that their makefiles will be regenerated each time, taking a large performance hit. Although a command-line user can invoke 'abld target' to improve incremental build performance, Carbide invokes each build stage independently for a full incremental build (including the 'abld makefile' stage). In order to get around this performance hit from the IDE, Carbide manages the source and resource dependencies in separate .d (dependency) files generated under the build system. Then Carbide makes a small modification to each component's (MMP) makefile under the \epoc32\build\ directory by including the generated .d files as dependency includes. This performance modification makes incremental builds faster from Carbide.

+

Normally, you do not need to know the details dependency management unless you first build from the command-line and then try to build their project from the IDE. When this happens, Carbide will prompt you with the following dialog when you initiate a build from the IDE.

+

+

Figure 1 -Dependency Tracking dialog

+

If you plan to continue building in Carbide it is recommended you choose the option to Improve Carbide build times. However, be cautious of this as Carbide will remove all the object code and build everything from scratch. If you do choose the option Do not update dependencies, then Carbide will disable the option to manage dependencies under the Carbide Project Settings, SBSv1 tab.

+
Related references
+ + + + + diff -r 653e5573ae3c -r 31403302c38e core/com.nokia.carbide.cpp.doc.user/html/concepts/images/deps_track_query.png Binary file core/com.nokia.carbide.cpp.doc.user/html/concepts/images/deps_track_query.png has changed diff -r 653e5573ae3c -r 31403302c38e core/com.nokia.carbide.cpp.doc.user/html/context_help/carbide_ide_dialogs_help.xml --- a/core/com.nokia.carbide.cpp.doc.user/html/context_help/carbide_ide_dialogs_help.xml Tue Jun 30 12:44:21 2009 -0500 +++ b/core/com.nokia.carbide.cpp.doc.user/html/context_help/carbide_ide_dialogs_help.xml Tue Jun 30 13:04:25 2009 -0500 @@ -76,10 +76,8 @@ Managing makefile dependencies - + - - diff -r 653e5573ae3c -r 31403302c38e core/com.nokia.carbide.cpp.doc.user/html/reference/wnd_build_prefs.htm --- a/core/com.nokia.carbide.cpp.doc.user/html/reference/wnd_build_prefs.htm Tue Jun 30 12:44:21 2009 -0500 +++ b/core/com.nokia.carbide.cpp.doc.user/html/reference/wnd_build_prefs.htm Tue Jun 30 13:04:25 2009 -0500 @@ -90,6 +90,10 @@ + + Do not offer to track dependencies for projects build on command-line + If you build a project from the command-line (with 'abld build') and then import the project into Carbide and attempt to build, Carbide will prompt you if you would like Carbide to manage source dependencies for you. Enabling this option insures Carbide will not ask you to manage dependencies (they will be done as normally done via 'abld build' command). +

 

sbsv2 tab