Carbide.c++

com.nokia.carbide.cdt.builder
Class PKGViewPathHelper

java.lang.Object
  extended by com.nokia.carbide.cdt.builder.PKGViewPathHelper

public class PKGViewPathHelper
extends java.lang.Object

Helper to resolve paths used in pkg files.

When building a pkg file, you can pass a search directory to makesis (-d) and it will look for any files without paths in that search directory. Carbide also lets you specify macros in the PKG file that need to be expanded, e.g. $(EPOCROOT)

Since:
1.3

Constructor Summary
PKGViewPathHelper(IPath pkgFilePath, IPath epocRoot, java.lang.String platform, java.lang.String target)
          Constructor for test purposes or for out-of-project experiences.
PKGViewPathHelper(com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.IPKGView view, ICarbideBuildConfiguration buildConfig)
          Construct an instance using the given PKG view, to provide the content search location.
 
Method Summary
 IPath getAbsolutePathFromViewPath(IPath path)
          Given a source install-file path from an IPKGInstallFile, convert it to an absolute file system path.
 IPath getMainDirectory()
          Returns the main directory used as the basis for relative path lookups
 IPath getViewPathFromAbsolutePath(IPath path)
          Converts an absolute path to a pkg view path.
 void setMainDirectory(IPath mainDirectory)
          Sets the main directory to use as the basis for relative path lookups
 void setSISBuilderInfo(ISISBuilderInfo sisInfo)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PKGViewPathHelper

public PKGViewPathHelper(com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.IPKGView view,
                         ICarbideBuildConfiguration buildConfig)
Construct an instance using the given PKG view, to provide the content search location.

Parameters:
view - the non-null PKG view (does not take ownership)
buildConfig - the build configuration context. this will be used for expanding PKG macros and obtaining the content search location, unless set from

PKGViewPathHelper

public PKGViewPathHelper(IPath pkgFilePath,
                         IPath epocRoot,
                         java.lang.String platform,
                         java.lang.String target)
Constructor for test purposes or for out-of-project experiences.

Method Detail

setSISBuilderInfo

public void setSISBuilderInfo(ISISBuilderInfo sisInfo)

getMainDirectory

public IPath getMainDirectory()
Returns the main directory used as the basis for relative path lookups

Since:
2.0

setMainDirectory

public void setMainDirectory(IPath mainDirectory)
Sets the main directory to use as the basis for relative path lookups

Since:
2.0

getAbsolutePathFromViewPath

public IPath getAbsolutePathFromViewPath(IPath path)
Given a source install-file path from an IPKGInstallFile, convert it to an absolute file system path. Any Carbide macros in the path will be expanded (see , , .

Non-absolute paths will first try to be resolved relative to the pkg file directory. If the file does not exist, we will try to resolve it relative to the search location (when available). If still not found, the path will be returned relative to the pkg file location. The content search location will be obtained from the ISISBuilderInfo. The ISISBuilderInfo set from setSISBuilderInfo(ISISBuilderInfo) will be used when set, otherwise the first ISISBuilderInfo in the build configuration that matches the pkg file will be used.

Note that the makesis source code was examined to determine the search order, and it it looks relative to the pkg file directory before checking the search directory. It will of course bail though if either does not exist. Since this helper is not designed to check for the existence of the file, but rather to return the path where the file should be, there may be cases where we return the wrong file path.

Parameters:
path - relative or absolute path from a IPKGInstallFile
Returns:
absolute path for an existing or candidate file

getViewPathFromAbsolutePath

public IPath getViewPathFromAbsolutePath(IPath path)
Converts an absolute path to a pkg view path. If the content search location is a prefix of the absolute path, a path relative to the search location will be returned. Otherwise the absolute path will be returned.

Parameters:
path - absolute path
Returns:
view path

Carbide.c++