Fix for Bug 9852. RCL_2_4
authorstechong
Tue, 10 Nov 2009 17:39:37 -0600
branchRCL_2_4
changeset 575 b04017a10111
parent 573 d66c8cb9b9b2
child 578 02be4e434dde
Fix for Bug 9852.
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/processes/CheckS60CustKitSupport.java
templates/com.nokia.carbide.cpp.templates/templates/projecttemplates/S60-PlatsecApp/group/baseName.mmp
templates/com.nokia.carbide.cpp.templates/templates/projecttemplates/S60-PlatsecApp/group/bld.inf
templates/com.nokia.carbide.cpp.templates/templates/projecttemplates/S60-PlatsecApp/src/baseNameAppUi.cpp
templates/com.nokia.carbide.cpp.templates/templates/projecttemplates/S60-TouchUIApplication/group/baseName.mmp
templates/com.nokia.carbide.cpp.templates/templates/projecttemplates/S60-TouchUIApplication/group/bld.inf
templates/com.nokia.carbide.cpp.templates/templates/projecttemplates/S60-TouchUIApplication/src/baseNameAppUi.cpp
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/processes/CheckS60CustKitSupport.java	Tue Nov 10 14:39:10 2009 -0600
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/processes/CheckS60CustKitSupport.java	Tue Nov 10 17:39:37 2009 -0600
@@ -14,16 +14,19 @@
 
 import java.io.File;
 import java.util.List;
-import java.util.Map;
 
 import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Plugin;
 
-import com.nokia.carbide.cpp.sdk.core.*;
+import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
+import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
+import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
 import com.nokia.carbide.template.engine.ITemplate;
 import com.nokia.carbide.templatewizard.process.AbstractProjectProcess;
 import com.nokia.carbide.templatewizard.process.IParameter;
-import com.nokia.cpp.internal.api.utils.core.*;
+import com.nokia.cpp.internal.api.utils.core.Check;
 
 /**
  * Process used to fill in S60 specific include symbols for INF/MMP files 
@@ -42,6 +45,12 @@
 	private static final String S60_SF_FOLDER =  "sf";
 	private static final String S60_INC_MACROS_SF = "#include <platform_paths.hrh>\n#include <data_caging_paths.hrh>\nAPP_LAYER_SYSTEMINCLUDE";
 
+	private static final String BUILD_HELP_PREFIX = "buildHelpPrefix";
+	private static final String DISABLE_HELP_STRING = "//";
+	private static final String HELP_COMPILER = "epoc32/tools/cshlpcmp.bat";
+	private static final String HELP_SUPPORT_MACRO = "helpSupport";
+	private static final String HELP_SUPPORT_STRING = "MACRO _HELP_AVAILABLE_";
+
 	protected IProject project;
 
 	@Override
@@ -51,6 +60,18 @@
 		String includesValue = "";
 		includesValue = createCustKitIncludes(template);
 		template.getTemplateValues().put(S60_50_BUILD_MACROS, includesValue);
+
+		boolean hasHelp = isHelpCompilerAvailable(template);
+		String enableHelpString = "";
+		String helpSupportString = "";
+		if (hasHelp) {
+			helpSupportString = HELP_SUPPORT_STRING;
+		}
+		else {
+			enableHelpString = DISABLE_HELP_STRING;
+		}
+		template.getTemplateValues().put(BUILD_HELP_PREFIX, enableHelpString);
+		template.getTemplateValues().put(HELP_SUPPORT_MACRO, helpSupportString);
 	}
 
 	@Override
@@ -58,6 +79,25 @@
 		return SDKCorePlugin.getDefault();
 	}
 	
+	private boolean isHelpCompilerAvailable(ITemplate template) {
+		Object object = template.getTemplateValues().get(SELECTED_BUILD_CONFIGS_VALUE_KEY);
+		if (object instanceof List) {
+			List listOfBuildConfigs = (List) object;
+			for (Object obj : listOfBuildConfigs) {
+				Check.checkContract(obj instanceof ISymbianBuildContext);
+				ISymbianBuildContext symbianBuildContext = (ISymbianBuildContext)obj;
+				ISymbianSDK sdk = symbianBuildContext.getSDK();
+				if (sdk != null) {
+					File contextHelpCompiler = new File(sdk.getEPOCROOT() + HELP_COMPILER);
+					if (contextHelpCompiler.exists()) {
+						return true;
+					}
+				}
+			}
+		}
+		return false;
+	}
+
 	@SuppressWarnings("unchecked")
 	/**
 	 * Check the SDK version and certain includes to figure out which include macros to add.
--- a/templates/com.nokia.carbide.cpp.templates/templates/projecttemplates/S60-PlatsecApp/group/baseName.mmp	Tue Nov 10 14:39:10 2009 -0600
+++ b/templates/com.nokia.carbide.cpp.templates/templates/projecttemplates/S60-PlatsecApp/group/baseName.mmp	Tue Nov 10 17:39:37 2009 -0600
@@ -7,6 +7,7 @@
 ============================================================================
 */
 $(S60_50_CustomBuildIncludes)
+$(helpSupport)
 
 TARGET			$(baseName)_$(uid3).exe
 TARGETTYPE		exe
--- a/templates/com.nokia.carbide.cpp.templates/templates/projecttemplates/S60-PlatsecApp/group/bld.inf	Tue Nov 10 14:39:10 2009 -0600
+++ b/templates/com.nokia.carbide.cpp.templates/templates/projecttemplates/S60-PlatsecApp/group/bld.inf	Tue Nov 10 17:39:37 2009 -0600
@@ -16,7 +16,7 @@
 
 gnumakefile icons_scalable_dc.mk
 
-gnumakefile ..\$(helpDir)\build_help.mk
+$(buildHelpPrefix)gnumakefile ..\$(helpDir)\build_help.mk
 
 $(baseName).mmp
 
--- a/templates/com.nokia.carbide.cpp.templates/templates/projecttemplates/S60-PlatsecApp/src/baseNameAppUi.cpp	Tue Nov 10 14:39:10 2009 -0600
+++ b/templates/com.nokia.carbide.cpp.templates/templates/projecttemplates/S60-PlatsecApp/src/baseNameAppUi.cpp	Tue Nov 10 17:39:37 2009 -0600
@@ -18,7 +18,9 @@
 
 #include <$(baseName)_$(uid3).rsg>
 
+#ifdef _HELP_AVAILABLE_
 #include "$(baseName)_$(uid3).hlp.hrh"
+#endif
 #include "$(baseName).hrh"
 #include "$(baseName).pan"
 #include "$(baseName)Application.h"
@@ -197,11 +199,15 @@
 	// work. Alternatively, a patch now exists for the versions of 
 	// HTML help compiler in SDKs and can be found here along with an FAQ:
 	// http://www3.symbian.com/faq.nsf/AllByDate/E9DF3257FD565A658025733900805EA2?OpenDocument
-	CArrayFixFlat<TCoeHelpContext>* array = new(ELeave)CArrayFixFlat<TCoeHelpContext>(1);
+#ifdef _HELP_AVAILABLE_
+    CArrayFixFlat<TCoeHelpContext>* array = new(ELeave)CArrayFixFlat<TCoeHelpContext>(1);
 	CleanupStack::PushL(array);
 	array->AppendL(TCoeHelpContext(KUid$(baseName)App, KGeneral_Information));
 	CleanupStack::Pop(array);
 	return array;
+#else
+    return NULL;
+#endif
 	}
 
 // End of File
--- a/templates/com.nokia.carbide.cpp.templates/templates/projecttemplates/S60-TouchUIApplication/group/baseName.mmp	Tue Nov 10 14:39:10 2009 -0600
+++ b/templates/com.nokia.carbide.cpp.templates/templates/projecttemplates/S60-TouchUIApplication/group/baseName.mmp	Tue Nov 10 17:39:37 2009 -0600
@@ -7,6 +7,7 @@
 ============================================================================
 */
 $(S60_50_CustomBuildIncludes)
+$(helpSupport)
 
 TARGET			$(baseName)_$(uid3).exe
 TARGETTYPE		exe
--- a/templates/com.nokia.carbide.cpp.templates/templates/projecttemplates/S60-TouchUIApplication/group/bld.inf	Tue Nov 10 14:39:10 2009 -0600
+++ b/templates/com.nokia.carbide.cpp.templates/templates/projecttemplates/S60-TouchUIApplication/group/bld.inf	Tue Nov 10 17:39:37 2009 -0600
@@ -16,7 +16,7 @@
 
 gnumakefile icons_scalable_dc.mk
 
-gnumakefile ..\$(helpDir)\build_help.mk
+$(buildHelpPrefix)gnumakefile ..\$(helpDir)\build_help.mk
 
 $(baseName).mmp
 
--- a/templates/com.nokia.carbide.cpp.templates/templates/projecttemplates/S60-TouchUIApplication/src/baseNameAppUi.cpp	Tue Nov 10 14:39:10 2009 -0600
+++ b/templates/com.nokia.carbide.cpp.templates/templates/projecttemplates/S60-TouchUIApplication/src/baseNameAppUi.cpp	Tue Nov 10 17:39:37 2009 -0600
@@ -18,7 +18,9 @@
 
 #include <$(baseName)_$(uid3).rsg>
 
+#ifdef _HELP_AVAILABLE_
 #include "$(baseName)_$(uid3).hlp.hrh"
+#endif
 #include "$(baseName).hrh"
 #include "$(baseName).pan"
 #include "$(baseName)Application.h"
@@ -197,11 +199,15 @@
 	// work. Alternatively, a patch now exists for the versions of 
 	// HTML help compiler in SDKs and can be found here along with an FAQ:
 	// http://www3.symbian.com/faq.nsf/AllByDate/E9DF3257FD565A658025733900805EA2?OpenDocument
+#ifdef _HELP_AVAILABLE_
 	CArrayFixFlat<TCoeHelpContext>* array = new(ELeave)CArrayFixFlat<TCoeHelpContext>(1);
 	CleanupStack::PushL(array);
 	array->AppendL(TCoeHelpContext(KUid$(baseName)App, KGeneral_Information));
 	CleanupStack::Pop(array);
 	return array;
+#else
+    return NULL;
+#endif
 	}
 
 // End of File