1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of Qt Creator.
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
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.
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.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
40 ****************************************************************************/
42 #ifndef MAEMOPACKAGECREATIONSTEP_H
43 #define MAEMOPACKAGECREATIONSTEP_H
45 #include <projectexplorer/buildstep.h>
53 namespace Qt4ProjectManager {
54 class Qt4BuildConfiguration;
57 class MaemoDeployStep;
58 class MaemoDeployableListModel;
59 class AbstractQt4MaemoTarget;
60 class AbstractDebBasedQt4MaemoTarget;
61 class AbstractRpmBasedQt4MaemoTarget;
63 class MaemoPackageCreationStep : public ProjectExplorer::BuildStep
66 friend class MaemoPackageCreationFactory;
68 MaemoPackageCreationStep(ProjectExplorer::BuildStepList *bsl);
69 ~MaemoPackageCreationStep();
71 QString packageFilePath() const;
72 bool isPackagingEnabled() const;
73 void setPackagingEnabled(bool enabled) { m_packagingEnabled = enabled; }
75 QString versionString(QString *error) const;
76 bool setVersionString(const QString &version, QString *error);
78 static void preparePackagingProcess(QProcess *proc,
79 const Qt4BuildConfiguration *bc, const QString &workingDir);
80 static QString packagingCommand(const Qt4BuildConfiguration *bc,
81 const QString &commandName);
82 static void ensureShlibdeps(QByteArray &rulesContent);
84 QString projectName() const;
85 const Qt4BuildConfiguration *qt4BuildConfiguration() const;
86 AbstractQt4MaemoTarget *maemoTarget() const;
87 AbstractDebBasedQt4MaemoTarget *debBasedMaemoTarget() const;
88 AbstractRpmBasedQt4MaemoTarget *rpmBasedMaemoTarget() const;
90 static const QLatin1String DefaultVersionNumber;
93 void packageFilePathChanged();
94 void qtVersionChanged();
97 void handleBuildOutput();
98 void handleBuildConfigChanged();
101 MaemoPackageCreationStep(ProjectExplorer::BuildStepList *buildConfig,
102 MaemoPackageCreationStep *other);
106 virtual void run(QFutureInterface<bool> &fi);
107 virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
108 virtual bool immutable() const { return true; }
109 virtual QVariantMap toMap() const;
110 virtual bool fromMap(const QVariantMap &map);
112 bool createPackage(QProcess *buildProc);
113 bool copyDebianFiles(bool inSourceBuild);
114 static QString nativePath(const QFile &file);
115 bool packagingNeeded() const;
116 bool isFileNewerThan(const QString &filePath,
117 const QDateTime &timeStamp) const;
118 void raiseError(const QString &shortMsg,
119 const QString &detailedMsg = QString());
120 QString buildDirectory() const;
121 MaemoDeployStep * deployStep() const;
122 void checkProjectName();
123 void adaptRulesFile(const QString &rulesFilePath);
124 void addWorkaroundForHarmattanBug(QByteArray &rulesFileContent,
125 int &insertPos, const MaemoDeployableListModel *model,
126 const QString &desktopFileDir);
127 void addSedCmdToRulesFile(QByteArray &rulesFileContent, int &insertPos,
128 const QString &desktopFilePath, const QByteArray &oldString,
129 const QByteArray &newString);
130 static QString replaceDots(const QString &name);
131 static QString rpmBuildDir(const Qt4BuildConfiguration *bc);
133 static const QLatin1String CreatePackageId;
135 bool m_packagingEnabled;
136 const Qt4BuildConfiguration *m_lastBuildConfig;
139 } // namespace Internal
140 } // namespace Qt4ProjectManager
142 #endif // MAEMOPACKAGECREATIONSTEP_H