Fix bug 11324. Prefer *.flm over *.mk/*.meta for the actual extension makefile driver files
authorEd Swartz <ed.swartz@nokia.com>
Fri, 02 Jul 2010 09:21:43 -0500
changeset 1577 d3829d713a38
parent 1570 2f7897e15774
child 1578 07cfb1a5f33f
Fix bug 11324. Prefer *.flm over *.mk/*.meta for the actual extension makefile driver files
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java
project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/views/SPNViewContentProvider.java
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java	Fri Jul 02 08:45:33 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java	Fri Jul 02 09:21:43 2010 -0500
@@ -171,14 +171,28 @@
 								BldInfViewPathHelper helper = new BldInfViewPathHelper(data, context);
 								for (IExtension extension : data.getExtensions()) {
 									IPath extensionMakefileBase = helper.convertExtensionTemplateToFilesystem(extension.getTemplatePath());
-									normalFiles.add(extensionMakefileBase.addFileExtension("mk")); //$NON-NLS-1$
+									IPath makefile = getControllingFile(extensionMakefileBase);
+									normalFiles.add(makefile);
 								}
 								for (IExtension extension : data.getTestExtensions()) {
 									IPath extensionMakefileBase = helper.convertExtensionTemplateToFilesystem(extension.getTemplatePath());
-									testFiles.add(extensionMakefileBase.addFileExtension("mk")); //$NON-NLS-1$
+									IPath makefile = getControllingFile(extensionMakefileBase);
+									testFiles.add(makefile);
 								}
 								return null;
 							}
+
+							private IPath getControllingFile(
+									IPath extensionMakefileBase) {
+								IPath candidate = extensionMakefileBase.addFileExtension("mk"); //$NON-NLS-1$
+								if (candidate.toFile().exists())
+									return candidate;
+								if ("export".equals(extensionMakefileBase.getFileExtension())) //$NON-NLS-1$
+									candidate = extensionMakefileBase.removeFileExtension().addFileExtension("flm"); //$NON-NLS-1$
+								else
+									candidate = extensionMakefileBase.addFileExtension("flm"); //$NON-NLS-1$
+								return candidate;
+							}
 					});
 	
 				monitor.worked(1);
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/views/SPNViewContentProvider.java	Fri Jul 02 08:45:33 2010 -0500
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/views/SPNViewContentProvider.java	Fri Jul 02 09:21:43 2010 -0500
@@ -867,12 +867,24 @@
 									visitedPaths.add(baseExtensionMakefilePath);
 									
 									IPath extensionMakefilePath = baseExtensionMakefilePath.addFileExtension("mk");
-									IPath extensionMetaPath = baseExtensionMakefilePath.addFileExtension("meta");
-
-									addBldInfExtensionMakefile(objects, project, cpi, view,
-											extensionMakefilePath);
-									addBldInfExtensionMakefile(objects, project, cpi, view,
-											extensionMetaPath);
+									
+									if (extensionMakefilePath.toFile().exists()) {
+										// old-style
+										IPath extensionMetaPath = baseExtensionMakefilePath.addFileExtension("meta");
+										addBldInfExtensionMakefile(objects, project, cpi, view,
+												extensionMakefilePath);
+										addBldInfExtensionMakefile(objects, project, cpi, view,
+												extensionMetaPath);
+									} else {
+										// new-style (default for the future)
+										IPath flmMakefilePath;
+										if ("export".equals(baseExtensionMakefilePath.getFileExtension()))
+											flmMakefilePath = baseExtensionMakefilePath.removeFileExtension().addFileExtension("flm");
+										else
+											flmMakefilePath = baseExtensionMakefilePath.addFileExtension("flm");
+										addBldInfExtensionMakefile(objects, project, cpi, view,
+												flmMakefilePath);
+									}
 								}
 								return null;
 							}