summaryrefslogtreecommitdiff
path: root/src/plugins/qnx/blackberrycreatepackagestep.cpp
blob: de48394d0b3ba61af761448aef29931723e4cc49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
/**************************************************************************
**
** Copyright (C) 2012 - 2014 BlackBerry Limited. All rights reserved.
**
** Contact: BlackBerry (qt@blackberry.com)
** Contact: KDAB (info@kdab.com)
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://www.qt.io/licensing.  For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file.  Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights.  These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/

#include "blackberrycreatepackagestep.h"

#include "qnxconstants.h"
#include "blackberrycreatepackagestepconfigwidget.h"
#include "blackberrydeployconfiguration.h"
#include "qnxutils.h"
#include "bardescriptordocument.h"
#include "blackberryqtversion.h"
#include "blackberrydeviceconfiguration.h"
#include "blackberrydeployinformation.h"
#include "blackberrysigningpasswordsdialog.h"
#include "bardescriptordocument.h"

#include <debugger/debuggerrunconfigurationaspect.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <projectexplorer/runconfiguration.h>
#include <qmakeprojectmanager/qmakebuildconfiguration.h>
#include <qmakeprojectmanager/qmakenodes.h>
#include <qmakeprojectmanager/qmakeproject.h>
#include <qtsupport/qtkitinformation.h>
#include <utils/qtcassert.h>
#include <coreplugin/documentmanager.h>
#include <coreplugin/icore.h>

#include <QMessageBox>

using namespace Qnx;
using namespace Qnx::Internal;

namespace {
const char PACKAGER_CMD[] = "blackberry-nativepackager";

const char PACKAGE_MODE_KEY[]      = "Qt4ProjectManager.BlackBerryCreatePackageStep.PackageMode";
const char CSK_PASSWORD_KEY[]      = "Qt4ProjectManager.BlackBerryCreatePackageStep.CskPassword";
const char KEYSTORE_PASSWORD_KEY[] = "Qt4ProjectManager.BlackBerryCreatePackageStep.KeystorePassword";
const char SAVE_PASSWORDS_KEY[]    = "Qt4ProjectManager.BlackBerryCreatePackageStep.SavePasswords";
const char BUNDLE_MODE_KEY[]       = "Qt4ProjectManager.BlackBerryCreatePackageStep.BundleMode";
const char QT_LIBRARY_PATH_KEY[]   = "Qt4ProjectManager.BlackBerryCreatePackageStep.QtLibraryPath";
}

static void prependOrSetQtEnvironment(Utils::Environment &env,
                                     const QString &key,
                                     const QString &value,
                                     bool &updated)
{
    const QString currentValue = env.value(key);
    const QString newValue = value + QLatin1String(":$") + key;
    if (!currentValue.isEmpty()) {
        if (currentValue == newValue)
            return;
        else
            env.unset(key);
    }

    env.prependOrSet(key, newValue);
    updated = true;
}

static void setQtEnvironment(Utils::Environment &env, const QString &qtPath,
                             bool &updated, bool isQt5)
{
    prependOrSetQtEnvironment(env, QLatin1String("LD_LIBRARY_PATH"),
                             QString::fromLatin1("%1/lib").arg(qtPath),
                              updated);
    prependOrSetQtEnvironment(env, QLatin1String("QML_IMPORT_PATH"),
                             QString::fromLatin1("%1/imports").arg(qtPath),
                              updated);
    prependOrSetQtEnvironment(env, QLatin1String("QT_PLUGIN_PATH"),
                             QString::fromLatin1("%1/plugins").arg(qtPath),
                              updated);
    if (isQt5) {
        prependOrSetQtEnvironment(env, QLatin1String("QML2_IMPORT_PATH"),
                                  QString::fromLatin1("%1/qml").arg(qtPath),
                                  updated);
    }
}

static bool removeQtAssets(BarDescriptorAssetList &assetList)
{
    bool assetsRemoved = false;
    foreach (const BarDescriptorAsset &a, assetList) {
        if (a.destination == QLatin1String("runtime/qt/lib") ||
                a.destination == QLatin1String("runtime/qt/plugins") ||
                a.destination == QLatin1String("runtime/qt/imports") ||
                a.destination == QLatin1String("runtime/qt/qml")) {
            assetList.removeOne(a);
            assetsRemoved = true;
        }
    }

    return assetsRemoved;
}

static bool addQtAssets(BarDescriptorAssetList &assetList, BlackBerryQtVersion *qtVersion)
{
    const bool isQt5 = qtVersion->qtVersion().majorVersion == 5;
    bool libAssetExists = false;
    bool pluginAssetExists = false;
    bool importAssetExists = false;
    bool qmlAssetExists = false;
    const QString qtInstallLibsPath =
            qtVersion->versionInfo().value(QLatin1String("QT_INSTALL_LIBS"));
    const QString qtInstallPluginPath =
            qtVersion->versionInfo().value(QLatin1String("QT_INSTALL_PLUGINS"));
    const QString qtInstallImportsPath =
            qtVersion->versionInfo().value(QLatin1String("QT_INSTALL_IMPORTS"));
    const QString qtInstallQmlPath =
            qtVersion->versionInfo().value(QLatin1String("QT_INSTALL_QML"));
    foreach (const BarDescriptorAsset &a, assetList) {
        // TODO: Also check if the asset's source is correct
        if (a.destination == QLatin1String("runtime/qt/lib")) {
            if (a.source == qtInstallLibsPath)
                libAssetExists = true;
            else
                assetList.removeOne(a);
        } else if (a.destination == QLatin1String("runtime/qt/plugins")) {
            if (a.source == qtInstallPluginPath)
                pluginAssetExists = true;
            else
                assetList.removeOne(a);
        } else if (a.destination == QLatin1String("runtime/qt/imports")) {
            if (a.source == qtInstallImportsPath)
                importAssetExists = true;
            else
                assetList.removeOne(a);
        } else if (isQt5 && a.destination == QLatin1String("runtime/qt/qml")) {
            if (a.destination == qtInstallQmlPath)
                qmlAssetExists = true;
            else
                assetList.removeOne(a);
        }
    }

    // return false if all assets already exist
    if (libAssetExists && pluginAssetExists && importAssetExists) {
        if (!isQt5 || qmlAssetExists)
            return false;
    }

    QList<QPair<QString, QString> > qtFolders;
    qtFolders.append(qMakePair(QString::fromLatin1("runtime/qt/lib"),
                               qtInstallLibsPath));
    qtFolders.append(qMakePair(QString::fromLatin1("runtime/qt/plugins"),
                               qtInstallPluginPath));
    qtFolders.append(qMakePair(QString::fromLatin1("runtime/qt/imports"),
                               qtInstallImportsPath));

    if (isQt5) {
        qtFolders.append(qMakePair(QString::fromLatin1("runtime/qt/qml"),
                                   qtInstallQmlPath));
    }

    for (QList<QPair<QString, QString> >::const_iterator it = qtFolders.constBegin();
         it != qtFolders.constEnd(); ++it) {
        const QString target = it->first;
        const QString qtFolder = it->second;
        if (QFileInfo(qtFolder).exists()) {
            BarDescriptorAsset asset;
            asset.source = qtFolder;
            asset.destination = target;
            asset.entry = false;
            assetList << asset;
        }
    }

    return true;
}

BlackBerryCreatePackageStep::BlackBerryCreatePackageStep(ProjectExplorer::BuildStepList *bsl)
    : BlackBerryAbstractDeployStep(bsl, Core::Id(Constants::QNX_CREATE_PACKAGE_BS_ID))
{
    ctor();
}

BlackBerryCreatePackageStep::BlackBerryCreatePackageStep(ProjectExplorer::BuildStepList *bsl,
                                           BlackBerryCreatePackageStep *bs)
    : BlackBerryAbstractDeployStep(bsl, bs)
{
    ctor();
}

void BlackBerryCreatePackageStep::ctor()
{
    setDisplayName(tr("Create packages"));

    m_packageMode = DevelopmentMode;
    m_bundleMode = PreInstalledQt;
    m_qtLibraryPath = QLatin1String("qt");
}

bool BlackBerryCreatePackageStep::init()
{
    if (!BlackBerryAbstractDeployStep::init())
        return false;

    const QString packageCmd = target()->activeBuildConfiguration()->environment().searchInPath(QLatin1String(PACKAGER_CMD));
    if (packageCmd.isEmpty()) {
        raiseError(tr("Could not find packager command \"%1\" in the build environment.")
                   .arg(QLatin1String(PACKAGER_CMD)));
        return false;
    }

    BlackBerryDeployConfiguration *deployConfig = qobject_cast<BlackBerryDeployConfiguration *>(deployConfiguration());
    QTC_ASSERT(deployConfig, return false);

    QList<BarPackageDeployInformation> packagesToDeploy = deployConfig->deploymentInfo()->enabledPackages();
    if (packagesToDeploy.isEmpty()) {
        raiseError(tr("No packages enabled for deployment."));
        return false;
    }

    foreach (const BarPackageDeployInformation &info, packagesToDeploy) {
        if (info.appDescriptorPath().isEmpty()) {
            raiseError(tr("BAR application descriptor file not specified. Check deployment settings."));
            return false;
        }

        if (info.packagePath().isEmpty()) {
            raiseError(tr("No package specified. Check deployment settings."));
            return false;
        }

        const QString buildDir = QFileInfo(info.packagePath()).absolutePath();
        QDir dir(buildDir);
        if (!dir.exists()) {
            if (!dir.mkpath(buildDir)) {
                raiseError(tr("Could not create build directory \"%1\".").arg(buildDir));
                return false;
            }
        }

        const QString appDescriptorPath =  info.appDescriptorPath();
        if (!doUpdateAppDescriptorFile(appDescriptorPath, PlaceHolders))
            // If there is an error, prepareAppDescriptorFile() will raise it
            return false;

        QStringList args;
        if (m_packageMode == DevelopmentMode) {
            args << QLatin1String("-devMode");
            if (!debugToken().isEmpty())
                args << QLatin1String("-debugToken") << QnxUtils::addQuotes(QDir::toNativeSeparators(debugToken()));
        } else if (m_packageMode == SigningPackageMode) {
            if (m_cskPassword.isEmpty() || m_keystorePassword.isEmpty()) {
                BlackBerrySigningPasswordsDialog dlg;
                dlg.setCskPassword(m_cskPassword);
                dlg.setStorePassword(m_keystorePassword);
                if (dlg.exec() == QDialog::Rejected) {
                    raiseError(tr("Missing passwords for signing packages."));
                    return false;
                }

                m_cskPassword = dlg.cskPassword();
                m_keystorePassword = dlg.storePassword();

                emit cskPasswordChanged(m_cskPassword);
                emit keystorePasswordChanged(m_keystorePassword);
            }
            args << QLatin1String("-sign");
            args << QLatin1String("-cskpass");
            args << m_cskPassword;
            args << QLatin1String("-storepass");
            args << m_keystorePassword;
        }
        args << QLatin1String("-package") << QnxUtils::addQuotes(QDir::toNativeSeparators(info.packagePath()));
        args << QnxUtils::addQuotes(QDir::toNativeSeparators(appDescriptorPath));

        addCommand(packageCmd, args);
    }

    return true;
}

ProjectExplorer::BuildStepConfigWidget *BlackBerryCreatePackageStep::createConfigWidget()
{
    BlackBerryCreatePackageStepConfigWidget *config = new BlackBerryCreatePackageStepConfigWidget(this);
    connect(config, SIGNAL(bundleModeChanged()), this, SLOT(updateAppDescriptorFile()));
    return config;
}

QString BlackBerryCreatePackageStep::debugToken() const
{
    BlackBerryDeviceConfiguration::ConstPtr device = BlackBerryDeviceConfiguration::device(target()->kit());
    if (!device)
        return QString();

    return device->debugToken();
}

bool BlackBerryCreatePackageStep::fromMap(const QVariantMap &map)
{
    m_packageMode = static_cast<PackageMode>(map.value(QLatin1String(PACKAGE_MODE_KEY),
                                                       DevelopmentMode).toInt());
    m_savePasswords = map.value(QLatin1String(SAVE_PASSWORDS_KEY), false).toBool();
    if (m_savePasswords) {
        m_cskPassword = map.value(QLatin1String(CSK_PASSWORD_KEY)).toString();
        m_keystorePassword = map.value(QLatin1String(KEYSTORE_PASSWORD_KEY)).toString();
    }
    m_bundleMode = static_cast<BundleMode>(map.value(QLatin1String(BUNDLE_MODE_KEY),
                                                     PreInstalledQt).toInt());
    m_qtLibraryPath = map.value(QLatin1String(QT_LIBRARY_PATH_KEY),
                                QLatin1String("qt")).toString();
    return BlackBerryAbstractDeployStep::fromMap(map);
}

QVariantMap BlackBerryCreatePackageStep::toMap() const
{
    QVariantMap map = BlackBerryAbstractDeployStep::toMap();
    map.insert(QLatin1String(PACKAGE_MODE_KEY), m_packageMode);
    map.insert(QLatin1String(SAVE_PASSWORDS_KEY), m_savePasswords);
    if (m_savePasswords) {
        map.insert(QLatin1String(CSK_PASSWORD_KEY), m_cskPassword);
        map.insert(QLatin1String(KEYSTORE_PASSWORD_KEY), m_keystorePassword);
    }
    map.insert(QLatin1String(BUNDLE_MODE_KEY), m_bundleMode);
    map.insert(QLatin1String(QT_LIBRARY_PATH_KEY), m_qtLibraryPath);
    return map;
}

BlackBerryCreatePackageStep::PackageMode BlackBerryCreatePackageStep::packageMode() const
{
    return m_packageMode;
}

QString BlackBerryCreatePackageStep::cskPassword() const
{
    return m_cskPassword;
}

QString BlackBerryCreatePackageStep::keystorePassword() const
{
    return m_keystorePassword;
}

bool BlackBerryCreatePackageStep::savePasswords() const
{
    return m_savePasswords;
}

BlackBerryCreatePackageStep::BundleMode BlackBerryCreatePackageStep::bundleMode() const
{
    return m_bundleMode;
}

QString BlackBerryCreatePackageStep::qtLibraryPath() const
{
    return m_qtLibraryPath;
}

QString BlackBerryCreatePackageStep::fullDeployedQtLibraryPath() const
{
    return QLatin1String(Constants::QNX_BLACKBERRY_DEFAULT_DEPLOY_QT_BASEPATH) + m_qtLibraryPath;
}

void BlackBerryCreatePackageStep::setPackageMode(BlackBerryCreatePackageStep::PackageMode packageMode)
{
    m_packageMode = packageMode;
}

void BlackBerryCreatePackageStep::setCskPassword(const QString &cskPassword)
{
    m_cskPassword = cskPassword;
}

void BlackBerryCreatePackageStep::setKeystorePassword(const QString &storePassword)
{
    m_keystorePassword = storePassword;
}

void BlackBerryCreatePackageStep::setSavePasswords(bool savePasswords)
{
    m_savePasswords = savePasswords;
}

void BlackBerryCreatePackageStep::setBundleMode(BlackBerryCreatePackageStep::BundleMode bundleMode)
{
    m_bundleMode = bundleMode;
}

void BlackBerryCreatePackageStep::setQtLibraryPath(const QString &qtLibraryPath)
{
    m_qtLibraryPath = qtLibraryPath;
}

void BlackBerryCreatePackageStep::updateAppDescriptorFile()
{
    BlackBerryDeployConfiguration *deployConfig = qobject_cast<BlackBerryDeployConfiguration *>(deployConfiguration());
    QTC_ASSERT(deployConfig, return);

    QList<BarPackageDeployInformation> packagesToDeploy = deployConfig->deploymentInfo()->enabledPackages();
    if (packagesToDeploy.isEmpty())
        return;

    foreach (const BarPackageDeployInformation &info, packagesToDeploy)
        doUpdateAppDescriptorFile(info.appDescriptorPath(), QtEnvironment);
}

bool BlackBerryCreatePackageStep::doUpdateAppDescriptorFile(const QString &appDescriptorPath,
                                                            QFlags<EditMode> types,
                                                            bool skipConfirmation)
{
    Core::FileChangeBlocker fb(appDescriptorPath);
    BarDescriptorDocument doc;
    QString errorString;
    if (!doc.open(&errorString, appDescriptorPath)) {
        raiseError(tr("Error opening BAR application descriptor file \"%1\" - %2")
            .arg(QDir::toNativeSeparators(appDescriptorPath))
            .arg(errorString));
        return false;
    }

    BarDescriptorAssetList assetList = doc.value(BarDescriptorDocument::asset)
            .value<BarDescriptorAssetList>();
    bool updated = false;
    if (types.testFlag(PlaceHolders)) {

        foreach (const BarDescriptorAsset &a, assetList) {
            if (a.source.contains(QLatin1String("%SRC_DIR%"))) {
                // Keep backward compatibility with older templates
                QHash<QString, QString> placeHoldersHash;
                placeHoldersHash[QLatin1String("%SRC_DIR%")] = QString();
                doc.expandPlaceHolders(placeHoldersHash);
                updated = true;
            }

            // Update the entry point source path to make use of the BUILD_DIR variable
            // if not set
            if (a.entry) {
                BarDescriptorAsset asset = a;
                if (asset.source.contains(QLatin1String("${BUILD_DIR}/")))
                    break;
                asset.source = QLatin1String("${BUILD_DIR}/") + asset.destination;
                assetList.removeOne(a);
                assetList << asset;
                updated = true;
                break;
            }
        }
    }

    if (types.testFlag(QtEnvironment)) {
        bool environmentUpdated = false;
        bool assetsUpdated = false;
        // Set up correct environment depending on using bundled/pre-installed Qt
        QList<Utils::EnvironmentItem> envItems =
                doc.value(BarDescriptorDocument::env).value<QList<Utils::EnvironmentItem> >();
        Utils::Environment env(Utils::EnvironmentItem::toStringList(envItems), Utils::OsTypeOtherUnix);
        BlackBerryQtVersion *qtVersion = dynamic_cast<BlackBerryQtVersion *>(QtSupport::QtKitInformation::qtVersion(target()->kit()));
        const bool isQt5 = qtVersion->qtVersion().majorVersion == 5;
        if (!qtVersion) {
            raiseError(tr("Error preparing BAR application descriptor file."));
            return false;
        }

        if (m_packageMode == SigningPackageMode
                || (m_packageMode == DevelopmentMode && m_bundleMode == PreInstalledQt)) {
            QtSupport::QtVersionNumber versionNumber = qtVersion->qtVersion();
            setQtEnvironment(env, QString::fromLatin1("/usr/lib/qt%1").arg(versionNumber.majorVersion),
                             environmentUpdated, isQt5);
            // remove qt assets if existing since not needed
            assetsUpdated = removeQtAssets(assetList);
        } else if (m_packageMode == DevelopmentMode && m_bundleMode == BundleQt) {
            assetsUpdated = addQtAssets(assetList, qtVersion);
            // TODO: Check for every Qt environment if the corresponding
            // assets exist for broken/internal builds(?)
            setQtEnvironment(env, QLatin1String("app/native/runtime/qt"),
                             environmentUpdated, isQt5);
        } else if (m_packageMode == DevelopmentMode && m_bundleMode == DeployedQt) {
            setQtEnvironment(env, fullDeployedQtLibraryPath(),
                             environmentUpdated, isQt5);
            // remove qt assets if existing since not needed
            assetsUpdated = removeQtAssets(assetList);
        }

        if (environmentUpdated) {
            QMessageBox::StandardButton answer = QMessageBox::Yes;
            if (!skipConfirmation) {
                QString confirmationText = tr("In order to link to the correct Qt library specified in the deployment settings "
                                              "Qt Creator needs to update the Qt environment variables "
                                              "in the BAR application file as follows:\n\n"
                                              "<env var=\"LD_LIBRARY_PATH\" value=\"%1\"/>\n"
                                              "<env var=\"QT_PLUGIN_PATH\" value=\"%2\"/>\n"
                                              "<env var=\"QML_IMPORT_PATH\" value=\"%3\"/>\n")
                        .arg(env.value(QLatin1String("LD_LIBRARY_PATH")),
                             env.value(QLatin1String("QT_PLUGIN_PATH")),
                             env.value(QLatin1String("QML_IMPORT_PATH")));

                if (isQt5)
                    confirmationText.append(QString::fromLatin1("<env var=\"QML2_IMPORT_PATH\" value=\"%1\"/>\n")
                                            .arg(env.value(QLatin1String("QML2_IMPORT_PATH"))));

                confirmationText.append(tr("\nDo you want to update it?"));
                answer = QMessageBox::question(Core::ICore::mainWindow(), tr("Confirmation"),
                                               confirmationText,
                                               QMessageBox::Yes | QMessageBox::No);
            }

            if (answer == QMessageBox::Yes) {
                QVariant envVar;
                envVar.setValue(Utils::EnvironmentItem::fromStringList(env.toStringList()));
                doc.setValue(BarDescriptorDocument::env, envVar);
                updated = true;
            }
        }

        if (assetsUpdated) {
            doc.setValue(BarDescriptorDocument::asset, QVariant::fromValue(assetList));
            updated = true;
        }
    }

    // Skip unnecessary saving
    if (!updated)
        return true;

    if (!doc.save(&errorString)) {
        raiseError(tr("Error saving BAR application descriptor file \"%1\" - %2")
                   .arg(QDir::toNativeSeparators(appDescriptorPath))
                   .arg(errorString));
        return false;
    }

    return true;
}

void BlackBerryCreatePackageStep::processStarted(const ProjectExplorer::ProcessParameters &params)
{
    if (m_packageMode == SigningPackageMode) {
        QString arguments = params.prettyArguments();

        const QString cskPasswordLine = QLatin1String(" -cskpass ") + m_cskPassword;
        const QString hiddenCskPasswordLine = QLatin1String(" -cskpass <hidden>");
        arguments.replace(cskPasswordLine, hiddenCskPasswordLine);

        const QString storePasswordLine = QLatin1String(" -storepass ") + m_keystorePassword;
        const QString hiddenStorePasswordLine = QLatin1String(" -storepass <hidden>");
        arguments.replace(storePasswordLine, hiddenStorePasswordLine);

        emitOutputInfo(params, arguments);
    } else {
        BlackBerryAbstractDeployStep::processStarted(params);
    }
}