Merge bug 9788 from default to RCL_2_4 RCL_2_4
authortimkelly
Mon, 09 Nov 2009 13:10:39 -0600
branchRCL_2_4
changeset 571 a7ae4dccdf8a
parent 570 fdb299cc88b4
child 572 72857169a530
Merge bug 9788 from default to RCL_2_4
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/builder/CarbideCPPBuilder.java
qt/com.nokia.carbide.cpp.qt.ui/META-INF/MANIFEST.MF
qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/QtUIPlugin.java
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/builder/CarbideCPPBuilder.java	Mon Nov 09 12:37:41 2009 -0600
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/builder/CarbideCPPBuilder.java	Mon Nov 09 13:10:39 2009 -0600
@@ -44,6 +44,7 @@
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.window.Window;
 import org.eclipse.swt.widgets.Display;
 
@@ -63,6 +64,7 @@
 import com.nokia.carbide.cdt.internal.builder.ICarbideBuilder;
 import com.nokia.carbide.cdt.internal.builder.ui.BuilderPreferencePage;
 import com.nokia.carbide.cdt.internal.builder.ui.MMPSelectionDialog;
+import com.nokia.carbide.cdt.internal.builder.ui.Messages;
 import com.nokia.carbide.cpp.epoc.engine.EpocEnginePlugin;
 import com.nokia.carbide.cpp.epoc.engine.MMPDataRunnableAdapter;
 import com.nokia.carbide.cpp.epoc.engine.PKGViewRunnableAdapter;
@@ -72,6 +74,7 @@
 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.preprocessor.AcceptedNodesViewFilter;
+import com.nokia.carbide.cpp.internal.qt.core.QtCorePlugin;
 import com.nokia.carbide.cpp.internal.x86build.X86BuildPlugin;
 import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
 import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.EPKGLanguage;
@@ -1210,14 +1213,44 @@
     	monitor.done();
     }
     
-    private static void buildSisFile(ISISBuilderInfo sisInfo, ICarbideBuildConfiguration config, CarbideCommandLauncher cmdLauncher, IProgressMonitor monitor, boolean createOutputFromPKGFileName) {
+    private static void buildSisFile(final ISISBuilderInfo sisInfo, final ICarbideBuildConfiguration config, CarbideCommandLauncher cmdLauncher, IProgressMonitor monitor, boolean createOutputFromPKGFileName) {
 		IPath pkgPath = sisInfo.getPKGFullPath();
     	if (pkgPath == null) {
    			cmdLauncher.writeToConsole("PKG file does not exist.  Skipping...");
     		return;
     	} else if (!pkgPath.toFile().exists()) {
-   			cmdLauncher.writeToConsole("PKG file" + pkgPath.toOSString() + " does not exist.  Skipping...");
-    		return;
+    		
+    		try {
+    			// Check to see if this is a Qt project and if the template format could have changed.
+    			IProject project = config.getCarbideProject().getProject();
+				if (project != null && project.hasNature(QtCorePlugin.QT_PROJECT_NATURE_ID)){
+					final String currentPKGName = pkgPath.lastSegment();
+					pkgPath = pkgPath.removeLastSegments(1).append(project.getName() + "_template.pkg" ); //$NON-NLS-N$
+					if (pkgPath.toFile().exists()){
+						
+						final IPath finalPkgPath = pkgPath;
+						Display.getDefault().syncExec(new Runnable() {
+							public void run() {
+								if (true == MessageDialog.openQuestion(WorkbenchUtils.getSafeShell(), "Can not find PKG file for SIS builder", "The file \"" + currentPKGName + "\" does not exist for this Qt project. The suggested file is \"" + finalPkgPath.lastSegment() + "\".\n\nDo you want to update your build configuration to use this PKG file?")) { //$NON-NLS-1$ //$NON-NLS-2$
+									IWorkspace workspace= ResourcesPlugin.getWorkspace();
+									IFile ifile= workspace.getRoot().getFileForLocation(finalPkgPath); 
+									sisInfo.setPKGFile(ifile.getLocation().toOSString());
+									config.getSISBuilderInfoList().remove(sisInfo);
+									config.getSISBuilderInfoList().add(sisInfo);
+									config.saveConfiguration(false);
+								} 
+							}
+						});
+					} 
+				}
+			} catch (CoreException e) {
+				e.printStackTrace();
+			}
+    		
+			if (!sisInfo.getPKGFullPath().toFile().exists()){
+				cmdLauncher.writeToConsole("PKG file " + pkgPath.toOSString() + " does not exist.  Skipping..."); //$NON-NLS-N$
+   				return;
+			}
     	}
     	
     	// see if we need to rebuild the sis file
--- a/qt/com.nokia.carbide.cpp.qt.ui/META-INF/MANIFEST.MF	Mon Nov 09 12:37:41 2009 -0600
+++ b/qt/com.nokia.carbide.cpp.qt.ui/META-INF/MANIFEST.MF	Mon Nov 09 13:10:39 2009 -0600
@@ -25,3 +25,5 @@
  com.trolltech.qtcppproject;bundle-version="1.5.0"
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
 Bundle-ActivationPolicy: lazy
+Import-Package: com.trolltech.qtcppproject,
+ com.trolltech.qtcppproject.qmake  
--- a/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/QtUIPlugin.java	Mon Nov 09 12:37:41 2009 -0600
+++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/QtUIPlugin.java	Mon Nov 09 13:10:39 2009 -0600
@@ -35,6 +35,7 @@
 import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
 import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo;
 import com.nokia.carbide.cdt.internal.api.builder.SISBuilderInfo2;
+import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
 
 public class QtUIPlugin extends AbstractUIPlugin {
 
@@ -89,12 +90,18 @@
 		ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project);
 		if (cpi != null) {
 			final String underscore = "_"; //$NON-NLS-1$
+			final String template = "template"; //$NON-NLS-1$ 
 			
 			for (ICarbideBuildConfiguration config : cpi.getBuildConfigurations()) {
 				IFile file = project.getFile(project.getName() + underscore + config.getPlatformString().toLowerCase() +
 						underscore + config.getTargetString().toLowerCase() + ".pkg"); //$NON-NLS-1$
 				
-				if (file != null && file.exists()) {
+				if (file == null || !file.exists() && config.getPlatformString() != ISymbianBuildContext.EMULATOR_PLATFORM) { 
+					// Qt 4.6 only creates one PKG file per project. Do not add for WINSCW 
+					file = project.getFile(project.getName() + underscore + template + ".pkg"); //$NON-NLS-1$ 
+				}
+				
+				if (file != null && file.exists()){ 
 					SISBuilderInfo2 sisInfo = new SISBuilderInfo2(project);
 					sisInfo.setPKGFile(file.getLocation().toOSString());
 					// set to self signing