add query dialog to promt user whether or not to allow carbid eto track dependencies (over existing abld-generated makefiles)
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/BuilderPreferenceConstants.java Mon Jun 29 12:48:34 2009 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/BuilderPreferenceConstants.java Mon Jun 29 12:50:12 2009 -0500
@@ -104,4 +104,10 @@
* @since 2.0
*/
public final static String PREF_MAKE_ENGINE = "makeEngine"; //$NON-NLS-1$
+
+ /**
+ * String setting for whether or not to alert user if Carbide can override abld-generated makefile dependencies.
+ * @since 2.1
+ */
+ public final static String PREF_DONT_PROMPT_FOR_DEPENDENCY_MISMATCH = "promtToTrackDependencies"; //$NON-NLS-1$
}
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv1Builder.java Mon Jun 29 12:48:34 2009 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv1Builder.java Mon Jun 29 12:50:12 2009 -0500
@@ -16,70 +16,38 @@
*/
package com.nokia.carbide.cdt.internal.builder;
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
+import java.io.*;
+import java.util.*;
-import org.eclipse.cdt.make.core.makefile.ICommand;
-import org.eclipse.cdt.make.core.makefile.IMacroDefinition;
-import org.eclipse.cdt.make.core.makefile.IRule;
-import org.eclipse.cdt.make.core.makefile.ITargetRule;
+import org.eclipse.cdt.make.core.makefile.*;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.*;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
-import com.nokia.carbide.cdt.builder.BuilderPreferenceConstants;
-import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
-import com.nokia.carbide.cdt.builder.DefaultGNUMakefileViewConfiguration;
-import com.nokia.carbide.cdt.builder.DefaultMMPViewConfiguration;
-import com.nokia.carbide.cdt.builder.DefaultViewConfiguration;
-import com.nokia.carbide.cdt.builder.EpocEngineHelper;
-import com.nokia.carbide.cdt.builder.EpocEnginePathHelper;
+import com.nokia.carbide.cdt.builder.*;
import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder;
import com.nokia.carbide.cdt.builder.builder.CarbideCommandLauncher;
-import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
-import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
+import com.nokia.carbide.cdt.builder.project.*;
import com.nokia.carbide.cdt.internal.builder.ui.MMPChangedActionDialog;
+import com.nokia.carbide.cdt.internal.builder.ui.TrackDependenciesQueryDialog;
import com.nokia.carbide.cdt.internal.builder.ui.MMPChangedActionDialog.MMPChangedAction;
-import com.nokia.carbide.cpp.epoc.engine.BldInfViewRunnableAdapter;
-import com.nokia.carbide.cpp.epoc.engine.EpocEnginePlugin;
-import com.nokia.carbide.cpp.epoc.engine.MMPDataRunnableAdapter;
+import com.nokia.carbide.cpp.epoc.engine.*;
import com.nokia.carbide.cpp.epoc.engine.model.IModel;
import com.nokia.carbide.cpp.epoc.engine.model.IModelProvider;
import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IBldInfView;
import com.nokia.carbide.cpp.epoc.engine.model.makefile.IMakefileView;
-import com.nokia.carbide.cpp.epoc.engine.model.mmp.EMMPLanguage;
-import com.nokia.carbide.cpp.epoc.engine.model.mmp.EMMPStatement;
-import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPData;
-import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPResource;
+import com.nokia.carbide.cpp.epoc.engine.model.mmp.*;
import com.nokia.carbide.cpp.epoc.engine.preprocessor.AcceptedNodesViewFilter;
import com.nokia.carbide.cpp.internal.qt.core.QtCorePlugin;
import com.nokia.carbide.cpp.sdk.core.*;
import com.nokia.cpp.internal.api.utils.core.FileUtils;
+import com.nokia.cpp.internal.api.utils.ui.QueryWithTristatePrefDialog;
import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
@@ -2433,7 +2401,7 @@
return true;
}
- protected boolean needsAbldMakefileGeneration(ICarbideBuildConfiguration config, IPath componentPath) {
+ protected boolean needsAbldMakefileGeneration(final ICarbideBuildConfiguration config, IPath componentPath) {
// if this is an extension makefile then we always do the makefile step.
if (isExtensionMakefile(componentPath)) {
return true;
@@ -2479,17 +2447,37 @@
}
// now check to see if our makefile changes are there
- if (areWeManagingTheMakeFiles && !makeFileHasOurChanges(makefile)) {
+ final IPreferenceStore prefsStore = CarbideBuilderPlugin.getDefault().getPreferenceStore();
+
+ if (prefsStore.getBoolean(BuilderPreferenceConstants.PREF_DONT_PROMPT_FOR_DEPENDENCY_MISMATCH) == false &&
+ areWeManagingTheMakeFiles && !makeFileHasOurChanges(makefile)) {
+
// if they are not then the user must have been building from the command line. this means that
// any dependency files that exist could be stale so we need to delete them. we also need to
// remove any object code since the corresponding dependency info will not be available.
+ final int manageDeps[] = { IDialogConstants.OK_ID };
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ // ask the user if they want to update now
+ TrackDependenciesQueryDialog dlg = new TrackDependenciesQueryDialog(WorkbenchUtils.getSafeShell(), config.getCarbideProject());
+ manageDeps[0] = dlg.open();
+ }
+ });
+
try {
- cleanupObjectCodeDirectory(new Path(makefile.getAbsolutePath()).removeLastSegments(1));
+ if (manageDeps[0] == IDialogConstants.OK_ID){
+ cleanupObjectCodeDirectory(new Path(makefile.getAbsolutePath()).removeLastSegments(1));
+ }
} catch (Exception e) {
CarbideBuilderPlugin.log(e);
e.printStackTrace();
}
- return true;
+ if (manageDeps[0] == IDialogConstants.OK_ID){
+ return true;
+ } else {
+ return false;
+ }
}
return false;
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/BuildSettingsUI.java Mon Jun 29 12:48:34 2009 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/BuildSettingsUI.java Mon Jun 29 12:50:12 2009 -0500
@@ -53,6 +53,7 @@
private Composite defaultMMPActionComposite;
private Label defaultMMPChangedActionLabel;
private Combo defaultMMPChangedActionCombo;
+ private Button dontCheckForExternalDependencies; // global setting only
// SBS v2 Tab
private Label cleanCmdv2Label;
@@ -200,7 +201,15 @@
defaultMMPChangedActionCombo.add(Messages.getString("SharedPrefs.ActionCompileAndLink")); //$NON-NLS-1$
defaultMMPChangedActionCombo.setToolTipText(Messages.getString("SharedPrefs.defaultMMPChangedActionComboToolTip")); //$NON-NLS-1$
defaultMMPChangedActionCombo.setLayoutData(new GridData());
-
+
+ if (!projectSetting){
+ // Only a global setting
+ dontCheckForExternalDependencies = new Button(content, SWT.CHECK);
+ dontCheckForExternalDependencies.setText("Do not offer to track dependencies for projects built on command-line"); //$NON-NLS-1$
+ dontCheckForExternalDependencies.setToolTipText("When enabled, Carbide will not check abld makefiles and promt you to let Carbide manage them."); //$NON-NLS-1$
+ dontCheckForExternalDependencies.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
+ }
+
}
private void createSBSv2TabComposite() {
@@ -428,5 +437,17 @@
makeEngineText.setText(makeEngine);
}
+ public boolean getDontPromtTrackDeps(){
+ if (!projectSetting){
+ return dontCheckForExternalDependencies.getSelection();
+ } else {
+ return true;
+ }
+ }
+
+ public void setDontPromtTrackDeps(boolean dontAsk){
+ dontCheckForExternalDependencies.setSelection(dontAsk);
+ }
+
}
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/BuilderPreferenceInitializer.java Mon Jun 29 12:48:34 2009 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/BuilderPreferenceInitializer.java Mon Jun 29 12:50:12 2009 -0500
@@ -44,6 +44,7 @@
store.setDefault(BuilderPreferenceConstants.PREF_MMP_CHANGED_ACTION_PROMPT, true);
store.setDefault(BuilderPreferenceConstants.PREF_DEFAULT_MMP_CHANGED_ACTION, 0);
store.setDefault(BuilderPreferenceConstants.PREF_MAKE_ENGINE, "make"); //$NON-NLS-1$
+ store.setDefault(BuilderPreferenceConstants.PREF_DONT_PROMPT_FOR_DEPENDENCY_MISMATCH, false);
}
}
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/BuilderPreferencePage.java Mon Jun 29 12:48:34 2009 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/BuilderPreferencePage.java Mon Jun 29 12:50:12 2009 -0500
@@ -48,6 +48,7 @@
buildSettingsUI.setPromptForMMPChangedAction(promptForMMPChangedAction());
buildSettingsUI.setDefaultMMPChangedAction(defaultMMPChangedAction());
buildSettingsUI.setUseBuiltInEnvVars(useBuiltInX86Vars());
+ buildSettingsUI.setDontPromtTrackDeps(promtDontTrackDependencies());
if (SBSv2Utils.enableSBSv2Support()) {
buildSettingsUI.setDefaultCleanLevelv2(getCleanLevelv2());
@@ -83,6 +84,7 @@
store.setValue(BuilderPreferenceConstants.PREF_MMP_CHANGED_ACTION_PROMPT, buildSettingsUI.getPromptForMMPChangedAction());
store.setValue(BuilderPreferenceConstants.PREF_DEFAULT_MMP_CHANGED_ACTION, buildSettingsUI.getDefaultMMPChangedAction());
store.setValue(BuilderPreferenceConstants.PREF_USE_BUILIN_X86_VARS, buildSettingsUI.getUseBuiltInEnvVars());
+ store.setValue(BuilderPreferenceConstants.PREF_DONT_PROMPT_FOR_DEPENDENCY_MISMATCH, buildSettingsUI.getDontPromtTrackDeps()); // global setting only
if (SBSv2Utils.enableSBSv2Support()) {
store.setValue(BuilderPreferenceConstants.PREF_CLEAN_LEVEL_V2, buildSettingsUI.getDefaultCleanLevelv2());
@@ -103,6 +105,7 @@
buildSettingsUI.setPromptForMMPChangedAction(true);
buildSettingsUI.setDefaultMMPChangedAction(0);
buildSettingsUI.setUseBuiltInEnvVars(true);
+ buildSettingsUI.setDontPromtTrackDeps(false);
if (SBSv2Utils.enableSBSv2Support()) {
buildSettingsUI.setDefaultCleanLevelv2(0);
@@ -152,7 +155,16 @@
IPreferenceStore store = CarbideBuilderPlugin.getDefault().getPreferenceStore();
return store.getBoolean(BuilderPreferenceConstants.PREF_MMP_CHANGED_ACTION_PROMPT);
}
-
+
+ /**
+ * For SBSv1 global preferences only
+ * @return
+ */
+ public static boolean promtDontTrackDependencies(){
+ IPreferenceStore store = CarbideBuilderPlugin.getDefault().getPreferenceStore();
+ return store.getBoolean(BuilderPreferenceConstants.PREF_DONT_PROMPT_FOR_DEPENDENCY_MISMATCH);
+ }
+
public static int defaultMMPChangedAction() {
IPreferenceStore store = CarbideBuilderPlugin.getDefault().getPreferenceStore();
return store.getInt(BuilderPreferenceConstants.PREF_DEFAULT_MMP_CHANGED_ACTION);
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/messages.properties Mon Jun 29 12:48:34 2009 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/messages.properties Mon Jun 29 12:50:12 2009 -0500
@@ -195,3 +195,10 @@
CarbideRomBuilderTab.Working_Dir_Tool_Tip=Specify the working directory for building the ROM image
CarbideRomBuilderTab.Browse=Browse...
CarbideRomBuilderTab.Rom_Dir_Dialog_Title=ROM Build Working Directory
+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.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.
--- a/core/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/QueryWithTristatePrefDialog.java Mon Jun 29 12:48:34 2009 -0500
+++ b/core/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/QueryWithTristatePrefDialog.java Mon Jun 29 12:50:12 2009 -0500
@@ -111,7 +111,7 @@
boolean confirmed = false;
if (type == QUERY_YES_NO) {
dialog = MessageDialogWithToggle.openYesNoQuestion(
- parentShell, title, prompt, null,
+ parentShell, title, prompt, "Don't ask to manage dependencies again.",
initialSetting, preferences,
prefName);
confirmed = dialog.getReturnCode() == IDialogConstants.YES_ID;