more parsing and unit test support for binary variant parsing. all keywords now supported.
--- a/core/com.nokia.carbide.cpp.sdk.core.test/Data/var/group1/epoc32/tools/variant/wilma88.var Mon May 11 13:45:30 2009 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core.test/Data/var/group1/epoc32/tools/variant/wilma88.var Tue May 12 08:26:15 2009 -0500
@@ -1,4 +1,4 @@
-VARIANT wilma88
+VARIANT differentname
EXTENDS flintstone500
--- a/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SBVCatalogTest.java Mon May 11 13:45:30 2009 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SBVCatalogTest.java Tue May 12 08:26:15 2009 -0500
@@ -18,6 +18,7 @@
package com.nokia.carbide.cpp.sdk.core.test;
import java.net.URL;
+import java.util.List;
import junit.framework.TestCase;
@@ -69,7 +70,7 @@
assertEquals("flintstone500", platforms[3].getName());
assertEquals("fred99nhd", platforms[4].getName());
assertEquals("variants", platforms[5].getName());
- assertEquals("wilma88", platforms[6].getName());
+ assertEquals("differentname", platforms[6].getName()); // filename is wilma88, but test that we us the VARIANT keyword
}
/**
@@ -95,10 +96,27 @@
assertTrue(platform.isVirtual());
assertEquals("VARIANTS", platform.getExtendedVariantName().toUpperCase());
- assertNotNull(platform.getSystemIncludePath());
- assertEquals(1, platform.getSystemIncludePaths().length);
+ assertNotNull(platform.getBuildIncludePaths());
+ assertEquals(3, platform.getBuildIncludePaths().size());
assertTrue("Didn't get expected VARIANT_HRH value", platform.getBuildVariantHRHFile().toPortableString().contains("/epoc32/include/feature_settings.hrh"));
+
+ // test null platform
+ platform = catalog.findPlatform("wilma88");
+ assertNull(platform);
+
+ // test build include paths
+ platform = catalog.findPlatform("dino79");
+ assertNotNull(platform);
+ assertEquals(4, platform.getBuildIncludePaths().size());
+
+ List<IPath> incPaths = platform.getBuildIncludePaths();
+ for (IPath path : incPaths){
+ System.out.println("Include path for dino79 bianry variant: " + path.toOSString());
+ }
+
+ assertEquals(16, platform.getROMBuildIncludePaths().size());
+
}
/**
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVPlatform.java Mon May 11 13:45:30 2009 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVPlatform.java Tue May 12 08:26:15 2009 -0500
@@ -22,8 +22,7 @@
import com.nokia.carbide.cpp.epoc.engine.ISBVViewRunnable;
import com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView;
import com.nokia.carbide.cpp.internal.api.sdk.Messages;
-import com.nokia.carbide.cpp.sdk.core.ISBVCatalog;
-import com.nokia.carbide.cpp.sdk.core.ISBVPlatform;
+import com.nokia.carbide.cpp.sdk.core.*;
import com.nokia.cpp.internal.api.utils.core.*;
/**
@@ -37,9 +36,9 @@
private IPath path;
private ISBVPlatform extendedPlatform;
private String extendedPlatName;
- private IPath[] systemIncludePaths;
+ private List<IPath> systemBuildIncludePaths = new ArrayList<IPath>();
+ private List<IPath> romBuildIncludePaths = new ArrayList<IPath>();
private IPath sdkIncludePath;
- private IPath systemIncludePath;
private IPath bldVarintHRH;
private ISBVCatalog catalog;
private boolean virtual;
@@ -53,21 +52,18 @@
SBVPlatform(ISBVCatalog catalog, IPath sdkIncludePath, ISBVView view ) {
this.catalog = catalog;
this.sdkIncludePath = sdkIncludePath;
- this.name = view.getName();
this.extendedPlatName = view.getExtends().toUpperCase();
this.path = view.getModel().getPath();
this.virtual = view.getVirtualFlag();
+ this.name = view.getVariantName();
String temp = view.getBuildVariantHRH();
- String EPOC32_INCLUDE = "epoc32" + File.separator + "include";
- if (temp != null && temp.length() > 0){
- if (sdkIncludePath.toOSString().contains(EPOC32_INCLUDE)){
- bldVarintHRH = new Path(sdkIncludePath.toOSString().substring(0, sdkIncludePath.toOSString().indexOf(EPOC32_INCLUDE)) + temp);
- } else {
- bldVarintHRH = new Path(sdkIncludePath + temp);
- }
- }
+ String epocRoot = getEPOCRoot();
+ bldVarintHRH = new Path(epocRoot + temp);
+
+ setBuildIncludePaths(view.getBuildIncludes());
+ setROMBuildIncludePaths(view.getROMBuildIncludes());
}
@@ -132,54 +128,7 @@
* @see com.nokia.carbide.cpp.sdk.core.ISBVPlatform#getExtendedVariant()()
*/
public ISBVPlatform getExtendedVariant() {
- return extendedPlatform;
- }
-
- /* (non-Javadoc)
- * @see com.nokia.carbide.cpp.sdk.core.ISBVPlatform#getSystemIncludePath()
- */
- public IPath getSystemIncludePath() {
- if (systemIncludePath == null) {
- IPath extendedPlatformPath = null;
- if (extendedPlatform != null) {
- extendedPlatformPath = extendedPlatform.getSystemIncludePath();
- }
-
- // VIRTUALVARIANT does not have its own path
-
- // else, construct the system include path from the customized
- // platform by appending our platform name
- if (extendedPlatformPath == null) {
- systemIncludePath = sdkIncludePath.append(name); //$NON-NLS-1$
- } else {
- systemIncludePath = extendedPlatformPath.append(name);
- }
-
- }
-
- return systemIncludePath;
- }
-
- /* (non-Javadoc)
- * @see com.nokia.carbide.cpp.sdk.core.ISBVPlatform#getSystemIncludePaths()
- */
- public IPath[] getSystemIncludePaths() {
- if (systemIncludePaths == null) {
- synchronized (this) {
- // get unique set of paths in the proper order (most specific to least)
- Set<IPath> paths = new LinkedHashSet<IPath>();
- ISBVPlatform platform = this;
- while (platform != null) {
- IPath path = platform.getSystemIncludePath();
- if (path != null){
- paths.add(path);
- }
- platform = platform.getExtendedVariant();
- }
- systemIncludePaths = (IPath[]) paths.toArray(new IPath[paths.size()]);
- }
- }
- return systemIncludePaths;
+ return catalog.findPlatform(getExtendedVariantName());
}
/**
@@ -233,6 +182,94 @@
return bldVarintHRH;
}
+
+ protected void setBuildIncludePaths(Map<String, String> incPaths){
+ synchronized (this)
+ {
+ Set<String> set = incPaths.keySet();
+ for (String currPath : set) {
+ IPath path = new Path(getEPOCRoot() + currPath);
+ systemBuildIncludePaths.add(path);
+ }
+ }
+
+ }
+
+ protected List<IPath> getBuildIncludePathsFromParents(){
+
+ List<IPath> parentBuildIncludes = new ArrayList<IPath>();
+
+ ISBVPlatform platform = getExtendedVariant();
+ ISBVPlatform prevPlat;
+ while (platform != null) {
+ parentBuildIncludes.addAll(platform.getBuildIncludePaths());
+ prevPlat = platform;
+ platform = getExtendedVariant();
+ if (prevPlat.getName().equalsIgnoreCase(platform.getName())){
+ break;
+ }
+ }
+
+ return parentBuildIncludes;
+ }
+
+ protected void setROMBuildIncludePaths(Map<String, String> incPaths){
+ synchronized (this)
+ {
+ Set<String> set = incPaths.keySet();
+ for (String currPath : set){
+ IPath path = new Path(getEPOCRoot() + currPath);
+ romBuildIncludePaths.add(path);
+ }
+ }
+ }
+
+ protected List<IPath> getROMBuildIncludePathsFromParents(){
+
+ List<IPath> parentROMBuildIncludes = new ArrayList<IPath>();
+
+ ISBVPlatform platform = getExtendedVariant();
+ ISBVPlatform prevPlat;
+ while (platform != null) {
+ parentROMBuildIncludes.addAll(platform.getROMBuildIncludePaths());
+ prevPlat = platform;
+ platform = getExtendedVariant();
+ if (prevPlat.getName().equalsIgnoreCase(platform.getName())){
+ break;
+ }
+ }
+
+ return parentROMBuildIncludes;
+ }
+ protected String getEPOCRoot(){
+
+ String EPOC32_INCLUDE = "epoc32" + File.separator + "include";
+ if (sdkIncludePath.toOSString().contains(EPOC32_INCLUDE)){
+ return sdkIncludePath.toOSString().substring(0, sdkIncludePath.toOSString().indexOf(EPOC32_INCLUDE));
+ }
+
+ return sdkIncludePath.toOSString();
+ }
+
+ public List<IPath> getBuildIncludePaths(){
+ List<IPath> fullList = new ArrayList<IPath>();
+
+ fullList.addAll(systemBuildIncludePaths);
+ fullList.addAll(getBuildIncludePathsFromParents());
+
+ return fullList;
+ }
+
+ public List<IPath> getROMBuildIncludePaths(){
+ List<IPath> fullList = new ArrayList<IPath>();
+
+ fullList.addAll(romBuildIncludePaths);
+ fullList.addAll(getROMBuildIncludePathsFromParents());
+
+ return fullList;
+ }
+
+
}
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBVPlatform.java Mon May 11 13:45:30 2009 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBVPlatform.java Tue May 12 08:26:15 2009 -0500
@@ -12,6 +12,8 @@
*/
package com.nokia.carbide.cpp.sdk.core;
+import java.util.List;
+
import org.eclipse.core.runtime.IPath;
import com.nokia.carbide.cpp.epoc.engine.EpocEnginePlugin;
@@ -31,7 +33,7 @@
ISBVCatalog getCatalog();
/**
- * Get the platform's name, as seen in the .var filename.
+ * Get the platform's name, from the VARIANT keyword value.
*
* @return name, never null
*/
@@ -47,22 +49,6 @@
* @return path, never null
*/
IPath getSBVPath();
-
- /**
- * Get the system include path for this variant.
- * @return full filesystem path to the include directory for the variant,
- * which may be the parent/customized platform's directory for virtual
- * variant, or null if no non-virtual parent exists.
- */
- IPath getSystemIncludePath();
-
- /**
- * Get the system include file paths needed for this variant and all its parents.
- * This does not include the epoc32\include\oem directory, which is presumed
- * for all platforms.
- * @return array of full filesystem paths, never null
- */
- IPath[] getSystemIncludePaths();
/**
* Get the name of the variant this SBV platform extends
@@ -72,7 +58,7 @@
/**
* Get the variant platform this platform extends
- * @return
+ * @return The ISBVPlatform, or null if it does not extend a platform
*/
public ISBVPlatform getExtendedVariant();
@@ -88,4 +74,16 @@
*/
public IPath getBuildVariantHRHFile();
+ /**
+ * The list of BUILD_INCLUDE paths from the variant and all it's parents
+ * @return list of paths
+ */
+ List<IPath> getBuildIncludePaths();
+
+ /**
+ * The list of ROM_INCLUDE paths from the variant and all it's parents
+ * @return list of paths
+ */
+ List<IPath> getROMBuildIncludePaths();
+
}
--- a/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/model/sbv/ISBVView.java Mon May 11 13:45:30 2009 -0500
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/model/sbv/ISBVView.java Tue May 12 08:26:15 2009 -0500
@@ -17,6 +17,8 @@
package com.nokia.carbide.cpp.epoc.engine.model.sbv;
+import java.util.Map;
+
import com.nokia.carbide.cpp.epoc.engine.model.IView;
/**
@@ -28,8 +30,9 @@
*/
public interface ISBVView extends IView<ISBVOwnedModel> {
- /** Get the name of SBV as a platform. */
- String getName();
+ public static final String INCLUDE_FLAG_SET = "SET";
+ public static final String INCLUDE_FLAG_PREPEND = "PREPEND";
+ public static final String INCLUDE_FLAG_APPEND = "APPEND";
/** Set the EXTENDS platform.
* @param binary variant platform may not be null, but may be "" */
@@ -63,4 +66,42 @@
*/
String getBuildVariantHRH();
+ /**
+ * Set the name of the VARIANT
+ * @param variantName
+ */
+ void setVariantName(String variantName);
+
+ /**
+ * Get the name of the VARIANT
+ *
+ * @return the variant name
+ */
+ String getVariantName();
+
+
+ /**
+ * add a build include path
+ */
+ void addBuildInclude(String arguments);
+
+ /**
+ * Get the BUILD_INLCUDES
+ * @return A map of the build includes: <Include dir, flag>
+ */
+ Map<String, String> getBuildIncludes();
+
+ /**
+ * add a rom build include path
+ */
+ void addROMInclude(String arguments);
+
+ /**
+ * Get the ROM_INLCUDES
+ * @return A map of the build includes: <Include dir, flag>
+ */
+ Map<String, String> getROMBuildIncludes();
+
+
+
}
--- a/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/sbv/SBVView.java Mon May 11 13:45:30 2009 -0500
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/sbv/SBVView.java Tue May 12 08:26:15 2009 -0500
@@ -37,12 +37,21 @@
public class SBVView extends ViewBase<ISBVOwnedModel> implements ISBVView {
+ /** The name of the variant that this configuration extends */
private static final String EXTENDS = "EXTENDS"; //$NON-NLS-1$
+ /** The name of the variant */
+ private static final String VARIANT = "VARIANT"; //$NON-NLS-1$
+ /** Defines the variant as a virtual variant, which means that this variant configuration is not compiled. */
private static final String VIRTUAL = "VIRTUAL"; //$NON-NLS-1$
+ /** The global variant hrh file, which is include to the building and image creation. If this parameter is not existing the system tries to include a <variantname>.hrh */
private static final String VARIANT_HRH = "VARIANT_HRH"; //$NON-NLS-1$
-
+ /** set,prepend or append include paths to the global list of build time system includes (Used during abld command). */
+ private static final String BUILD_INCLUDE = "BUILD_INCLUDE"; //$NON-NLS-1$
+ /** set,prepend or append include paths to the global list of rom build time system includes (Used during buildrom.pl command). */
+ private static final String ROM_INCLUDE = "ROM_INCLUDE"; //$NON-NLS-1$
private IASTSBVTranslationUnit tu;
+ private String variantName;
private boolean sawHeaderComment;
private boolean sawExtends;
private boolean sawBuildHRH;
@@ -50,6 +59,12 @@
private String varintHRHStr;
private boolean isVirtual;
+ /** Path, flag */
+ private Map<String, String> buildIncludePaths = new HashMap<String, String>();
+
+ /** ROM build includes */
+ private Map<String, String> romBuildIncludePaths = new HashMap<String, String>();;
+
/**
* @param model
* @param parser
@@ -95,11 +110,23 @@
sawExtends = true;
}
- if (!sawBuildHRH && option.equals(VARIANT_HRH)) {
+ else if (!sawBuildHRH && option.equals(VARIANT_HRH)) {
setBuildHRHFile(value);
sawBuildHRH = true;
}
+ else if (option.equals(VARIANT)) {
+ setVariantName(value);
+ }
+
+ else if (option.equals(BUILD_INCLUDE)){
+ addBuildInclude(value);
+ }
+
+ else if (option.equals(ROM_INCLUDE)){
+ addROMInclude(value);
+ }
+
}
/**
@@ -183,14 +210,6 @@
}
/* (non-Javadoc)
- * @see com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView#getName()
- */
- public String getName() {
- return getModel().getPath().removeFileExtension().lastSegment();
- }
-
-
- /* (non-Javadoc)
* @see com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView#setCustomizes(java.lang.String)
*/
public void setExtends(String platform) {
@@ -223,6 +242,38 @@
varintHRHStr = pathStr;
}
+ public void setVariantName(String variantName){
+ this.variantName = variantName;
+ }
+
+ public String getVariantName(){
+ return variantName;
+ }
+
+ public void addBuildInclude(String arguments) {
+ String[] args = arguments.split("\\s+");
+ if (args.length == 2){
+ buildIncludePaths.put(args[1], args[0]);
+ }
+
+ }
+
+ public void addROMInclude(String arguments) {
+ String[] args = arguments.split("\\s+");
+ if (args.length == 2){
+ romBuildIncludePaths.put(args[1], args[0]);
+ }
+
+ }
+
+ public Map<String, String> getBuildIncludes() {
+ return buildIncludePaths;
+ }
+
+ public Map<String, String> getROMBuildIncludes() {
+ return romBuildIncludePaths;
+ }
+
}