maemopackagecreationstep.h 4.41 KB
Newer Older
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
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of Qt Creator.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** 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 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights.  These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

#ifndef MAEMOPACKAGECREATIONSTEP_H
#define MAEMOPACKAGECREATIONSTEP_H

#include <projectexplorer/buildstep.h>

ck's avatar
ck committed
47
QT_BEGIN_NAMESPACE
48
class QDateTime;
49
class QFile;
ck's avatar
ck committed
50
51
52
class QProcess;
QT_END_NAMESPACE

53
54
55
namespace Qt4ProjectManager {
namespace Internal {

56
class MaemoDeployStep;
ck's avatar
ck committed
57
class MaemoToolChain;
ck's avatar
ck committed
58
class MaemoProFileWrapper;
ck's avatar
ck committed
59
60
class Qt4BuildConfiguration;

61
62
class MaemoPackageCreationStep : public ProjectExplorer::BuildStep
{
63
    Q_OBJECT
64
65
    friend class MaemoPackageCreationFactory;
public:
Tobias Hunger's avatar
Tobias Hunger committed
66
    MaemoPackageCreationStep(ProjectExplorer::BuildStepList *bsl);
67
    ~MaemoPackageCreationStep();
68

69
    QString packageFilePath() const;
70
    bool isPackagingEnabled() const;
ck's avatar
ck committed
71
72
    void setPackagingEnabled(bool enabled) { m_packagingEnabled = enabled; }

73
74
75
    QString versionString(QString *error) const;
    bool setVersionString(const QString &version, QString *error);

76
77
    const MaemoToolChain *maemoToolChain() const;

78
79
80
81
    static bool preparePackagingProcess(QProcess *proc, const MaemoToolChain *tc,
        const QString &workingDir, QString *error);
    static QString packagingCommand(const MaemoToolChain *tc,
        const QString &commandName);
82
    static QString packageName(const ProjectExplorer::Project *project);
83
84
    static QString packageFileName(const ProjectExplorer::Project *project,
        const QString &version);
85
    static bool removeDirectory(const QString &dirPath);
86
87

    static const QLatin1String DefaultVersionNumber;
88

ck's avatar
ck committed
89
90
signals:
    void packageFilePathChanged();
91
    void qtVersionChanged();
ck's avatar
ck committed
92

93
94
private slots:
    void handleBuildOutput();
95
    void handleBuildConfigChanged();
96

97
private:
Tobias Hunger's avatar
Tobias Hunger committed
98
    MaemoPackageCreationStep(ProjectExplorer::BuildStepList *buildConfig,
99
100
                             MaemoPackageCreationStep *other);

ck's avatar
ck committed
101
    void ctor();
102
103
104
105
    virtual bool init();
    virtual void run(QFutureInterface<bool> &fi);
    virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
    virtual bool immutable() const { return true; }
ck's avatar
ck committed
106
107
    virtual QVariantMap toMap() const;
    virtual bool fromMap(const QVariantMap &map);
108

109
    bool createPackage(QProcess *buildProc);
110
    bool copyDebianFiles(bool inSourceBuild);
111
    bool runCommand(QProcess *buildProc, const QString &command);
ck's avatar
ck committed
112
113
    QString maddeRoot() const;
    QString targetRoot() const;
114
    static QString nativePath(const QFile &file);
ck's avatar
ck committed
115
    bool packagingNeeded() const;
116
117
    bool isFileNewerThan(const QString &filePath,
        const QDateTime &timeStamp) const;
118
119
    void raiseError(const QString &shortMsg,
                    const QString &detailedMsg = QString());
120
    QString buildDirectory() const;
ck's avatar
ck committed
121
    QString projectName() const;
122
123
    const Qt4BuildConfiguration *qt4BuildConfiguration() const;
    MaemoDeployStep * deployStep() const;
124
    void checkProjectName();
125
    void addWorkaroundForHarmattanBug(const QString &rulesFilePath);
126

127
    static const QLatin1String CreatePackageId;
128

ck's avatar
ck committed
129
    bool m_packagingEnabled;
130
    const Qt4BuildConfiguration *m_lastBuildConfig;
131
132
133
134
135
136
};

} // namespace Internal
} // namespace Qt4ProjectManager

#endif // MAEMOPACKAGECREATIONSTEP_H