author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 17 Sep 2010 08:34:18 +0300 | |
changeset 36 | ef0373b55136 |
parent 33 | 3e2da88830cd |
child 37 | 758a864f9613 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the qmake application of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#include "initprojectdeploy_symbian.h" |
|
43 |
#include <QDirIterator> |
|
44 |
#include <project.h> |
|
45 |
#include <qxmlstream.h> |
|
46 |
#include <qsettings.h> |
|
47 |
#include <qdebug.h> |
|
48 |
||
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
49 |
// Included from tools/shared |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
50 |
#include <symbian/epocroot.h> |
0 | 51 |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
52 |
#define SYSBIN_DIR "/sys/bin" |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
53 |
#define HW_Z_DIR "epoc32/data/z" |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
54 |
|
0 | 55 |
#define SUFFIX_DLL "dll" |
56 |
#define SUFFIX_EXE "exe" |
|
57 |
#define SUFFIX_QTPLUGIN "qtplugin" |
|
58 |
||
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
59 |
static QString fixPathToEpocOS(const QString &src) |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
60 |
{ |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
61 |
QString ret = Option::fixPathToTargetOS(src); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
62 |
return ret.replace('/', '\\'); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
63 |
} |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
64 |
|
0 | 65 |
static bool isPlugin(const QFileInfo& info, const QString& devicePath) |
66 |
{ |
|
67 |
// Libraries are plugins if deployment path is something else than |
|
68 |
// SYSBIN_DIR with or without drive letter |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
69 |
if (0 == info.suffix().compare(QLatin1String(SUFFIX_DLL), Qt::CaseInsensitive) |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
70 |
&& (devicePath.size() < 8 |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
71 |
|| (0 != devicePath.compare(QLatin1String(SYSBIN_DIR), Qt::CaseInsensitive) |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
72 |
&& 0 != devicePath.mid(1).compare(QLatin1String(":" SYSBIN_DIR), Qt::CaseInsensitive) |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
73 |
&& 0 != devicePath.compare(epocRoot() + QLatin1String(HW_Z_DIR SYSBIN_DIR))))) { |
0 | 74 |
return true; |
75 |
} else { |
|
76 |
return false; |
|
77 |
} |
|
78 |
} |
|
79 |
||
80 |
static bool isBinary(const QFileInfo& info) |
|
81 |
{ |
|
82 |
if (0 == info.suffix().compare(QLatin1String(SUFFIX_DLL), Qt::CaseInsensitive) || |
|
83 |
0 == info.suffix().compare(QLatin1String(SUFFIX_EXE), Qt::CaseInsensitive)) { |
|
84 |
return true; |
|
85 |
} else { |
|
86 |
return false; |
|
87 |
} |
|
88 |
} |
|
89 |
||
90 |
static void createPluginStub(const QFileInfo& info, |
|
91 |
const QString& devicePath, |
|
92 |
DeploymentList &deploymentList, |
|
93 |
QStringList& generatedDirs, |
|
94 |
QStringList& generatedFiles) |
|
95 |
{ |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
96 |
QString pluginStubDir = Option::output_dir + QLatin1Char('/') + QLatin1String(PLUGIN_STUB_DIR); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
97 |
QDir().mkpath(pluginStubDir); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
98 |
if (!generatedDirs.contains(pluginStubDir)) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
99 |
generatedDirs << pluginStubDir; |
0 | 100 |
// Plugin stubs must have different name from the actual plugins, because |
101 |
// the toolchain for creating ROM images cannot handle non-binary .dll files properly. |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
102 |
QFile stubFile(pluginStubDir + QLatin1Char('/') + info.completeBaseName() + QLatin1Char('.') + QLatin1String(SUFFIX_QTPLUGIN)); |
0 | 103 |
if (stubFile.open(QIODevice::WriteOnly)) { |
104 |
if (!generatedFiles.contains(stubFile.fileName())) |
|
105 |
generatedFiles << stubFile.fileName(); |
|
106 |
QTextStream t(&stubFile); |
|
107 |
// Add note to stub so that people will not wonder what it is. |
|
108 |
// Creation date is added to make new stub to deploy always to |
|
109 |
// force plugin cache miss when loading plugins. |
|
110 |
t << "This file is a Qt plugin stub file. The real Qt plugin is located in " SYSBIN_DIR ". Created:" << QDateTime::currentDateTime().toString(Qt::ISODate) << "\n"; |
|
111 |
} else { |
|
112 |
fprintf(stderr, "cannot deploy \"%s\" because of plugin stub file creation failed\n", info.fileName().toLatin1().constData()); |
|
113 |
} |
|
114 |
QFileInfo stubInfo(stubFile); |
|
115 |
deploymentList.append(CopyItem(Option::fixPathToLocalOS(stubInfo.absoluteFilePath()), |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
116 |
fixPathToEpocOS(devicePath + "/" + stubInfo.fileName()))); |
0 | 117 |
} |
118 |
||
119 |
QString generate_uid(const QString& target) |
|
120 |
{ |
|
121 |
static QMap<QString, QString> targetToUid; |
|
122 |
||
123 |
QString tmp = targetToUid[target]; |
|
124 |
||
125 |
if (!tmp.isEmpty()) { |
|
126 |
return tmp; |
|
127 |
} |
|
128 |
||
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
129 |
quint32 hash = 5381; |
0 | 130 |
int c; |
131 |
||
132 |
for (int i = 0; i < target.size(); ++i) { |
|
133 |
c = target.at(i).toAscii(); |
|
134 |
hash ^= c + ((c - i) << i % 20) + ((c + i) << (i + 5) % 20) + ((c - 2 * i) << (i + 10) % 20) + ((c + 2 * i) << (i + 15) % 20); |
|
135 |
} |
|
136 |
||
137 |
tmp.setNum(hash, 16); |
|
138 |
for (int i = tmp.size(); i < 8; ++i) |
|
139 |
tmp.prepend("0"); |
|
140 |
||
141 |
targetToUid[target] = tmp; |
|
142 |
||
143 |
return tmp; |
|
144 |
} |
|
145 |
||
146 |
// UIDs starting with 0xE are test UIDs in symbian |
|
147 |
QString generate_test_uid(const QString& target) |
|
148 |
{ |
|
149 |
QString tmp = generate_uid(target); |
|
150 |
tmp.replace(0, 1, "E"); |
|
151 |
tmp.prepend("0x"); |
|
152 |
||
153 |
return tmp; |
|
154 |
} |
|
155 |
||
156 |
||
157 |
void initProjectDeploySymbian(QMakeProject* project, |
|
158 |
DeploymentList &deploymentList, |
|
159 |
const QString &testPath, |
|
160 |
bool deployBinaries, |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
161 |
bool epocBuild, |
0 | 162 |
const QString &platform, |
163 |
const QString &build, |
|
164 |
QStringList& generatedDirs, |
|
165 |
QStringList& generatedFiles) |
|
166 |
{ |
|
167 |
QString targetPath = project->values("deploy.path").join(" "); |
|
168 |
if (targetPath.isEmpty()) |
|
169 |
targetPath = testPath; |
|
170 |
if (targetPath.endsWith("/") || targetPath.endsWith("\\")) |
|
171 |
targetPath = targetPath.mid(0, targetPath.size() - 1); |
|
172 |
||
173 |
bool targetPathHasDriveLetter = false; |
|
174 |
if (targetPath.size() > 1) { |
|
175 |
targetPathHasDriveLetter = targetPath.at(1) == QLatin1Char(':'); |
|
176 |
} |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
177 |
|
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
178 |
QString deploymentDrive; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
179 |
if (0 == platform.compare(QLatin1String(ROM_DEPLOYMENT_PLATFORM))) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
180 |
deploymentDrive = epocRoot() + HW_Z_DIR; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
181 |
} else { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
182 |
deploymentDrive = targetPathHasDriveLetter ? targetPath.left(2) : QLatin1String("c:"); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
183 |
} |
0 | 184 |
|
185 |
foreach(QString item, project->values("DEPLOYMENT")) { |
|
186 |
QString devicePath = project->first(item + ".path"); |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
187 |
QString devicePathWithoutDrive = devicePath; |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
188 |
|
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
189 |
bool devicePathHasDriveLetter = false; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
190 |
if (devicePath.size() > 1) { |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
191 |
devicePathHasDriveLetter = devicePath.at(1) == QLatin1Char(':'); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
192 |
} |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
193 |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
194 |
// Sometimes devicePath can contain disk but APP_RESOURCE_DIR does not, |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
195 |
// so remove the drive letter for comparison purposes. |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
196 |
if (devicePathHasDriveLetter) |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
197 |
{ |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
198 |
devicePathWithoutDrive.remove(0,2); |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
199 |
} |
0 | 200 |
if (!deployBinaries |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
201 |
&& 0 != platform.compare(QLatin1String(ROM_DEPLOYMENT_PLATFORM)) |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
202 |
&& !devicePathWithoutDrive.isEmpty() |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
203 |
&& (0 == devicePathWithoutDrive.compare(project->values("APP_RESOURCE_DIR").join(""), Qt::CaseInsensitive) |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
204 |
|| 0 == devicePathWithoutDrive.compare(project->values("REG_RESOURCE_IMPORT_DIR").join(""), Qt::CaseInsensitive))) { |
0 | 205 |
// Do not deploy resources in emulator builds, as that seems to cause conflicts |
206 |
// If there is ever a real need to deploy pre-built resources for emulator, |
|
207 |
// BLD_INF_RULES.prj_exports can be used as a workaround. |
|
208 |
continue; |
|
209 |
} |
|
210 |
||
211 |
if (devicePath.isEmpty() || devicePath == QLatin1String(".")) { |
|
212 |
devicePath = targetPath; |
|
213 |
} |
|
214 |
// check if item.path is relative (! either / or \) |
|
215 |
else if (!(devicePath.at(0) == QLatin1Char('/') |
|
216 |
|| devicePath.at(0) == QLatin1Char('\\') |
|
217 |
|| devicePathHasDriveLetter)) { |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
218 |
// Create output path |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
219 |
devicePath = Option::fixPathToLocalOS(QDir::cleanPath(targetPath + QLatin1Char('/') + devicePath)); |
0 | 220 |
} else { |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
221 |
if (0 == platform.compare(QLatin1String(EMULATOR_DEPLOYMENT_PLATFORM))) { |
0 | 222 |
if (devicePathHasDriveLetter) { |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
223 |
devicePath = epocRoot() + "epoc32/winscw/" + devicePath.remove(1, 1); |
0 | 224 |
} else { |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
225 |
devicePath = epocRoot() + "epoc32/winscw/c" + devicePath; |
0 | 226 |
} |
227 |
} else { |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
228 |
if (devicePathHasDriveLetter |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
229 |
&& 0 == platform.compare(QLatin1String(ROM_DEPLOYMENT_PLATFORM))) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
230 |
devicePath.remove(0,2); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
231 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
232 |
if (0 == platform.compare(QLatin1String(ROM_DEPLOYMENT_PLATFORM)) |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
233 |
|| (!devicePathHasDriveLetter && targetPathHasDriveLetter)) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
234 |
devicePath = deploymentDrive + devicePath; |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
235 |
} |
0 | 236 |
} |
237 |
} |
|
238 |
||
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
239 |
devicePath.replace(QLatin1String("\\"), QLatin1String("/")); |
0 | 240 |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
241 |
if (!deployBinaries |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
242 |
&& 0 == devicePath.right(8).compare(QLatin1String(SYSBIN_DIR), Qt::CaseInsensitive) |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
243 |
&& 0 != platform.compare(QLatin1String(ROM_DEPLOYMENT_PLATFORM))) { |
0 | 244 |
// Skip deploying to SYSBIN_DIR for anything but binary deployments |
245 |
// Note: Deploying pre-built binaries also follow this rule, so emulator builds |
|
246 |
// will not get those deployed. Since there is no way to differentiate currently |
|
247 |
// between pre-built binaries for emulator and HW anyway, this is not a major issue. |
|
248 |
continue; |
|
249 |
} |
|
250 |
||
251 |
foreach(QString source, project->values(item + ".sources")) { |
|
252 |
source = Option::fixPathToLocalOS(source); |
|
253 |
QString nameFilter; |
|
254 |
QFileInfo info(source); |
|
255 |
QString searchPath; |
|
256 |
bool dirSearch = false; |
|
257 |
||
258 |
if (info.isDir()) { |
|
259 |
nameFilter = QLatin1String("*"); |
|
260 |
searchPath = info.absoluteFilePath(); |
|
261 |
dirSearch = true; |
|
262 |
} else { |
|
263 |
if (info.exists() || source.indexOf('*') != -1) { |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
264 |
nameFilter = source.split(QDir::separator()).last(); |
0 | 265 |
searchPath = info.absolutePath(); |
266 |
} else { |
|
267 |
// Entry was not found. That is ok if it is a binary, since those do not necessarily yet exist. |
|
268 |
// Dlls need to be processed even when not deploying binaries for the stubs |
|
269 |
if (isBinary(info)) { |
|
270 |
if (deployBinaries) { |
|
271 |
// Executables and libraries are deployed to \sys\bin |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
272 |
QFileInfo targetPath; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
273 |
if (epocBuild) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
274 |
targetPath.setFile(epocRoot() + "epoc32/release/" + platform + "/" + build + "/"); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
275 |
else |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
276 |
targetPath.setFile(info.path() + QDir::separator()); |
0 | 277 |
if(devicePathHasDriveLetter) { |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
278 |
deploymentList.append(CopyItem( |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
279 |
Option::fixPathToLocalOS(targetPath.absolutePath() + "/" + info.fileName(), |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
280 |
false, true), |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
281 |
fixPathToEpocOS(devicePath.left(2) + QLatin1String(SYSBIN_DIR "/") |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
282 |
+ info.fileName()))); |
0 | 283 |
} else { |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
284 |
deploymentList.append(CopyItem( |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
285 |
Option::fixPathToLocalOS(targetPath.absolutePath() + "/" + info.fileName(), |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
286 |
false, true), |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
287 |
fixPathToEpocOS(deploymentDrive + QLatin1String("/" SYSBIN_DIR "/") |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
288 |
+ info.fileName()))); |
0 | 289 |
} |
290 |
} |
|
291 |
if (isPlugin(info, devicePath)) { |
|
292 |
createPluginStub(info, devicePath, deploymentList, generatedDirs, generatedFiles); |
|
293 |
continue; |
|
294 |
} |
|
295 |
} else { |
|
296 |
// Generate deployment even if file doesn't exist, as this may be the case |
|
297 |
// when generating .pkg files. |
|
298 |
deploymentList.append(CopyItem(Option::fixPathToLocalOS(info.absoluteFilePath()), |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
299 |
fixPathToEpocOS(devicePath + "/" + info.fileName()))); |
0 | 300 |
continue; |
301 |
} |
|
302 |
} |
|
303 |
} |
|
304 |
||
305 |
int pathSize = info.absolutePath().size(); |
|
306 |
QDirIterator iterator(searchPath, QStringList() << nameFilter |
|
307 |
, QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks |
|
308 |
, dirSearch ? QDirIterator::Subdirectories : QDirIterator::NoIteratorFlags); |
|
309 |
||
310 |
while (iterator.hasNext()) { |
|
311 |
iterator.next(); |
|
312 |
QFileInfo iteratorInfo(iterator.filePath()); |
|
313 |
QString absoluteItemPath = Option::fixPathToLocalOS(iteratorInfo.absolutePath()); |
|
314 |
int diffSize = absoluteItemPath.size() - pathSize; |
|
315 |
||
316 |
if (!iteratorInfo.isDir()) { |
|
317 |
if (isPlugin(iterator.fileInfo(), devicePath)) { |
|
318 |
// This deploys pre-built plugins. Other pre-built binaries will deploy normally, |
|
319 |
// as they have SYSBIN_DIR target path. |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
320 |
if (deployBinaries |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
321 |
|| (0 == platform.compare(QLatin1String(ROM_DEPLOYMENT_PLATFORM)))) { |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
322 |
if (devicePathHasDriveLetter) { |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
323 |
deploymentList.append(CopyItem( |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
324 |
Option::fixPathToLocalOS(absoluteItemPath + "/" + iterator.fileName()), |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
325 |
fixPathToEpocOS(devicePath.left(2) + QLatin1String(SYSBIN_DIR "/") |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
326 |
+ iterator.fileName()))); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
327 |
} else { |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
328 |
deploymentList.append(CopyItem( |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
329 |
Option::fixPathToLocalOS(absoluteItemPath + "/" + iterator.fileName()), |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
330 |
fixPathToEpocOS(deploymentDrive + QLatin1String("/" SYSBIN_DIR "/") |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
331 |
+ iterator.fileName()))); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
332 |
} |
0 | 333 |
} |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
334 |
createPluginStub(info, devicePath + "/" + absoluteItemPath.right(diffSize), |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
335 |
deploymentList, generatedDirs, generatedFiles); |
0 | 336 |
continue; |
337 |
} else { |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
338 |
deploymentList.append(CopyItem( |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
339 |
Option::fixPathToLocalOS(absoluteItemPath + "/" + iterator.fileName()), |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
340 |
fixPathToEpocOS(devicePath + "/" + absoluteItemPath.right(diffSize) |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
341 |
+ "/" + iterator.fileName()))); |
0 | 342 |
} |
343 |
} |
|
344 |
} |
|
345 |
} |
|
346 |
} |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
347 |
|
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
348 |
// Remove deployments that do not actually do anything |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
349 |
if (0 == platform.compare(QLatin1String(EMULATOR_DEPLOYMENT_PLATFORM)) |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
350 |
|| 0 == platform.compare(QLatin1String(ROM_DEPLOYMENT_PLATFORM))) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
351 |
QMutableListIterator<CopyItem> i(deploymentList); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
352 |
while(i.hasNext()) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
353 |
CopyItem &item = i.next(); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
354 |
QFileInfo fromItem(item.from); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
355 |
QFileInfo toItem(item.to); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
356 |
if (fromItem == toItem) |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
357 |
i.remove(); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
358 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
359 |
} |
0 | 360 |
} |