Carbide.c++ SDK: Reading MMP Statements with the EpocEngine and IMMPData
In a previous blog entry I gave a quick overview of some of the basic Carbide.c++ SDK APIs and managers. This topic I’ll quickly show how you can read the MMP data for any build configuration (ICarbideBuildConfiguration). The main interface for retrieving MMP data is “com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPData”. Once you get access to this interface you can learn anything you want to about a particular MMP file.
Prerequisite: All MMP and bld.inf parsing requires a dependency to the plugin “com.nokia.carbide.cpp.epoc.engine”.
Typically most keywords of interest are either single string settings (TARGETTYPE, TARGET, EPOCSTACKSIZE) or list of settings (MACRO, CAPABILITY, LANG). Other types can be directly retrieved from IMMPData routines so check the API documentation for specifics.
The example provided simply iterates through all the MMP files of a particular build configuration and grabs a list value and single item setting. You’ll need to get the particular MMP file you are interested in. Play around with the IMMPData object in the run method and you can quickly get the idea.
// Assumes buildConfig (ICarbideBuildConfiguration) is known
for (IPath mmpPath : EpocEngineHelper.getMMPFilesForBuildConfiguration(buildConfig)) {
Object data = EpocEnginePlugin.runWithMMPData(mmpPath, new
DefaultMMPViewConfiguration(buildConfig.getCarbideProject().getProject(),
buildConfig, new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() {
public Object run(IMMPData mmpData) {
// Example, getting a keyword as a list of strings
List macros = mmpData.getListArgumentSettings().get(EMMPStatement.MACRO);
// The real return value, getting a single argument setting
return mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGETTYPE);
}
});
// Make sure to test for and cast to proper Object type!
String mmpStatement = (String)data; // Now we should have the TARGETTYPE
}



