--- a/qmake/generators/symbian/initprojectdeploy_symbian.cpp Tue Feb 02 00:43:10 2010 +0200
+++ b/qmake/generators/symbian/initprojectdeploy_symbian.cpp Fri Apr 16 15:50:13 2010 +0300
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -47,107 +47,14 @@
#include <qdebug.h>
#define PLUGIN_STUB_DIR "qmakepluginstubs"
-#define SYSBIN_DIR "\\sys\\bin"
+#define SYSBIN_DIR "/sys/bin"
+// Included from tools/shared
+#include <symbian/epocroot.h>
#define SUFFIX_DLL "dll"
#define SUFFIX_EXE "exe"
#define SUFFIX_QTPLUGIN "qtplugin"
-static void fixEpocRootStr(QString& path)
-{
- path.replace("\\", "/");
-
- /* :QTP:QTPROD-154: Raptor needs the drive letter
- if (path.size() > 1 && path[1] == QChar(':')) {
- path = path.mid(2);
- }
- */
-
- if (!path.size() || path[path.size()-1] != QChar('/')) {
- path += QChar('/');
- }
-}
-
-#define SYMBIAN_SDKS_KEY "HKEY_LOCAL_MACHINE\\Software\\Symbian\\EPOC SDKs"
-
-static QString epocRootStr;
-
-QString epocRoot()
-{
- if (!epocRootStr.isEmpty()) {
- return epocRootStr;
- }
-
- // First, check the env variable
- epocRootStr = qgetenv("EPOCROOT");
-
- if (epocRootStr.isEmpty()) {
- // No EPOCROOT set, check the default device
- // First check EPOCDEVICE env variable
- QString defaultDevice = qgetenv("EPOCDEVICE");
-
- // Check the windows registry via QSettings for devices.xml path
- QSettings settings(SYMBIAN_SDKS_KEY, QSettings::NativeFormat);
- QString devicesXmlPath = settings.value("CommonPath").toString();
-
- if (!devicesXmlPath.isEmpty()) {
- // Parse xml for correct device
- devicesXmlPath += "/devices.xml";
- QFile devicesFile(devicesXmlPath);
- if (devicesFile.open(QIODevice::ReadOnly)) {
- QXmlStreamReader xml(&devicesFile);
- while (!xml.atEnd()) {
- xml.readNext();
- if (xml.isStartElement() && xml.name() == "devices") {
- if (xml.attributes().value("version") == "1.0") {
- // Look for correct device
- while (!(xml.isEndElement() && xml.name() == "devices") && !xml.atEnd()) {
- xml.readNext();
- if (xml.isStartElement() && xml.name() == "device") {
- if ((defaultDevice.isEmpty() && xml.attributes().value("default") == "yes") ||
- (!defaultDevice.isEmpty() && (xml.attributes().value("id").toString() + QString(":") + xml.attributes().value("name").toString()) == defaultDevice)) {
- // Found the correct device
- while (!(xml.isEndElement() && xml.name() == "device") && !xml.atEnd()) {
- xml.readNext();
- if (xml.isStartElement() && xml.name() == "epocroot") {
- epocRootStr = xml.readElementText();
- fixEpocRootStr(epocRootStr);
- return epocRootStr;
- }
- }
- xml.raiseError("No epocroot element found");
- }
- }
- }
- } else {
- xml.raiseError("Invalid 'devices' element version");
- }
- }
- }
- if (xml.hasError()) {
- fprintf(stderr, "ERROR: \"%s\" when parsing devices.xml\n", qPrintable(xml.errorString()));
- }
- } else {
- fprintf(stderr, "Could not open devices.xml (%s)\n", qPrintable(devicesXmlPath));
- }
- } else {
- fprintf(stderr, "Could not retrieve " SYMBIAN_SDKS_KEY " setting\n");
- }
-
- fprintf(stderr, "Failed to determine epoc root.\n");
- if (!defaultDevice.isEmpty())
- fprintf(stderr, "The device indicated by EPOCDEVICE environment variable (%s) could not be found.\n", qPrintable(defaultDevice));
- fprintf(stderr, "Either set EPOCROOT or EPOCDEVICE environment variable to a valid value, or provide a default Symbian device.\n");
-
- // No valid device found; set epocroot to "/"
- epocRootStr = QLatin1String("/");
- }
-
- fixEpocRootStr(epocRootStr);
- return epocRootStr;
-}
-
-
static bool isPlugin(const QFileInfo& info, const QString& devicePath)
{
// Libraries are plugins if deployment path is something else than
@@ -178,12 +85,12 @@
QStringList& generatedDirs,
QStringList& generatedFiles)
{
- QDir().mkpath(QLatin1String(PLUGIN_STUB_DIR "\\"));
+ QDir().mkpath(QLatin1String(PLUGIN_STUB_DIR "/"));
if (!generatedDirs.contains(PLUGIN_STUB_DIR))
generatedDirs << PLUGIN_STUB_DIR;
// Plugin stubs must have different name from the actual plugins, because
// the toolchain for creating ROM images cannot handle non-binary .dll files properly.
- QFile stubFile(QLatin1String(PLUGIN_STUB_DIR "\\") + info.completeBaseName() + "." SUFFIX_QTPLUGIN);
+ QFile stubFile(QLatin1String(PLUGIN_STUB_DIR "/") + info.completeBaseName() + "." SUFFIX_QTPLUGIN);
if (stubFile.open(QIODevice::WriteOnly)) {
if (!generatedFiles.contains(stubFile.fileName()))
generatedFiles << stubFile.fileName();
@@ -197,7 +104,7 @@
}
QFileInfo stubInfo(stubFile);
deploymentList.append(CopyItem(Option::fixPathToLocalOS(stubInfo.absoluteFilePath()),
- Option::fixPathToLocalOS(devicePath + "\\" + stubInfo.fileName())));
+ Option::fixPathToLocalOS(devicePath + "/" + stubInfo.fileName())));
}
QString generate_uid(const QString& target)
@@ -210,7 +117,7 @@
return tmp;
}
- unsigned long hash = 5381;
+ quint32 hash = 5381;
int c;
for (int i = 0; i < target.size(); ++i) {
@@ -261,20 +168,29 @@
foreach(QString item, project->values("DEPLOYMENT")) {
QString devicePath = project->first(item + ".path");
+ QString devicePathwDrive = devicePath;
+
+ bool devicePathHasDriveLetter = false;
+ if (devicePath.size() > 1) {
+ devicePathHasDriveLetter = devicePath.at(1) == QLatin1Char(':');
+ }
+
+ //QTP: Sometime devicePath can contain disk but APP_RESOURCE_DIR not
+ //convert devicepath to correct format and delete drive letter
+ if (devicePathHasDriveLetter)
+ {
+ devicePathwDrive.remove(0,2);
+ }
if (!deployBinaries
- && !devicePath.isEmpty()
- && (0 == devicePath.compare(project->values("APP_RESOURCE_DIR").join(""), Qt::CaseInsensitive)
- || 0 == devicePath.compare(project->values("REG_RESOURCE_IMPORT_DIR").join(""), Qt::CaseInsensitive))) {
+ && !devicePathwDrive.isEmpty()
+ && (0 == devicePathwDrive.compare(project->values("APP_RESOURCE_DIR").join(""), Qt::CaseInsensitive)
+ || 0 == devicePathwDrive.compare(project->values("REG_RESOURCE_IMPORT_DIR").join(""), Qt::CaseInsensitive))) {
// Do not deploy resources in emulator builds, as that seems to cause conflicts
// If there is ever a real need to deploy pre-built resources for emulator,
// BLD_INF_RULES.prj_exports can be used as a workaround.
continue;
}
- bool devicePathHasDriveLetter = false;
- if (devicePath.size() > 1) {
- devicePathHasDriveLetter = devicePath.at(1) == QLatin1Char(':');
- }
if (devicePath.isEmpty() || devicePath == QLatin1String(".")) {
devicePath = targetPath;
@@ -284,13 +200,13 @@
|| devicePath.at(0) == QLatin1Char('\\')
|| devicePathHasDriveLetter)) {
// create output path
- devicePath = Option::fixPathToLocalOS(QDir::cleanPath(targetPath + QLatin1Char('\\') + devicePath));
+ devicePath = Option::fixPathToLocalOS(QDir::cleanPath(targetPath + QLatin1Char('/') + devicePath));
} else {
if (0 == platform.compare(QLatin1String("winscw"), Qt::CaseInsensitive)) {
if (devicePathHasDriveLetter) {
- devicePath = epocRoot() + "epoc32\\winscw\\" + devicePath.remove(1, 1);
+ devicePath = epocRoot() + "epoc32/winscw/" + devicePath.remove(1, 1);
} else {
- devicePath = epocRoot() + "epoc32\\winscw\\c" + devicePath;
+ devicePath = epocRoot() + "epoc32/winscw/c" + devicePath;
}
} else {
//The logic of the calling the initProjectDeploySymbian function depends only
@@ -299,30 +215,30 @@
if (!devicePathHasDriveLetter) {
if (targetPathHasDriveLetter) {
// Drive letter needed if targetpath contains one and it is not already in
- if (devicePath.indexOf("plugins", Qt::CaseInsensitive) != -1 && !platform.compare("armv5") ) {
+ if ( 0 == platform.compare(QLatin1String("armv5"), Qt::CaseInsensitive) ) {
//For plugin deployment under ARM no needed drive letter
- devicePath = epocRoot() + "epoc32\\data\\z" + devicePath;
- } else {
+ devicePath = epocRoot() + "epoc32/data/z" + devicePath;
+ } else {
devicePath = deploymentDrive + devicePath;
}
} else {
// Only deployment for ARM need full path for the deployment
- if (devicePath.indexOf("plugins", Qt::CaseInsensitive) != -1 && !platform.compare("armv5") ) {
- devicePath = epocRoot() + "epoc32\\data\\z" + devicePath;
- }
+ if (0 == platform.compare(QLatin1String("armv5"), Qt::CaseInsensitive) ) {
+ devicePath = epocRoot() + "epoc32/data/z" + devicePath;
+ }
}
} else {
//it is necessary to delete drive letter for ARM deployment
if (!platform.compare("armv5")) {
devicePath.remove(0,2);
- devicePath = epocRoot() + "epoc32\\data\\z" + devicePath;
+ devicePath = epocRoot() + "epoc32/data/z" + devicePath;
}
}
}
}
- devicePath.replace(QLatin1String("/"), QLatin1String("\\"));
+ devicePath.replace(QLatin1String("\\"), QLatin1String("/"));
if (!deployBinaries &&
0 == devicePath.right(8).compare(QLatin1String(SYSBIN_DIR), Qt::CaseInsensitive)) {
@@ -346,7 +262,13 @@
dirSearch = true;
} else {
if (info.exists() || source.indexOf('*') != -1) {
+//QTP-Prod: Temporary solution due Option::fixPathToLocalOS. This function always replaces / to \ for Windows
+//in the source. Changes fixPathToLocalOS requires more investigation and testing.
+#if defined(Q_OS_WIN32)
nameFilter = source.split('\\').last();
+#else
+ nameFilter = source.split('/').last();
+#endif
searchPath = info.absolutePath();
} else {
// Entry was not found. That is ok if it is a binary, since those do not necessarily yet exist.
@@ -354,13 +276,13 @@
if (isBinary(info)) {
if (deployBinaries) {
// Executables and libraries are deployed to \sys\bin
- QFileInfo releasePath(epocRoot() + "epoc32\\release\\" + platform + "\\" + build + "\\");
+ QFileInfo releasePath(epocRoot() + "epoc32/release/" + platform + "/" + build + "/");
if(devicePathHasDriveLetter) {
- deploymentList.append(CopyItem(Option::fixPathToLocalOS(releasePath.absolutePath() + "\\" + info.fileName(), false, true),
- Option::fixPathToLocalOS(devicePath.left(2) + QLatin1String(SYSBIN_DIR "\\") + info.fileName())));
+ deploymentList.append(CopyItem(Option::fixPathToLocalOS(releasePath.absolutePath() + "/" + info.fileName(), false, true),
+ Option::fixPathToLocalOS(devicePath.left(2) + QLatin1String(SYSBIN_DIR "/") + info.fileName())));
} else {
- deploymentList.append(CopyItem(Option::fixPathToLocalOS(releasePath.absolutePath() + "\\" + info.fileName(), false, true),
- Option::fixPathToLocalOS(deploymentDrive + QLatin1String(SYSBIN_DIR "\\") + info.fileName())));
+ deploymentList.append(CopyItem(Option::fixPathToLocalOS(releasePath.absolutePath() + "/" + info.fileName(), false, true),
+ Option::fixPathToLocalOS(deploymentDrive + QLatin1String(SYSBIN_DIR "/") + info.fileName())));
}
}
if (isPlugin(info, devicePath)) {
@@ -371,7 +293,7 @@
// Generate deployment even if file doesn't exist, as this may be the case
// when generating .pkg files.
deploymentList.append(CopyItem(Option::fixPathToLocalOS(info.absoluteFilePath()),
- Option::fixPathToLocalOS(devicePath + "\\" + info.fileName())));
+ Option::fixPathToLocalOS(devicePath + "/" + info.fileName())));
continue;
}
}
@@ -393,14 +315,14 @@
// This deploys pre-built plugins. Other pre-built binaries will deploy normally,
// as they have SYSBIN_DIR target path.
if (deployBinaries) {
- deploymentList.append(CopyItem(Option::fixPathToLocalOS(absoluteItemPath + "\\" + iterator.fileName()),
- Option::fixPathToLocalOS(deploymentDrive + QLatin1String(SYSBIN_DIR "\\") + iterator.fileName())));
+ deploymentList.append(CopyItem(Option::fixPathToLocalOS(absoluteItemPath + "/" + iterator.fileName()),
+ Option::fixPathToLocalOS(deploymentDrive + QLatin1String(SYSBIN_DIR "/") + iterator.fileName())));
}
- createPluginStub(info, devicePath + "\\" + absoluteItemPath.right(diffSize), deploymentList, generatedDirs, generatedFiles);
+ createPluginStub(info, devicePath + "/" + absoluteItemPath.right(diffSize), deploymentList, generatedDirs, generatedFiles);
continue;
} else {
- deploymentList.append(CopyItem(Option::fixPathToLocalOS(absoluteItemPath + "\\" + iterator.fileName()),
- Option::fixPathToLocalOS(devicePath + "\\" + absoluteItemPath.right(diffSize) + "\\" + iterator.fileName())));
+ deploymentList.append(CopyItem(Option::fixPathToLocalOS(absoluteItemPath + "/" + iterator.fileName()),
+ Option::fixPathToLocalOS(devicePath + "/" + absoluteItemPath.right(diffSize) + "/" + iterator.fileName())));
}
}
}