# HG changeset patch # User Ed Swartz # Date 1259962594 21600 # Node ID f96e62c11eac2a8e2e8e52c0f471563d215b7674 # Parent 91399e4af0cf6a475ec20cbdabd5f212ea9b08cb More portability fixes for Linux. -- make EpocEnginePathHelper et al produce an IPath that matches an existing path in the filesystem even if the case doesn't match. File#getCanonical* does not do this in Unix. -- SISBuilderInfo2 and bld.inf exports fixes for full path detection -- make some tests less dependent on having specific SDKs available. -- fix some warnings diff -r 91399e4af0cf -r f96e62c11eac builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/BaseTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/BaseTest.java Fri Dec 04 15:36:34 2009 -0600 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.carbide.cdt.builder.test; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; + +import com.nokia.cpp.internal.api.utils.core.HostOS; + +import junit.framework.TestCase; + +/** + * + */ +public class BaseTest extends TestCase { + protected IPath getStockFullPath() { + return new Path(HostOS.IS_WIN32 ? "c:/" : "/opt/project"); + } +} diff -r 91399e4af0cf -r f96e62c11eac builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/ProjectPropertiesTest.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/ProjectPropertiesTest.java Fri Dec 04 15:31:34 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/ProjectPropertiesTest.java Fri Dec 04 15:36:34 2009 -0600 @@ -39,18 +39,18 @@ import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +@SuppressWarnings({ "deprecation" }) public class ProjectPropertiesTest extends TestCase { static IProject project; protected static final String PROJECT_NAME = "test-properties-project"; - private final String BLD_INF_PATH = "group\\"; - private final String BUILD_CONFIG_NAME1 = "Emulator Debug (WINSCW) [S60_3rd]"; - private final String BUILD_CONFIG_NAME2 = "Phone Debug (GCCE) [S60_3rd]"; - private final String BUILD_CONFIG_NAME3 = "Phone Release (ARMV5) [S60_3rd]"; + private final String BLD_INF_PATH = "group/"; private final String TRUE = "true"; private final String INF_COMPONENTS = "icons_scalable_dc.mk;HelloWorld.mmp"; - + + private List stockBuildConfigs; + private final String PKG_FILE1 = "\\sis\\test.pkg"; private final String KEY_FILE1 = "C:\\mycerts\\mykey.key"; private final String CER_FILE1 = "C:\\mycerts\\mycert.cer"; @@ -61,16 +61,19 @@ // First thing we have to do is actually create a project in a workspace... protected void setUp() throws Exception { + stockBuildConfigs = TestPlugin.getUsableBuildConfigs(); + if (project == null){ // turn off the indexer CCorePlugin.getIndexManager().setDefaultIndexerId(IPDOMManager.ID_NO_INDEXER); // there must be at least one build config to start with - List configs = new ArrayList(); - configs.add(SymbianBuildContext.getBuildContextFromDisplayName(BUILD_CONFIG_NAME1)); - + assertTrue("Some SDK needs at least 3 usable build configs", + stockBuildConfigs.size() >= 3); project = ProjectCorePlugin.createProject(PROJECT_NAME, null); - ProjectCorePlugin.postProjectCreatedActions(project, "group/bld.inf", configs, new ArrayList(), "Debug MMP", null, new NullProgressMonitor()); + ProjectCorePlugin.postProjectCreatedActions(project, "group/bld.inf", + stockBuildConfigs.subList(0, 1), + new ArrayList(), "Debug MMP", null, new NullProgressMonitor()); } super.setUp(); } @@ -99,7 +102,7 @@ // get a new copy of the info to make sure the changes we really applied ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project); assertEquals(BLD_INF_PATH, cpi.getProjectRelativeBldInfPath().toOSString()); - assertEquals(BUILD_CONFIG_NAME1, cpi.getDefaultBuildConfigName()); + assertEquals(stockBuildConfigs.get(0).getDisplayString(), cpi.getDefaultBuildConfigName()); assertTrue(cpi.isBuildingFromInf()); assertEquals(2, cpi.getInfBuildComponents().size()); } @@ -117,8 +120,9 @@ // Create a new configuration (which gets written to disk). // WARNING: This test will only pass when you have an SDK that is installed that // corresponds to the SDK specified in the build config display name - ISymbianBuildContext context = SymbianBuildContext.getBuildContextFromDisplayName(BUILD_CONFIG_NAME2); - assertNotNull(context); + if (stockBuildConfigs.size() == 1) + return; + ISymbianBuildContext context = stockBuildConfigs.get(1); ICarbideBuildConfiguration newConfig = cpm.createNewConfiguration(context, true); @@ -126,7 +130,7 @@ assertNotNull(newConfig); // Check that the config name was set correctly in the object - assertEquals(BUILD_CONFIG_NAME2, newConfig.getDisplayString()); + assertEquals(context.getDisplayString(), newConfig.getDisplayString()); // check that we can get back to the project from the config... assertEquals(cpm, newConfig.getCarbideProject()); @@ -135,7 +139,6 @@ } public void testReadConfigurationData() throws Exception { - //TODO: Here need to read all config data on this call... // Right now we're just dealing with a single config property. ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project); @@ -144,15 +147,15 @@ List configList = cpi.getBuildConfigurations(); assertEquals(2, configList.size()); - ICarbideBuildConfiguration config = cpi.getNamedConfiguration(BUILD_CONFIG_NAME1); - assertEquals(BUILD_CONFIG_NAME1, config.getDisplayString()); + ICarbideBuildConfiguration config = cpi.getNamedConfiguration(stockBuildConfigs.get(0).getDisplayString()); + assertEquals(stockBuildConfigs.get(0).getDisplayString(), config.getDisplayString()); } public void testDeleteConfigurationData() throws Exception { ICarbideProjectModifier cpm = CarbideBuilderPlugin.getBuildManager().getProjectModifier(project); assertNotNull(cpm); - ICarbideBuildConfiguration config = cpm.getNamedConfiguration(BUILD_CONFIG_NAME2); + ICarbideBuildConfiguration config = cpm.getNamedConfiguration(stockBuildConfigs.get(1).getDisplayString()); assertNotNull(config); cpm.deleteConfiguration(config); cpm.saveChanges(); @@ -168,11 +171,11 @@ ICarbideProjectModifier cpm = CarbideBuilderPlugin.getBuildManager().getProjectModifier(project); assertEquals(1, cpm.getBuildConfigurations().size()); - ISymbianBuildContext context2 = SymbianBuildContext.getBuildContextFromDisplayName(BUILD_CONFIG_NAME2); + ISymbianBuildContext context2 = SymbianBuildContext.getBuildContextFromDisplayName(stockBuildConfigs.get(1).getDisplayString()); assertNotNull(context2); cpm.createNewConfiguration(context2, true); - ISymbianBuildContext context3 = SymbianBuildContext.getBuildContextFromDisplayName(BUILD_CONFIG_NAME3); + ISymbianBuildContext context3 = SymbianBuildContext.getBuildContextFromDisplayName(stockBuildConfigs.get(2).getDisplayString()); assertNotNull(context3); cpm.createNewConfiguration(context3, false); @@ -184,7 +187,7 @@ assertEquals(3, cpi.getBuildConfigurations().size()); ICarbideBuildConfiguration defConfig = cpi.getDefaultConfiguration(); - assertEquals(BUILD_CONFIG_NAME2, defConfig.getDisplayString()); + assertEquals(stockBuildConfigs.get(1).getDisplayString(), defConfig.getDisplayString()); } // Test the reading and writing of the default configuration @@ -193,10 +196,10 @@ assertEquals(3, cpm.getBuildConfigurations().size()); ICarbideBuildConfiguration defConfig = cpm.getDefaultConfiguration(); - assertEquals(BUILD_CONFIG_NAME2, defConfig.getDisplayString()); + assertEquals(stockBuildConfigs.get(1).getDisplayString(), defConfig.getDisplayString()); // make another configuration the default one... - ICarbideBuildConfiguration newDefaultConfig = cpm.getNamedConfiguration(BUILD_CONFIG_NAME3); + ICarbideBuildConfiguration newDefaultConfig = cpm.getNamedConfiguration(stockBuildConfigs.get(2).getDisplayString()); assertNotNull(newDefaultConfig); cpm.setDefaultConfiguration(newDefaultConfig); cpm.saveChanges(); @@ -206,7 +209,7 @@ // Check to see that we got the new default config defConfig = cpi.getDefaultConfiguration(); - assertEquals(BUILD_CONFIG_NAME3, defConfig.getDisplayString()); + assertEquals(stockBuildConfigs.get(2).getDisplayString(), defConfig.getDisplayString()); } public void testWritePKGData(){ @@ -253,7 +256,6 @@ } public void testSBSv1BuildArgsReadWrite(){ - final String build_ARG = "-testbuild"; final String clean_ARG = "-testclean"; final String export_ARG = "-testexport"; @@ -273,7 +275,7 @@ // Just sanity check to make sure deprecated methods still exist. IBuildArgumentsInfo testDeprecation = defaultConfig.getBuildArgumentsInfo(); - String test = testDeprecation.getAbldBuildArgs(); + /*String test =*/ testDeprecation.getAbldBuildArgs(); // read the arguments @@ -311,15 +313,15 @@ BuildArgumentsInfo argInfoFromDisk = defaultConfig.getBuildArgumentsInfoCopy(); // read the args now that were pulled from disk, make sure it's OK - assertTrue("Failed to re-read build args", argInfoCopyVerify.abldBuildArgs.contains(build_ARG)); - assertTrue("Failed to re-read clean args", argInfoCopyVerify.abldCleanArgs.contains(clean_ARG)); - assertTrue("Failed to re-read export args", argInfoCopyVerify.abldExportArgs.contains(export_ARG)); - assertTrue("Failed to re-read final args", argInfoCopyVerify.abldFinalArgs.contains(final_ARG)); - assertTrue("Failed to re-read freeze args", argInfoCopyVerify.abldFreezeArgs.contains(freeze_ARG)); - assertTrue("Failed to re-read library args", argInfoCopyVerify.abldLibraryArgs.contains(library_ARG)); - assertTrue("Failed to re-read makefile args", argInfoCopyVerify.abldMakefileArgs.contains(makefile_ARG)); - assertTrue("Failed to re-read resource args", argInfoCopyVerify.abldResourceArgs.contains(resource_ARG)); - assertTrue("Failed to re-read target args", argInfoCopyVerify.abldTargetArgs.contains(target_ARG)); + assertTrue("Failed to re-read build args", argInfoFromDisk.abldBuildArgs.contains(build_ARG)); + assertTrue("Failed to re-read clean args", argInfoFromDisk.abldCleanArgs.contains(clean_ARG)); + assertTrue("Failed to re-read export args", argInfoFromDisk.abldExportArgs.contains(export_ARG)); + assertTrue("Failed to re-read final args", argInfoFromDisk.abldFinalArgs.contains(final_ARG)); + assertTrue("Failed to re-read freeze args", argInfoFromDisk.abldFreezeArgs.contains(freeze_ARG)); + assertTrue("Failed to re-read library args", argInfoFromDisk.abldLibraryArgs.contains(library_ARG)); + assertTrue("Failed to re-read makefile args", argInfoFromDisk.abldMakefileArgs.contains(makefile_ARG)); + assertTrue("Failed to re-read resource args", argInfoFromDisk.abldResourceArgs.contains(resource_ARG)); + assertTrue("Failed to re-read target args", argInfoFromDisk.abldTargetArgs.contains(target_ARG)); // Now restore the settings, write to disk and verify defaultConfig.setBuildArgumentsInfo(argInfoCopyOrig); diff -r 91399e4af0cf -r f96e62c11eac builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestDefaultTranslationUnitProvider.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestDefaultTranslationUnitProvider.java Fri Dec 04 15:31:34 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestDefaultTranslationUnitProvider.java Fri Dec 04 15:36:34 2009 -0600 @@ -21,6 +21,7 @@ import com.nokia.cpp.internal.api.utils.core.FileUtils; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.Path; import java.io.File; @@ -56,7 +57,7 @@ assertSame(tu, tu2); // detect change - Thread.sleep(500); + Thread.sleep(FileUtils.getMinimumFileTimestampResolution(new Path(file1.getAbsolutePath()))); FileUtils.writeFileContents(file1, "text2".toCharArray(), null); tu2 = tuProvider.getTranslationUnit(file1, cachingModelDocumentProvider); assertNotNull(tu2); diff -r 91399e4af0cf -r f96e62c11eac builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestEpocEngineHelper.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestEpocEngineHelper.java Fri Dec 04 15:31:34 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestEpocEngineHelper.java Fri Dec 04 15:36:34 2009 -0600 @@ -48,11 +48,9 @@ import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; import com.nokia.cpp.internal.api.utils.core.FileUtils; -import junit.framework.TestCase; +public class TestEpocEngineHelper extends BaseTest { -public class TestEpocEngineHelper extends TestCase { - - private static final String BASE_DIR = "Data/TestProject/"; + private static final String BASE_DIR = "data/TestProject/"; private static final String CARBIDE_PROJECT_NAME = "CarbideProject"; private static final String NON_CARBIDE_PROJECT_NAME = "NonCarbideProject"; private static final String PROJECT_RELATIVE_BLDINF_PATH = "group/bld.inf"; diff -r 91399e4af0cf -r f96e62c11eac builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestEpocEnginePathHelper.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestEpocEnginePathHelper.java Fri Dec 04 15:31:34 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestEpocEnginePathHelper.java Fri Dec 04 15:36:34 2009 -0600 @@ -17,19 +17,21 @@ */ package com.nokia.carbide.cdt.builder.test; -import com.nokia.carbide.cdt.builder.EpocEnginePathHelper; -import com.nokia.cpp.internal.api.utils.core.FileUtils; +import java.io.File; +import java.io.FileFilter; -import org.eclipse.core.resources.*; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; -import java.io.File; -import java.io.FileFilter; +import com.nokia.carbide.cdt.builder.EpocEnginePathHelper; +import com.nokia.cpp.internal.api.utils.core.FileUtils; -import junit.framework.TestCase; - -public class TestEpocEnginePathHelper extends TestCase { +public class TestEpocEnginePathHelper extends BaseTest { final static String PROJECT1_NAME = "TestEngine"; final static String PROJECT2_NAME = "TestEngineImported"; private IProject project1; @@ -110,10 +112,10 @@ assertFalse(path.isAbsolute()); assertEquals(new Path(projectName).append("foo.cpp"), path); - path = helper.convertToWorkspace(new Path("\\sys\\bin")); + path = helper.convertToWorkspace(new Path("/sys/bin")); assertNull(path); - path = helper.convertToWorkspace(new Path("c:\\data\\aif.rss")); + path = helper.convertToWorkspace(getStockFullPath().append("data/aif.rss")); assertNull(path); } @@ -152,13 +154,13 @@ assertFalse(path.isAbsolute()); assertEquals(new Path("foo.cpp"), path); - path = helper.convertToProject(new Path("\\sys\\bin")); + path = helper.convertToProject(new Path("/sys/bin")); assertNull(path); - path = helper.convertToProject(new Path("c:\\data\\aif.rss")); + path = helper.convertToProject(getStockFullPath().append("data/aif.rss")); assertNull(path); - path = helper.convertToProject(new Path("\\epoc32\\include\\oem")); + path = helper.convertToProject(new Path("/epoc32/include/oem")); assertNull(path); } @@ -188,15 +190,15 @@ assertEquals(projectRoot.append("foo.cpp"), path); // not a real EPOCROOT filesystem path, so it gets the drive letter - path = helper.convertToFilesystem(new Path("\\sys\\bin")); + path = helper.convertToFilesystem(new Path("/sys/bin")); assertNotNull(path); assertTrue(path.isAbsolute()); - assertEquals(new Path("\\sys\\bin").setDevice(projectRoot.getDevice()), path); + assertEquals(new Path("/sys/bin").setDevice(projectRoot.getDevice()), path); - path = helper.convertToFilesystem(new Path("c:\\data\\aif.rss")); + path = helper.convertToFilesystem(getStockFullPath().append("data/aif.rss")); assertNotNull(path); assertTrue(path.isAbsolute()); - assertEquals(new Path("c:\\data\\aif.rss"), path); + assertEquals(getStockFullPath().append("data/aif.rss"), path); } private void __testToFilesystemPaths(IProject project, IPath projectRoot) { @@ -286,10 +288,10 @@ assertEquals(new Path(project.getName()).append("Base.Mmp"), path); assertNotNull(root.findMember(path)); - path = helper.convertToWorkspace(new Path("\\sys\\bin")); + path = helper.convertToWorkspace(new Path("/sys/bin")); assertNull(path); - path = helper.convertToWorkspace(new Path("c:\\data\\aif.rss")); + path = helper.convertToWorkspace(getStockFullPath().append("data/aif.rss")); assertNull(path); ///// @@ -308,7 +310,7 @@ //////// - path = helper.convertFilesystemToWorkspace(new Path("c:/not/in/workspace")); + path = helper.convertFilesystemToWorkspace(getStockFullPath().append("not/in/workspace")); assertNull(path); /* diff -r 91399e4af0cf -r f96e62c11eac builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestImageMakefileViewPathHelper.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestImageMakefileViewPathHelper.java Fri Dec 04 15:31:34 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestImageMakefileViewPathHelper.java Fri Dec 04 15:36:34 2009 -0600 @@ -17,6 +17,18 @@ */ package com.nokia.carbide.cdt.builder.test; +import java.io.ByteArrayInputStream; +import java.io.File; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; + import com.nokia.carbide.cdt.builder.DefaultImageMakefileViewConfiguration; import com.nokia.carbide.cdt.builder.ImageMakefileViewPathHelper; import com.nokia.carbide.cpp.epoc.engine.EpocEnginePlugin; @@ -27,15 +39,7 @@ import com.nokia.carbide.cpp.epoc.engine.preprocessor.AllNodesViewFilter; import com.nokia.cpp.internal.api.utils.core.FileUtils; -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.*; - -import java.io.ByteArrayInputStream; -import java.io.File; - -import junit.framework.TestCase; - -public class TestImageMakefileViewPathHelper extends TestCase { +public class TestImageMakefileViewPathHelper extends BaseTest { final static String PROJECT1_NAME = "TestMk"; final static String PROJECT2_NAME = "TestMkImported"; private static final IPath IMAGE1_MAKEFILE_PATH = new Path("gfx/Images1.mk"); diff -r 91399e4af0cf -r f96e62c11eac builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestMMPViewPathHelper.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestMMPViewPathHelper.java Fri Dec 04 15:31:34 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestMMPViewPathHelper.java Fri Dec 04 15:36:34 2009 -0600 @@ -17,21 +17,26 @@ */ package com.nokia.carbide.cdt.builder.test; -import com.nokia.carbide.cdt.builder.*; +import java.io.File; +import java.io.FileFilter; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; + +import com.nokia.carbide.cdt.builder.EMMPPathContext; +import com.nokia.carbide.cdt.builder.InvalidDriveInMMPPathException; +import com.nokia.carbide.cdt.builder.MMPViewPathHelper; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.cpp.internal.api.utils.core.FileUtils; - -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; +import com.nokia.cpp.internal.api.utils.core.HostOS; -import java.io.File; -import java.io.FileFilter; - -import junit.framework.TestCase; - -public class TestMMPViewPathHelper extends TestCase { +public class TestMMPViewPathHelper extends BaseTest { final static String PROJECT1_NAME = "TestMmp"; final static String PROJECT2_NAME = "TestMmpImported"; private IPath epocRoot; @@ -49,7 +54,7 @@ super.setUp(); tmpDir = FileUtils.getTemporaryDirectory(); ISymbianSDK sdk = SDKCorePlugin.getSDKManager().getSDKList().get(0); - //epocRoot = new Path("c:\\symbian\\9.1\\S60_3rd\\"); + //epocRoot = new Path("c:/symbian/9.1/S60_3rd/"); epocRoot = new Path(sdk.getEPOCROOT()); project1 = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT1_NAME); if (project1.exists()) @@ -117,15 +122,15 @@ assertEquals(new Path(projectName).append("foo.cpp"), path); path = helper.convertMMPToWorkspace(EMMPPathContext.USERINCLUDE, - new Path("\\sys\\bin")); + new Path("/sys/bin")); assertNull(path); path = helper.convertMMPToWorkspace(EMMPPathContext.AIF_SOURCE, - new Path("c:\\data\\aif.rss")); + getStockFullPath().append("data/aif.rss")); assertNull(path); path = helper.convertMMPToWorkspace(EMMPPathContext.SYSTEMINCLUDE, - new Path("+\\include\\oem")); + new Path("+/include/oem")); assertNull(path); } @@ -171,19 +176,19 @@ assertEquals(new Path("foo.cpp"), path); path = helper.convertMMPToProject(EMMPPathContext.USERINCLUDE, - new Path("\\sys\\bin")); + new Path("/sys/bin")); assertNull(path); path = helper.convertMMPToWorkspace(EMMPPathContext.AIF_SOURCE, - new Path("c:\\data\\aif.rss")); + getStockFullPath().append("data/aif.rss")); assertNull(path); path = helper.convertMMPToWorkspace(EMMPPathContext.USERINCLUDE, - new Path("\\epoc32\\include\\oem")); + new Path("/epoc32/include/oem")); assertNull(path); path = helper.convertMMPToWorkspace(EMMPPathContext.SYSTEMINCLUDE, - new Path("+\\include\\oem")); + new Path("+/include/oem")); assertNull(path); } @@ -218,16 +223,16 @@ // this is not a valid path so it will get a drive letter from the project path = helper.convertMMPToFilesystem(EMMPPathContext.USERINCLUDE, - new Path("\\sys\\bin")); + new Path("/sys/bin")); assertNotNull(path); assertTrue(path.isAbsolute()); - assertEquals(new Path("\\sys\\bin").setDevice(projectRoot.getDevice()), path); + assertEquals(new Path("/sys/bin").setDevice(projectRoot.getDevice()), path); path = helper.convertMMPToFilesystem(EMMPPathContext.AIF_SOURCE, - new Path("c:\\data\\aif.rss")); + getStockFullPath().append("data/aif.rss")); assertNotNull(path); assertTrue(path.isAbsolute()); - assertEquals(new Path("c:\\data\\aif.rss"), path); + assertEquals(getStockFullPath().append("data/aif.rss"), path); } private void __testToFilesystemPaths(IProject project, IPath projectRoot) { @@ -239,19 +244,19 @@ baseFilesystemPathTests(projectRoot, helper); path = helper.convertMMPToFilesystem(EMMPPathContext.USERINCLUDE, - new Path("\\epoc32\\include\\oem")); + new Path("/epoc32/include/oem")); assertNotNull(path); assertTrue(path.isAbsolute()); // the caps may change for the real FS - //assertEquals(epocRoot.append("\\epoc32\\include\\oem"), path); - assertEquals(epocRoot.append("\\epoc32\\include\\oem").toOSString().toLowerCase(), path.toOSString().toLowerCase()); + //assertEquals(epocRoot.append("/epoc32/include/oem"), path); + assertEquals(epocRoot.append("/epoc32/include/oem").toOSString().toLowerCase(), path.toOSString().toLowerCase()); path = helper.convertMMPToFilesystem(EMMPPathContext.SYSTEMINCLUDE, - new Path("+\\include\\oem")); + new Path("+/include/oem")); assertNotNull(path); assertTrue(path.isAbsolute()); - //assertEquals(epocRoot.append("\\epoc32\\include\\oem"), path); - assertEquals(epocRoot.append("\\epoc32\\include\\oem").toOSString().toLowerCase(), path.toOSString().toLowerCase()); + //assertEquals(epocRoot.append("/epoc32/include/oem"), path); + assertEquals(epocRoot.append("/epoc32/include/oem").toOSString().toLowerCase(), path.toOSString().toLowerCase()); } public void testToFilesystemPaths() { @@ -270,11 +275,11 @@ // no EPOCROOT, so no answers path = helper.convertMMPToFilesystem(EMMPPathContext.USERINCLUDE, - new Path("\\epoc32\\include\\oem")); + new Path("/epoc32/include/oem")); assertNull(path); path = helper.convertMMPToFilesystem(EMMPPathContext.SYSTEMINCLUDE, - new Path("+\\include\\oem")); + new Path("+/include/oem")); assertNull(path); } @@ -314,7 +319,7 @@ try { path = helper.convertProjectOrFullPathToMMP(EMMPPathContext.SOURCEPATH, epocRoot.append("epoc32").append("include").append("oem")); - assertEquals(new Path("\\epoc32\\include\\oem"), path); + assertEquals(new Path("/epoc32/include/oem"), path); } catch (InvalidDriveInMMPPathException e) { fail(); } @@ -327,13 +332,15 @@ fail(); } - try { - path = helper.convertProjectOrFullPathToMMP(EMMPPathContext.AIF_SOURCE, - new Path("f:/schnozz/foo.rss")); - fail(); - } catch (InvalidDriveInMMPPathException e) { - assertEquals(new Path("f:/schnozz/foo.rss"), e.getPath()); - assertEquals(new Path("/schnozz/foo.rss"), e.getPathNoDevice()); + if (HostOS.IS_WIN32) { + try { + path = helper.convertProjectOrFullPathToMMP(EMMPPathContext.AIF_SOURCE, + new Path("f:/schnozz/foo.rss")); + fail(); + } catch (InvalidDriveInMMPPathException e) { + assertEquals(new Path("f:/schnozz/foo.rss"), e.getPath()); + assertEquals(new Path("/schnozz/foo.rss"), e.getPathNoDevice()); + } } } @@ -351,11 +358,11 @@ twoWayTest(helper, EMMPPathContext.SOURCE, new Path("src/file/../../foo.cpp")); twoWayTest(helper, EMMPPathContext.START_BITMAP_SOURCE, new Path("src/file/../../foo.cpp")); - twoWayTest(helper, EMMPPathContext.USERINCLUDE, new Path("\\sys\\bin")); + twoWayTest(helper, EMMPPathContext.USERINCLUDE, new Path("/sys/bin")); // this case won't pass since drive letters are dropped. - //twoWayTest(helper, EMMPPathContext.AIF_SOURCE, new Path("c:\\data\\aif.rss")); - twoWayTest(helper, EMMPPathContext.AIF_SOURCE, new Path("\\data\\aif.rss")); - twoWayTest(helper, EMMPPathContext.SYSTEMINCLUDE, new Path("epoc32\\include\\oem")); + //twoWayTest(helper, EMMPPathContext.AIF_SOURCE, new Path("c:/data/aif.rss")); + twoWayTest(helper, EMMPPathContext.AIF_SOURCE, new Path("/data/aif.rss")); + twoWayTest(helper, EMMPPathContext.SYSTEMINCLUDE, new Path("epoc32/include/oem")); } private void twoWayTest(MMPViewPathHelper helper, EMMPPathContext context, IPath path) { @@ -462,19 +469,19 @@ assertNotNull(root.findMember(path)); path = helper.convertMMPToWorkspace(EMMPPathContext.USERINCLUDE, - new Path("\\sys\\bin")); + new Path("/sys/bin")); assertNull(path); path = helper.convertMMPToWorkspace(EMMPPathContext.AIF_SOURCE, - new Path("c:\\data\\aif.rss")); + getStockFullPath().append("data/aif.rss")); assertNull(path); path = helper.convertMMPToWorkspace(EMMPPathContext.SYSTEMINCLUDE, - new Path("+\\include\\oem")); + new Path("+/include/oem")); assertNull(path); ///// - //test full paths + //test full paths. path = helper.convertMMPToWorkspace(EMMPPathContext.START_BITMAP_SOURCE, projectRoot.append("base.mmp")); assertNotNull(path); diff -r 91399e4af0cf -r f96e62c11eac builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestPKGViewPathHelper.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestPKGViewPathHelper.java Fri Dec 04 15:31:34 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestPKGViewPathHelper.java Fri Dec 04 15:36:34 2009 -0600 @@ -17,25 +17,36 @@ */ package com.nokia.carbide.cdt.builder.test; -import com.nokia.carbide.cdt.builder.*; -import com.nokia.carbide.cdt.builder.project.*; -import com.nokia.carbide.cdt.internal.api.builder.SISBuilderInfo2; -import com.nokia.carbide.cpp.epoc.engine.preprocessor.AcceptedNodesViewFilter; -import com.nokia.carbide.cpp.project.core.ProjectCorePlugin; -import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.*; +import java.io.ByteArrayInputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.IPDOMManager; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.*; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; -import java.io.ByteArrayInputStream; -import java.util.*; +import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; +import com.nokia.carbide.cdt.builder.DefaultViewConfiguration; +import com.nokia.carbide.cdt.builder.PKGViewPathHelper; +import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; +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.epoc.engine.preprocessor.AcceptedNodesViewFilter; +import com.nokia.carbide.cpp.project.core.ProjectCorePlugin; +import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.EPKGLanguage; +import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.IPKGInstallFile; +import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.IPKGModel; +import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.IPKGView; +import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.PKGModelHelper; -import junit.framework.TestCase; - -public class TestPKGViewPathHelper extends TestCase { +public class TestPKGViewPathHelper extends BaseTest { private static final String PROJECT_NAME = "TestPKG"; private static final IPath PKG_PATH = new Path("sis/test.pkg"); @@ -125,7 +136,7 @@ IPath path1 = new Path(config.getSDK().getEPOCROOT()).append("epoc32/release").append(config.getPlatformString()).append(config.getTargetString()).append("test.exe"); IPath path2 = project.getLocation().append("sis/test.txt"); - IPath path3 = new Path("\\Symbian\\9.1\\S60_3rd\\file.txt"); + IPath path3 = new Path("/Symbian/9.1/S60_3rd/file.txt"); List paths = new ArrayList(); diff -r 91399e4af0cf -r f96e62c11eac builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestPlugin.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestPlugin.java Fri Dec 04 15:31:34 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestPlugin.java Fri Dec 04 15:36:34 2009 -0600 @@ -74,17 +74,18 @@ } /** - * Get build configurations for the first non-empty SDK we find - * @return + * Get some build configurations for the first non-empty SDK we find. + * @return a list of contexts, maximum 8 */ public static List getUsableBuildConfigs() { for (ISymbianSDK sdk : SDKCorePlugin.getSDKManager().getSDKList()) { List contexts = sdk.getUnfilteredBuildConfigurations(); - if (contexts.size() > 0) - return contexts; + if (contexts.size() > 0) { + return contexts.subList(0, Math.min(contexts.size(), 8)); + } } TestCase.fail("No installed SDKs provide build configurations"); - return Collections.EMPTY_LIST; + return Collections.emptyList(); } } diff -r 91399e4af0cf -r f96e62c11eac builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestProjectExportsGatherer.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestProjectExportsGatherer.java Fri Dec 04 15:31:34 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestProjectExportsGatherer.java Fri Dec 04 15:36:34 2009 -0600 @@ -29,7 +29,7 @@ import junit.framework.TestCase; -public class TestProjectExportsGatherer extends TestCase { +public class TestProjectExportsGatherer extends BaseTest { private IPath projectDataPath; private IPath epocRoot; @@ -81,7 +81,7 @@ @Override protected void setUp() throws Exception { super.setUp(); - epocRoot = new Path("C:\\symbian\\9.4\\S60_5th"); + epocRoot = getStockFullPath().append("symbian/9.4/S60_5th"); } @@ -111,8 +111,8 @@ ProjectExportsGatherer gatherer = createGatherer(); IPath src1 = projectDataPath.append("gfx/foo.svg"); IPath src2 = projectDataPath.append("doc/README.txt"); - IPath epoc1 = new Path("c:\\private\\12345678\\foo.svg"); - IPath epoc2 = new Path("c:\\sys\\readmes\\README.txt"); + IPath epoc1 = new Path("c:/private/12345678/foo.svg"); + IPath epoc2 = new Path("c:/sys/readmes/README.txt"); Map filesystemToEpocExportMap = gatherer.getFilesystemToEpocExportMap(); assertEquals(2, filesystemToEpocExportMap.size()); @@ -136,15 +136,15 @@ projectDataPath = getProjectData("pkgOnly"); ProjectExportsGatherer gatherer = createGatherer(); - IPath epoc1a = projectDataPath.append("sis\\text\\englishfile.txt"); - IPath epoc1b = epocRoot.append("text\\frenchfile.txt"); - IPath dev1 = new Path("$:\\private\\10000005\\import\\InstTest\\lang.txt"); + IPath epoc1a = projectDataPath.append("sis/text/englishfile.txt"); + IPath epoc1b = epocRoot.append("text/frenchfile.txt"); + IPath dev1 = new Path("$:/private/10000005/import/InstTest/lang.txt"); - IPath epoc2 = epocRoot.append("epoc32\\text\\file1.txt"); - IPath dev2 = new Path("!:\\private\\10000005\\import\\InstTest\\file1.txt"); + IPath epoc2 = epocRoot.append("epoc32/text/file1.txt"); + IPath dev2 = new Path("!:/private/10000005/import/InstTest/file1.txt"); - IPath epoc3 = epocRoot.append("epoc32\\files\\option1.txt"); - IPath dev3 = new Path("!:\\private\\10000005\\import\\InstTest\\option1.txt"); + IPath epoc3 = epocRoot.append("epoc32/files/option1.txt"); + IPath dev3 = new Path("!:/private/10000005/import/InstTest/option1.txt"); Map filesystemToEpocExportMap = gatherer.getFilesystemToEpocExportMap(); assertEquals(0, filesystemToEpocExportMap.size()); @@ -174,21 +174,21 @@ projectDataPath = getProjectData("exportAndPkg"); ProjectExportsGatherer gatherer = createGatherer(); - IPath src1a = projectDataPath.append("sis\\text\\englishfile.txt"); - //IPath epoc1a = projectDataPath.append("sis\\text\\englishfile.txt"); - //IPath src1b = projectDataPath.append("sis\\text\\frenchfile.txt"); - IPath epoc1b = epocRoot.append("epoc32\\text\\frenchfile.txt"); - IPath dev1 = new Path("$:\\private\\10000005\\import\\InstTest\\lang.txt"); + IPath src1a = projectDataPath.append("sis/text/englishfile.txt"); + //IPath epoc1a = projectDataPath.append("sis/text/englishfile.txt"); + //IPath src1b = projectDataPath.append("sis/text/frenchfile.txt"); + IPath epoc1b = epocRoot.append("epoc32/text/frenchfile.txt"); + IPath dev1 = new Path("$:/private/10000005/import/InstTest/lang.txt"); - IPath src2 = projectDataPath.append("gfx\\foo.svg"); - IPath epocTarget2 = new Path("c:\\private\\12345678\\foo.svg"); - IPath epocHost2 = epocRoot.append("epoc32\\data\\c\\private\\12345678\\foo.svg"); - IPath dev2 = new Path("!:\\private\\10000005\\foo.svg"); + IPath src2 = projectDataPath.append("gfx/foo.svg"); + IPath epocTarget2 = new Path("c:/private/12345678/foo.svg"); + IPath epocHost2 = epocRoot.append("epoc32/data/c/private/12345678/foo.svg"); + IPath dev2 = new Path("!:/private/10000005/foo.svg"); - IPath src3 = projectDataPath.append("doc\\README.txt"); - IPath epocHost3 = epocRoot.append("epoc32\\release\\armv5\\udeb\\z\\sys\\readmes\\README.txt"); - IPath epoc3 = new Path("z:\\sys\\readmes\\README.txt"); - IPath dev3 = new Path("!:\\private\\10000005\\import\\InstTest\\README.txt"); + IPath src3 = projectDataPath.append("doc/README.txt"); + IPath epocHost3 = epocRoot.append("epoc32/release/armv5/udeb/z/sys/readmes/README.txt"); + IPath epoc3 = new Path("z:/sys/readmes/README.txt"); + IPath dev3 = new Path("!:/private/10000005/import/InstTest/README.txt"); IPath src4 = projectDataPath.append("inc/Test.h"); IPath epoc4 = new Path("/epoc32/include/Test.h"); diff -r 91399e4af0cf -r f96e62c11eac builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEnginePathHelper.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEnginePathHelper.java Fri Dec 04 15:31:34 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEnginePathHelper.java Fri Dec 04 15:36:34 2009 -0600 @@ -133,6 +133,7 @@ * @return workspace-relative non-absolute path, or null if not resolvable to workspace */ public IPath convertFilesystemToWorkspace(IPath fullPath) { + fullPath = FileUtils.findMatchingPathCaseInsensitive(fullPath); IPath wsPath = FileUtils.convertToWorkspacePath(fullPath, true); if (wsPath != null && wsPath.isAbsolute()) wsPath = wsPath.makeRelative(); @@ -191,7 +192,8 @@ /** * Convert the given path (from an IView API) into a - * canonical full path in the local filesystem. + * canonical full path in the local filesystem. This will resolve differences + * in case sensitivity. * @param path relative or absolute path * @return absolute path, never null unless it came in null */ @@ -216,7 +218,11 @@ // in case the path is absolute without a drive letter device = projectRoot.getDevice(); } + + // canonicalize (to remove .. , resolve links, etc) fullPath = new Path(fullPath.toFile().getCanonicalPath()).setDevice(device); + fullPath = FileUtils.findMatchingPathCaseInsensitive(fullPath); + } catch (IOException e) { } diff -r 91399e4af0cf -r f96e62c11eac builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ProjectExportsGatherer.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ProjectExportsGatherer.java Fri Dec 04 15:31:34 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ProjectExportsGatherer.java Fri Dec 04 15:36:34 2009 -0600 @@ -252,7 +252,7 @@ // we only support exports which might reasonably make it onto the device, // which means ones either explictly or implicitly targeting a drive. - if (targetPath.isAbsolute() && targetPath.getDevice() != null) { + if (isAbsoluteDrivePath(targetPath)) { // accept } else if (targetPath.isAbsolute() && targetPath.getDevice() == null @@ -325,32 +325,60 @@ } /** + * Tell if the path is a Win32 path with drive letter or UNC. + * @param path + */ + protected boolean isWin32DrivePath(IPath path) { + return (path.getDevice() != null && path.getDevice().length() == 2) + || (!HostOS.IS_WIN32 && path.segmentCount() > 0 && path.segment(0).matches("[A-Za-z]:")); + } + + /** + * Tell if the path is absolute -- e.g., according to the host or to Windows conventions. + * @param path + */ + protected boolean isAbsoluteDrivePath(IPath path) { + if (path.isAbsolute()) + return true; + if (isWin32DrivePath(path)) + return true; + return false; + } + + /** * Convert a path like c:\private\foo.svg to $(EPOCROOT)data\c\private\foo.svg * @param host * @return converted path or original */ private IPath epocHostToEPOCROOTData(IPath host) { - if (host.getDevice() == null || host.getDevice().length() > 2) - return host; - if (!host.isAbsolute()) + if (!isAbsoluteDrivePath(host)) return host; IPath nativ = epocRoot.append("epoc32").append("data") //$NON-NLS-1$ //$NON-NLS-2$ - .append(host.getDevice().substring(0, 1)).append(host.setDevice(null)); + .append(convertDriveToPathSegment(host)); return nativ; } /** + * @param host + * @return + */ + private IPath convertDriveToPathSegment(IPath host) { + if (HostOS.IS_WIN32) + return new Path(host.getDevice().substring(0, 1)).append(host.setDevice(null)); + else + return new Path(host.segment(0).substring(0, 1)).append(host.removeFirstSegments(1)); + } + + /** * Convert a path like c:\private\foo.svg to $(EPOCROOT)release\\\\ * @param host * @return converted path or original */ private IPath epocHostToEPOCPlatformData(IPath host) { - if (host.getDevice() == null || host.getDevice().length() > 2) - return host; - if (!host.isAbsolute()) + if (!isAbsoluteDrivePath(host)) return host; IPath nativ = epocRoot.append("epoc32").append("release").append(platform).append(target) //$NON-NLS-1$ //$NON-NLS-2$ - .append(host.getDevice().substring(0, 1)).append(host.setDevice(null)); + .append(convertDriveToPathSegment(host)); return nativ; } } diff -r 91399e4af0cf -r f96e62c11eac builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/SISBuilderInfo2.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/SISBuilderInfo2.java Fri Dec 04 15:31:34 2009 -0600 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/SISBuilderInfo2.java Fri Dec 04 15:36:34 2009 -0600 @@ -25,6 +25,7 @@ import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.cpp.internal.api.utils.core.HostOS; import com.nokia.cpp.internal.api.utils.core.TrackedResource; public class SISBuilderInfo2 implements ISISBuilderInfo { @@ -234,15 +235,18 @@ return searchLocation; } + protected IPath createFullPath(String path) { + IPath fullPath = new Path(path); + if (!fullPath.isAbsolute()) { + IPath projectPath = CarbideBuilderPlugin.getProjectRoot(projectTracker.getProject()); + if (projectPath != null) + fullPath = projectPath.append(fullPath); + } + return fullPath; + + } public IPath getPKGFullPath() { - IPath fullPath; - if (getPKGFileString().indexOf(":") > 0) { //$NON-NLS-1$ - fullPath = new Path(getPKGFileString()); - } else { - fullPath = CarbideBuilderPlugin.getProjectRoot(projectTracker.getProject()); - if (fullPath != null) - fullPath = fullPath.append(getPKGFileString()); - } + IPath fullPath = createFullPath(getPKGFileString()); return fullPath; } @@ -251,13 +255,7 @@ } public IPath getCertificateFullPath() { - IPath fullPath; - if (getCertificate().indexOf(":") > 0) { //$NON-NLS-1$ - fullPath = new Path(getCertificate()); - } else { - fullPath = CarbideBuilderPlugin.getProjectRoot(projectTracker.getProject()); - fullPath = fullPath.append(getCertificate()); - } + IPath fullPath = createFullPath(getCertificate()); return fullPath; } @@ -266,13 +264,7 @@ } public IPath getKeyFullPath() { - IPath fullPath; - if (getKey().indexOf(":") > 0) { //$NON-NLS-1$ - fullPath = new Path(getKey()); - } else { - fullPath = CarbideBuilderPlugin.getProjectRoot(projectTracker.getProject()); - fullPath = fullPath.append(getKey()); - } + IPath fullPath = createFullPath(getKey()); return fullPath; } @@ -280,25 +272,32 @@ return outputFilename; } - public IPath getUnsignedSISFullPath() { + protected IPath getSISRelativeFullPath(String fileName, String extension) { IPath fullPath; - if (getUnsignedSISFileName().length() == 0) { + if (fileName.length() == 0) { // Use default PKG file name fullPath = getPKGFullPath(); fullPath = fullPath.removeFileExtension(); - fullPath = fullPath.addFileExtension("sis"); //$NON-NLS-1$ - } else if (getUnsignedSISFileName().indexOf(":") > 0) { //$NON-NLS-1$ - // SIS already a full path - fullPath = new Path(getUnsignedSISFileName()); + fullPath = fullPath.addFileExtension(extension); } else { - // probably a relative path, make relative to PKG file - fullPath = getPKGFullPath(); - fullPath = fullPath.removeLastSegments(1); - fullPath = fullPath.append(getUnsignedSISFileName()); + IPath fileNamePath = HostOS.createPathFromString(fileName); + if (fileNamePath.isAbsolute()) { + // SIS already a full path + fullPath = fileNamePath; + } else { + // probably a relative path, make relative to PKG file + fullPath = getPKGFullPath(); + fullPath = fullPath.removeLastSegments(1); + fullPath = fullPath.append(fileNamePath); + } } return fullPath; } + public IPath getUnsignedSISFullPath() { + return getSISRelativeFullPath(getUnsignedSISFileName(), "sis"); //$NON-NLS-1$ + } + public String getPassword() { return password; } @@ -308,22 +307,7 @@ } public IPath getSignedSISFullPath() { - IPath fullPath; - if (getSignedSISFileName().length() == 0) { - // Use default PKG file name - fullPath = getPKGFullPath(); - fullPath = fullPath.removeFileExtension(); - fullPath = fullPath.addFileExtension("sisx"); //$NON-NLS-1$ - } else if (getSignedSISFileName().indexOf(":") > 0) { //$NON-NLS-1$ - // SIS already a full path - fullPath = new Path(getSignedSISFileName()); - } else { - // probably a relative path, make relative to PKG file - fullPath = getPKGFullPath(); - fullPath = fullPath.removeLastSegments(1); - fullPath = fullPath.append(getSignedSISFileName()); - } - return fullPath; + return getSISRelativeFullPath(getSignedSISFileName(), "sisx"); //$NON-NLS-1$ } public void setCertificate(String certString) { diff -r 91399e4af0cf -r f96e62c11eac core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/DevicesLoaderTest.java --- a/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/DevicesLoaderTest.java Fri Dec 04 15:31:34 2009 -0600 +++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/DevicesLoaderTest.java Fri Dec 04 15:36:34 2009 -0600 @@ -22,6 +22,7 @@ import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.carbide.cpp.sdk.core.SymbianSDKFactory; import com.nokia.cpp.internal.api.utils.core.FileUtils; +import com.nokia.cpp.internal.api.utils.core.HostOS; import org.eclipse.emf.common.util.EList; import org.osgi.framework.Version; @@ -35,11 +36,11 @@ public class DevicesLoaderTest extends BaseDeviceModifierTest { private static final String UIQ3_SDKID = "UIQ3"; - private static final String UIQ3_EPOCROOT = "C:\\Symbian\\UIQ3SDK\\"; private static final String S60_SDKID = "S60_CustKit"; private static final String TV_SDKID = "TV_CustKit"; - private static final String M_DRIVE = "m:\\"; - private static final String P_DRIVE = "p:\\"; + private static final String UIQ3_EPOCROOT = HostOS.IS_WIN32 ? "C:\\Symbian\\UIQ3SDK\\" : "/opt/symbian/UIQ3SDK/"; + private static final String M_DRIVE = HostOS.IS_WIN32 ? "m:\\" : "/media/M/"; + private static final String P_DRIVE = HostOS.IS_WIN32 ? "p:\\" : "/media/P/"; @Override protected void setUp() throws Exception { @@ -59,19 +60,19 @@ Version osVersion = new Version("9.1"); Version sdkVersion = new Version("3.0"); ISymbianSDK sdk = SymbianSDKFactory.createInstance(S60_SDKID, M_DRIVE, ISymbianSDK.SERIES60_SDK_NAME, osVersion, "", sdkVersion, true); - DevicesLoader.updateDevice(sdk, devicesFile.toURL()); + DevicesLoader.updateDevice(sdk, devicesFile.toURI().toURL()); sdk = SymbianSDKFactory.createInstance(TV_SDKID, P_DRIVE, ISymbianSDK.TECHVIEW_SDK_NAME, osVersion, "", sdkVersion, false); - DevicesLoader.updateDevice(sdk, devicesFile.toURL()); + DevicesLoader.updateDevice(sdk, devicesFile.toURI().toURL()); sdk = SymbianSDKFactory.createInstance(UIQ3_SDKID, UIQ3_EPOCROOT, ISymbianSDK.UIQ_SDK_NAME, osVersion, "", sdkVersion, false); - DevicesLoader.updateDevice(sdk, devicesFile.toURL()); + DevicesLoader.updateDevice(sdk, devicesFile.toURI().toURL()); } public void testDevicesLoader() throws Exception { - DevicesType devicesType = DevicesLoader.loadDevices(devicesFile.toURL()); + DevicesType devicesType = DevicesLoader.loadDevices(devicesFile.toURI().toURL()); EList devices = devicesType.getDevice(); assertEquals(3, devices.size()); for (Iterator iter = devices.iterator(); iter.hasNext();) { @@ -96,19 +97,19 @@ public void testDeleteDevice() throws Exception{ - DevicesType devicesType = DevicesLoader.loadDevices(devicesFile.toURL()); + DevicesType devicesType = DevicesLoader.loadDevices(devicesFile.toURI().toURL()); EList devices = devicesType.getDevice(); assertEquals(3, devices.size()); for (Iterator iter = devices.iterator(); iter.hasNext();) { DeviceType device = (DeviceType) iter.next(); if (device.getId().equals(UIQ3_SDKID)){ - DevicesLoader.deleteDeviceEntry(device, devicesFile.toURL()); + DevicesLoader.deleteDeviceEntry(device, devicesFile.toURI().toURL()); break; } } // read the file back in... - devicesType = DevicesLoader.loadDevices(devicesFile.toURL()); + devicesType = DevicesLoader.loadDevices(devicesFile.toURI().toURL()); devices = devicesType.getDevice(); assertEquals(2, devices.size()); } diff -r 91399e4af0cf -r f96e62c11eac core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SDKCreationTest.java --- a/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SDKCreationTest.java Fri Dec 04 15:31:34 2009 -0600 +++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SDKCreationTest.java Fri Dec 04 15:36:34 2009 -0600 @@ -43,7 +43,7 @@ FileUtils.writeFileContents(devicesFile, devicesSkeleton.toCharArray(), null); assertTrue(devicesFile.exists()); - DevicesType devicesType = DevicesLoader.loadDevices(devicesFile.toURL()); + DevicesType devicesType = DevicesLoader.loadDevices(devicesFile.toURI().toURL()); EList devices = devicesType.getDevice(); for (Iterator iter = devices.iterator(); iter.hasNext();) { SymbianSDK sdk = new SymbianSDK((DeviceType) iter.next()); diff -r 91399e4af0cf -r f96e62c11eac core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SymbianContextTest.java --- a/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SymbianContextTest.java Fri Dec 04 15:31:34 2009 -0600 +++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SymbianContextTest.java Fri Dec 04 15:36:34 2009 -0600 @@ -39,7 +39,6 @@ @Override protected void tearDown() throws Exception { - // TODO Auto-generated method stub super.tearDown(); } @@ -49,26 +48,28 @@ assertNotNull(sdkList); assertTrue(sdkList.size() > 0); - ISymbianSDK sdk = SDKCorePlugin.getSDKManager().getSDK("S60_5th_Edition_SDK_v1.0", true); - assertNotNull("SDK should exist for test", sdk); - SymbianBuildContext context = new SymbianBuildContext(sdk, "WINSCW", "UDEB"); - ISymbianSDK contextSDK = context.getSDK(); - - assertTrue(contextSDK.equals(sdk)); - - // test that get get the macros - List platMacros = contextSDK.getPlatformMacros("WINSCW"); - assertTrue("WINSCW platform macros should be > 0", platMacros.size() > 0); - - // test that we get the SDK version - Version sdkVer = contextSDK.getSDKVersion(); - assertEquals(5,sdkVer.getMajor()); - assertEquals(0,sdkVer.getMinor()); - - // test that we get the OS version - Version osVer = contextSDK.getOSVersion(); - assertEquals(9,osVer.getMajor()); - assertEquals(4,osVer.getMinor()); + for (ISymbianSDK sdk : sdkList) { + if (sdk.getName().equals("S60_5th_Edition_SDK_v1.0")) { + // test that we get the SDK version + Version sdkVer = sdk.getSDKVersion(); + assertEquals(5,sdkVer.getMajor()); + assertEquals(0,sdkVer.getMinor()); + + // test that we get the OS version + Version osVer = sdk.getOSVersion(); + assertEquals(9,osVer.getMajor()); + assertEquals(4,osVer.getMinor()); + } + + SymbianBuildContext context = new SymbianBuildContext(sdk, "WINSCW", "UDEB"); + ISymbianSDK contextSDK = context.getSDK(); + + assertEquals(sdk, contextSDK); + + // test that get get the macros + List platMacros = contextSDK.getPlatformMacros("WINSCW"); + assertTrue("WINSCW platform macros should be > 0", platMacros.size() > 0); + } } diff -r 91399e4af0cf -r f96e62c11eac core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/TestDevicesXMLListener.java --- a/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/TestDevicesXMLListener.java Fri Dec 04 15:31:34 2009 -0600 +++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/TestDevicesXMLListener.java Fri Dec 04 15:36:34 2009 -0600 @@ -27,6 +27,7 @@ import com.nokia.carbide.cpp.internal.api.sdk.ICarbideDevicesXMLChangeListener; import com.nokia.carbide.cpp.internal.api.sdk.ISDKManagerInternal; +import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; import com.nokia.carbide.cpp.sdk.core.*; /** @@ -66,6 +67,9 @@ // Here we just rescan the sdks and the listener will perform the test public void testCarbideConfigurationChangedListener() throws Exception{ + if (!SBSv2Utils.enableSBSv1Support()) + return; + ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); // get devics.xml and make a backup copy diff -r 91399e4af0cf -r f96e62c11eac core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/FileUtils.java --- a/core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/FileUtils.java Fri Dec 04 15:31:34 2009 -0600 +++ b/core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/FileUtils.java Fri Dec 04 15:36:34 2009 -0600 @@ -900,4 +900,67 @@ } return res; } + + /** + * Locate the file on the filesystem which has the same path, but with + * only case sensitivity differences. This is only meaningful for fully + * case sensitive and case-preserving filesystems. + * @param path + * @return path pointing to existing file (possibly with different case in components) or + * original path if there is no match + */ + public static IPath findMatchingPathCaseInsensitive(IPath path) { + // case is insensitive already + if (HostOS.IS_WIN32) + return path; + + if (path == null || !path.isAbsolute() || path.toFile().exists()) + return path; + + StringBuilder builder = new StringBuilder(); + + if (path.getDevice() != null) { + builder.append(path.getDevice()); + } + + builder.append('/'); + + boolean failedLookup = false; + + for (int seg = 0; seg < path.segmentCount(); seg++) { + final String segment = path.segment(seg); + + final String[] matches = { segment }; + + if (!failedLookup) { + File dir = new File(builder.toString()); + if (!new File(dir, matches[0]).exists()) { + // component has wrong case; find the first one matching case-insensitively + String[] names = dir.list(new FilenameFilter() { + + public boolean accept(File dir, String name) { + if (name.equalsIgnoreCase(segment)) { + matches[0] = name; + return true; + } + return false; + } + }); + + if (names.length == 0) { + // no matches! the rest of the path won't match either + failedLookup = true; + } + } + } + builder.append(matches[0]); + builder.append('/'); + } + + if (!path.hasTrailingSeparator() && builder.length() > 0 && builder.charAt(builder.length() - 1) == '/') { + builder.setLength(builder.length() - 1); + } + return new Path(builder.toString()); + } + } diff -r 91399e4af0cf -r f96e62c11eac project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestBSFView.java --- a/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestBSFView.java Fri Dec 04 15:31:34 2009 -0600 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestBSFView.java Fri Dec 04 15:36:34 2009 -0600 @@ -52,7 +52,7 @@ } public Collection getMacros() { - return Collections.EMPTY_LIST ; + return Collections.emptyList() ; } public IViewParserConfiguration getViewParserConfiguration() { diff -r 91399e4af0cf -r f96e62c11eac project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestModelProvider.java --- a/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestModelProvider.java Fri Dec 04 15:31:34 2009 -0600 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestModelProvider.java Fri Dec 04 15:36:34 2009 -0600 @@ -73,6 +73,7 @@ /* (non-Javadoc) * @see com.nokia.carbide.cpp.epoc.engine.tests.BaseTest#setUp() */ + @SuppressWarnings("unchecked") @Override protected void setUp() throws Exception { super.setUp(); diff -r 91399e4af0cf -r f96e62c11eac project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestModelsAndViews.java --- a/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestModelsAndViews.java Fri Dec 04 15:31:34 2009 -0600 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestModelsAndViews.java Fri Dec 04 15:36:34 2009 -0600 @@ -28,7 +28,6 @@ import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine; import com.nokia.carbide.cpp.epoc.engine.preprocessor.IViewFilter; import com.nokia.carbide.cpp.epoc.engine.tests.model.dummy.DummyModel; -import com.nokia.carbide.cpp.epoc.engine.tests.model.dummy.IDummyModel; import com.nokia.carbide.cpp.epoc.engine.tests.model.dummy.IDummyView; import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.IASTTranslationUnit; import com.nokia.carbide.internal.cpp.epoc.engine.model.ViewASTBase; @@ -67,7 +66,7 @@ } public Collection getMacros() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } public IViewParserConfiguration getViewParserConfiguration() { @@ -148,7 +147,7 @@ assertEquals(model, view.getModel()); // ensure model knows - IView[] views = model.getViews(); + IView[] views = model.getViews(); assertEquals(1, views.length); assertEquals(view, views[0]); diff -r 91399e4af0cf -r f96e62c11eac project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestPKGView.java --- a/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestPKGView.java Fri Dec 04 15:31:34 2009 -0600 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestPKGView.java Fri Dec 04 15:36:34 2009 -0600 @@ -23,6 +23,7 @@ import com.nokia.carbide.cpp.epoc.engine.preprocessor.*; import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.*; import com.nokia.carbide.internal.cpp.epoc.engine.model.pkg.PKGView; +import com.nokia.cpp.internal.api.utils.core.HostOS; import com.nokia.cpp.internal.api.utils.core.Logging; import org.eclipse.core.runtime.*; @@ -67,7 +68,7 @@ "{\"c:\\users\\E0192828\\back.txt\", \"c:\\users\\E0FG\\front.txt\"}-\"sp ac es.txt\"\r\n" + "\"c:\\users\\E0192828\\back.txt\" - \"sp ac es.txt\""; - private static final Map lang2SrcFileMap = new HashMap(); + private static final Map lang2SrcFileMap = new HashMap(); static { for (String[] lang2SrcFileSpec : LANG_TO_SRC_FILES) { lang2SrcFileMap.put(lang2SrcFileSpec[0], lang2SrcFileSpec[1]); @@ -85,7 +86,7 @@ @Override protected void setUp() throws Exception { super.setUp(); - this.path = new Path("c:\\symbian\\9.4\\epoc32\\tools\\Test.PKG"); + this.path = new Path(getTokenAbsolutePath()).append("/symbian/9.4/epoc32/tools/Test.PKG"); config = new IViewConfiguration() { @@ -94,7 +95,7 @@ } public Collection getMacros() { - return Collections.EMPTY_LIST ; + return Collections.emptyList() ; } public IViewParserConfiguration getViewParserConfiguration() { @@ -139,24 +140,24 @@ // first install file is language dependent IPKGInstallFile installFile = installFileList.get(0); - assertEquals(new Path(LANG_DEST_FILE), installFile.getDestintationFile()); + assertEquals(HostOS.createPathFromString(LANG_DEST_FILE), installFile.getDestintationFile()); List langs = view.getLanguages(); assertEquals(2, langs.size()); Map sourceFiles = installFile.getSourceFiles(); for (EPKGLanguage lang : langs) { IPath srcFilePath = sourceFiles.get(lang); String srcFile = lang2SrcFileMap.get(lang.getCode()); - assertEquals(new Path(srcFile), srcFilePath); + assertEquals(HostOS.createPathFromString(srcFile), srcFilePath); } // second install file is language independent installFile = installFileList.get(1); - assertEquals(new Path(NO_LANG_DEST_FILE), installFile.getDestintationFile()); + assertEquals(HostOS.createPathFromString(NO_LANG_DEST_FILE), installFile.getDestintationFile()); sourceFiles = installFile.getSourceFiles(); assertEquals(1, sourceFiles.size()); assertTrue(sourceFiles.containsKey(EPKGLanguage.INDEPENDENT)); IPath srcFilePath = sourceFiles.get(EPKGLanguage.INDEPENDENT); - assertEquals(new Path(NO_LANG_SRC_FILE), srcFilePath); + assertEquals(HostOS.createPathFromString(NO_LANG_SRC_FILE), srcFilePath); assertEquals(1, installFile.getOptions().size()); assertEquals(NO_LANG_OPTION, installFile.getOptions().get(0)); @@ -186,7 +187,7 @@ IPath destintationFile = conditionalInstallFile.getDestintationFile(); assertTrue(destintationFile.isEmpty()); assertEquals(1, conditionalInstallFile.getSourceFiles().size()); - assertEquals(new Path(CONDITIONAL_SRC_FILE), conditionalInstallFile.getSourceFiles().get(EPKGLanguage.INDEPENDENT)); + assertEquals(HostOS.createPathFromString(CONDITIONAL_SRC_FILE), conditionalInstallFile.getSourceFiles().get(EPKGLanguage.INDEPENDENT)); assertEquals(2, conditionalInstallFile.getOptions().size()); commitTest(view, modelText); @@ -199,9 +200,9 @@ // fully create and add a language independent install file statement IPKGInstallFile installFile1 = view.createInstallFile(null); - installFile1.getSourceFiles().put(EPKGLanguage.INDEPENDENT, new Path(NO_LANG_SRC_FILE)); + installFile1.getSourceFiles().put(EPKGLanguage.INDEPENDENT, HostOS.createPathFromString(NO_LANG_SRC_FILE)); installFile1.getOptions().add(NO_LANG_OPTION); - installFile1.setDestinationFile(new Path(NO_LANG_DEST_FILE)); + installFile1.setDestinationFile(HostOS.createPathFromString(NO_LANG_DEST_FILE)); view.addInstallFile(installFile1); // create a language dependent install file and modify after add @@ -209,9 +210,9 @@ view.addInstallFile(installFile2); for (String[] lang2SrcFileArray : LANG_TO_SRC_FILES) { installFile2.getSourceFiles().put( - EPKGLanguage.forLangCode(lang2SrcFileArray[0]), new Path(lang2SrcFileArray[1])); + EPKGLanguage.forLangCode(lang2SrcFileArray[0]), HostOS.createPathFromString(lang2SrcFileArray[1])); } - installFile2.setDestinationFile(new Path(LANG_DEST_FILE)); + installFile2.setDestinationFile(HostOS.createPathFromString(LANG_DEST_FILE)); // NOTE: the newlines are lost and shouldn't be //String modifiedModelText = modelText + NO_LANG_INSTALL_FILE_STATEMENT + "\n" + LANG_INSTALL_FILE_STATEMENT; @@ -244,13 +245,13 @@ IPKGInstallFile file = installFiles[0]; assertEquals(2, file.getSourceFiles().size()); - assertEquals(new Path("c:\\users\\E0192828\\back.txt"), file.getSourceFiles().get(EPKGLanguage.EN)); - assertEquals(new Path("c:\\users\\E0FG\\front.txt"), file.getSourceFiles().get(EPKGLanguage.FR)); + assertEquals(new Path("c:/users/E0192828/back.txt"), file.getSourceFiles().get(EPKGLanguage.EN)); + assertEquals(new Path("c:/users/E0FG/front.txt"), file.getSourceFiles().get(EPKGLanguage.FR)); assertEquals(new Path("sp ac es.txt"), file.getDestintationFile()); file = installFiles[1]; assertEquals(1, file.getSourceFiles().size()); - assertEquals(new Path("c:\\users\\E0192828\\back.txt"), file.getSourceFiles().get(EPKGLanguage.INDEPENDENT)); + assertEquals(new Path("c:/users/E0192828/back.txt"), file.getSourceFiles().get(EPKGLanguage.INDEPENDENT)); assertEquals(new Path("sp ac es.txt"), file.getDestintationFile()); commitTest(view, ESCAPABLE_FILES); diff -r 91399e4af0cf -r f96e62c11eac project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestStandaloneModelProvider.java --- a/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestStandaloneModelProvider.java Fri Dec 04 15:31:34 2009 -0600 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestStandaloneModelProvider.java Fri Dec 04 15:36:34 2009 -0600 @@ -70,6 +70,7 @@ /* (non-Javadoc) * @see com.nokia.carbide.cpp.epoc.engine.tests.BaseTest#setUp() */ + @SuppressWarnings("unchecked") @Override protected void setUp() throws Exception { super.setUp(); diff -r 91399e4af0cf -r f96e62c11eac project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestViewChanging.java --- a/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestViewChanging.java Fri Dec 04 15:31:34 2009 -0600 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestViewChanging.java Fri Dec 04 15:36:34 2009 -0600 @@ -62,7 +62,7 @@ } public Collection getMacros() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } public IViewParserConfiguration getViewParserConfiguration() { diff -r 91399e4af0cf -r f96e62c11eac project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestViewDOMSynchronizer.java --- a/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestViewDOMSynchronizer.java Fri Dec 04 15:31:34 2009 -0600 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestViewDOMSynchronizer.java Fri Dec 04 15:36:34 2009 -0600 @@ -192,7 +192,7 @@ } public Pair getInsertAnchors() { - return new Pair(null, null); + return new Pair(null, null); } }; } @@ -212,7 +212,7 @@ } public Pair getInsertAnchors() { - return new Pair(before, after); + return new Pair(before, after); } }; } diff -r 91399e4af0cf -r f96e62c11eac project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/workspace/TestWorkspaceModelProvider.java --- a/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/workspace/TestWorkspaceModelProvider.java Fri Dec 04 15:31:34 2009 -0600 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/workspace/TestWorkspaceModelProvider.java Fri Dec 04 15:36:34 2009 -0600 @@ -471,7 +471,7 @@ */ public void testExternalModification_bug3557() throws Exception { // make the mmp - IPath fullMmpPath = new Path("c:/tempmodel.mmp"); + IPath fullMmpPath = new Path(getTokenAbsolutePath()).append("tempmodel.mmp"); String text = "START BITMAP foo.mbm\n"+ diff -r 91399e4af0cf -r f96e62c11eac project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/preprocessor/DefaultTranslationUnitProvider.java --- a/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/preprocessor/DefaultTranslationUnitProvider.java Fri Dec 04 15:31:34 2009 -0600 +++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/preprocessor/DefaultTranslationUnitProvider.java Fri Dec 04 15:36:34 2009 -0600 @@ -36,7 +36,7 @@ import com.nokia.cpp.internal.api.utils.core.*; public class DefaultTranslationUnitProvider implements ITranslationUnitProvider { - private static DefaultTranslationUnitProvider instance; + private static DefaultTranslationUnitProvider instance = new DefaultTranslationUnitProvider(); // not final or static for debugging private boolean DUMP = false; @@ -62,9 +62,6 @@ * @return instance, never null */ public static DefaultTranslationUnitProvider getInstance() { - if (instance == null) { - instance = new DefaultTranslationUnitProvider(); - } return instance; } diff -r 91399e4af0cf -r f96e62c11eac project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/pkg/PKGView.java --- a/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/pkg/PKGView.java Fri Dec 04 15:31:34 2009 -0600 +++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/pkg/PKGView.java Fri Dec 04 15:36:34 2009 -0600 @@ -366,7 +366,7 @@ IASTPKGInstallFileStatement installFileStmt = (IASTPKGInstallFileStatement) node; PKGInstallFile installFile = new PKGInstallFile(installFileStmt, parentNode); IASTLiteralTextNode targetFile = installFileStmt.getTargetFile(); - installFile.setDestinationFile(new Path(TextUtils.unquote(targetFile + installFile.setDestinationFile(HostOS.createPathFromString(TextUtils.unquote(targetFile .getStringValue(), '"'))); IASTListNode optionNodes = installFileStmt .getOptions(); @@ -388,7 +388,7 @@ } else { for (IASTLiteralTextNode sourceNode : sourceNodes) { sourceFiles.put(languages.get(languageIndex++), - new Path(TextUtils.unquote(sourceNode + HostOS.createPathFromString(TextUtils.unquote(sourceNode .getStringValue(), '"'))); } } @@ -397,7 +397,7 @@ // always return // single source // node - sourceFiles.put(EPKGLanguage.INDEPENDENT, new Path(TextUtils + sourceFiles.put(EPKGLanguage.INDEPENDENT, HostOS.createPathFromString(TextUtils .unquote(sourceNodes.get(0).getStringValue(), '"'))); } if (parentNode == null) @@ -460,13 +460,13 @@ for (IASTLiteralTextNode sourceNode : sourceNodes) { // remove the leading '@' sourceFiles.put(languages.get(languageIndex++), - new Path(TextUtils.unquote(sourceNode.getStringValue().substring(1), '"'))); + HostOS.createPathFromString(TextUtils.unquote(sourceNode.getStringValue().substring(1), '"'))); } } } else { // language independent Check.checkContract(sourceNodes.size() == 1); // parser should // always return single source node. remove the leading '@'. - sourceFiles.put(EPKGLanguage.INDEPENDENT, new Path(TextUtils + sourceFiles.put(EPKGLanguage.INDEPENDENT, HostOS.createPathFromString(TextUtils .unquote(sourceNodes.get(0).getStringValue().substring(1), '"'))); }