1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of Qt Creator.
7 **
8 ** Commercial License Usage
9 ** Licensees holding valid commercial Qt licenses may use this file in
10 ** accordance with the commercial license agreement provided with the
11 ** Software or, alternatively, in accordance with the terms contained in
12 ** a written agreement between you and The Qt Company. For licensing terms
13 ** and conditions see https://www.qt.io/terms-conditions. For further
14 ** information use the contact form at https://www.qt.io/contact-us.
15 **
16 ** GNU General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU
18 ** General Public License version 3 as published by the Free Software
19 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
20 ** included in the packaging of this file. Please review the following
21 ** information to ensure the GNU General Public License requirements will
22 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
23 **
24 ****************************************************************************/
25 
26 #pragma once
27 
28 #include "qbsprojectmanager_global.h"
29 
30 #include "qbsproject.h"
31 
32 #include <projectexplorer/buildaspects.h>
33 #include <projectexplorer/buildconfiguration.h>
34 #include <qtsupport/baseqtversion.h>
35 #include <qtsupport/qtbuildaspects.h>
36 
37 namespace ProjectExplorer { class BuildStep; }
38 
39 namespace QbsProjectManager {
40 namespace Internal {
41 
42 class QbsBuildStep;
43 
44 class QbsBuildStepData
45 {
46 public:
47     QString command;
48     bool dryRun = false;
49     bool keepGoing = false;
50     bool forceProbeExecution = false;
51     bool showCommandLines = false;
52     bool noInstall = false;
53     bool noBuild = false;
54     bool cleanInstallRoot = false;
55     bool isInstallStep = false;
56     int jobCount = 0;
57     Utils::FilePath installRoot;
58 };
59 
60 class QbsBuildConfiguration final : public ProjectExplorer::BuildConfiguration
61 {
62     Q_OBJECT
63 
64     friend class ProjectExplorer::BuildConfigurationFactory;
65     QbsBuildConfiguration(ProjectExplorer::Target *target, Utils::Id id);
66     ~QbsBuildConfiguration() final;
67 
68 public:
69     ProjectExplorer::BuildSystem *buildSystem() const final;
70 
71     QbsBuildStep *qbsStep() const;
72     QVariantMap qbsConfiguration() const;
73 
74     BuildType buildType() const override;
75 
76     void setChangedFiles(const QStringList &files);
77     QStringList changedFiles() const;
78 
79     void setActiveFileTags(const QStringList &fileTags);
80     QStringList activeFileTags() const;
81 
82     void setProducts(const QStringList &products);
83     QStringList products() const;
84 
85     QString configurationName() const;
86     QString equivalentCommandLine(const QbsBuildStepData &stepData) const;
87 
88     Utils::TriState qmlDebuggingSetting() const;
89     Utils::TriState qtQuickCompilerSetting() const;
90     Utils::TriState separateDebugInfoSetting() const;
91 
92 signals:
93     void qbsConfigurationChanged();
94 
95 private:
96     bool fromMap(const QVariantMap &map) override;
97     void restrictNextBuild(const ProjectExplorer::RunConfiguration *rc) override;
98     void triggerReparseIfActive();
99 
100     QStringList m_changedFiles;
101     QStringList m_activeFileTags;
102     QStringList m_products;
103     Utils::StringAspect *m_configurationName = nullptr;
104     QbsBuildSystem *m_buildSystem = nullptr;
105 };
106 
107 class QbsBuildConfigurationFactory final : public ProjectExplorer::BuildConfigurationFactory
108 {
109 public:
110     QbsBuildConfigurationFactory();
111 
112 private:
113     ProjectExplorer::BuildInfo createBuildInfo(ProjectExplorer::BuildConfiguration::BuildType type) const;
114 };
115 
116 } // namespace Internal
117 } // namespace QbsProjectManager
118