123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- #include "tizendebug.h"
- #include "tizenconfigurations.h"
- #include "tizendeploypackagecreationstep.h"
- #include "tizendeploypackagecreationconfigwidget.h"
- #include "tizenmanager.h"
- #include "processoutputhandler.h"
- #include <projectexplorer/buildsteplist.h>
- #include <projectexplorer/deployconfiguration.h>
- #include <projectexplorer/target.h>
- #include <projectexplorer/buildconfiguration.h>
- #include <projectexplorer/kitinformation.h>
- #include <qmakeprojectmanager/qmakeproject.h>
- #include <qmakeprojectmanager/qmakenodes.h>
- #include <utils/hostosinfo.h>
- #include <QDebug>
- #include <QDir>
- #include <QThread>
- using namespace Tizen::Internal;
- const Core::Id TizenDeployPackageCreationStep::Id = Core::Id("Qt4ProjectManager.TizenDeployPackageCreationStep");
- TizenDeployPackageCreationStep::TizenDeployPackageCreationStep(ProjectExplorer::BuildStepList *bsl)
- : BuildStep(bsl, Id)
- {
- const QString name = tr("Create package(tpk)");
- setDefaultDisplayName(name);
- setDisplayName(name);
- }
- bool TizenDeployPackageCreationStep::init()
- {
- return true;
- }
- ProjectExplorer::BuildStepConfigWidget *TizenDeployPackageCreationStep::createConfigWidget()
- {
- TizenDeployPackageCreationConfigWidget *configWidget = new TizenDeployPackageCreationConfigWidget();
- TizenConfig tc = TizenConfigurations::currentConfig();
- QString passwd = tc.authorCertificatePassword();
- passwd.fill(QChar::fromAscii('*'),passwd.size());
- configWidget->setAdditionalSummaryText(QString::fromLatin1("%1 --sign-author-key %2 --sign-author-pwd %3 in %4")
- .arg(tc.nativePackagingLocation().toString())
- .arg(tc.authorCertificateLocation().toString())
- .arg(passwd)
- .arg(TizenManager::commandLineBuildPath(target()).toString()));
- return configWidget;
- }
- TizenDeployPackageCreationStep::TizenDeployPackageCreationStep(ProjectExplorer::BuildStepList *bc, TizenDeployPackageCreationStep *other)
- : BuildStep(bc, other)
- { }
- void TizenDeployPackageCreationStep::run(QFutureInterface<bool> &fi)
- {
- emit addOutput(tr("Creating package."), BuildStep::MessageOutput);
- QProcess *nativePackagingProcess = new QProcess;
- connect(new ProcessOutputHandler(nativePackagingProcess),
- SIGNAL(output(QString,ProjectExplorer::BuildStep::OutputFormat,ProjectExplorer::BuildStep::OutputNewlineSetting)),
- SIGNAL(addOutput(QString,ProjectExplorer::BuildStep::OutputFormat,ProjectExplorer::BuildStep::OutputNewlineSetting)));
- nativePackagingProcess->setWorkingDirectory(TizenManager::commandLineBuildPath(target()).toString());
- QStringList arguments;
- TizenConfig tc = TizenConfigurations::currentConfig();
- arguments << QLatin1String("--sign-author-key") << tc.authorCertificateLocation().toString();
- arguments << QLatin1String("--sign-author-pwd");
- arguments << QLatin1String("***");
- addOutput(tr("Starting %1 %2.").arg(tc.nativePackagingLocation().toString()).arg(arguments.join(QLatin1Char(' '))), BuildStep::MessageOutput);
- arguments.pop_back();
- arguments << tc.authorCertificatePassword();
- nativePackagingProcess->start(tc.nativePackagingLocation().toString(), arguments);
- if(!nativePackagingProcess->waitForStarted() || !nativePackagingProcess->waitForFinished(60 * 60 * 1000)) {
- addOutput(tr("Can't start %1.").arg(tc.nativePackagingLocation().toString()), BuildStep::ErrorOutput);
- fi.reportResult(false);
- nativePackagingProcess->deleteLater();
- return;
- }
- if (nativePackagingProcess->exitCode() != 0) {
- emit addOutput(tr("Error while creating package."), BuildStep::ErrorOutput);
- fi.reportResult(false);
- } else {
- emit addOutput(tr("Package Created."), BuildStep::MessageOutput);
- fi.reportResult(true);
- }
-
- nativePackagingProcess->deleteLater();
- }
|