Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
0d4fdd29
Commit
0d4fdd29
authored
Mar 16, 2010
by
dt
Browse files
Use a type enum instead of duplicating functions between build and clean
That is e.g. buildSteps() and cleanSteps() --> steps(type)
parent
10c3240e
Changes
25
Hide whitespace changes
Inline
Side-by-side
src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
View file @
0d4fdd29
...
...
@@ -213,10 +213,10 @@ CMakeBuildConfiguration *CMakeBuildConfigurationFactory::create(ProjectExplorer:
bc
->
setDisplayName
(
buildConfigurationName
);
MakeStep
*
makeStep
=
new
MakeStep
(
bc
);
bc
->
insert
Build
Step
(
0
,
makeStep
);
bc
->
insertStep
(
ProjectExplorer
::
Build
,
0
,
makeStep
);
MakeStep
*
cleanMakeStep
=
new
MakeStep
(
bc
);
bc
->
insert
Clean
Step
(
0
,
cleanMakeStep
);
bc
->
insertStep
(
ProjectExplorer
::
Clean
,
0
,
cleanMakeStep
);
cleanMakeStep
->
setAdditionalArguments
(
QStringList
()
<<
"clean"
);
cleanMakeStep
->
setClean
(
true
);
...
...
src/plugins/cmakeprojectmanager/cmakeproject.cpp
View file @
0d4fdd29
...
...
@@ -523,7 +523,8 @@ bool CMakeProject::fromMap(const QVariantMap &map)
return
false
;
if
(
!
hasUserFile
&&
hasBuildTarget
(
"all"
))
{
MakeStep
*
makeStep
(
qobject_cast
<
MakeStep
*>
(
activeTarget
()
->
activeBuildConfiguration
()
->
buildSteps
().
at
(
0
)));
MakeStep
*
makeStep
=
qobject_cast
<
MakeStep
*>
(
activeTarget
()
->
activeBuildConfiguration
()
->
steps
(
ProjectExplorer
::
Build
).
at
(
0
));
Q_ASSERT
(
makeStep
);
makeStep
->
setBuildTarget
(
"all"
,
true
);
}
...
...
src/plugins/cmakeprojectmanager/cmaketarget.cpp
View file @
0d4fdd29
...
...
@@ -32,6 +32,7 @@
#include "cmakeopenprojectwizard.h"
#include "cmakeproject.h"
#include "cmakerunconfiguration.h"
#include "cmakebuildconfiguration.h"
#include <QtGui/QApplication>
#include <QtGui/QStyle>
...
...
@@ -168,10 +169,10 @@ CMakeTarget *CMakeTargetFactory::create(ProjectExplorer::Project *parent, const
bc
->
setDisplayName
(
"all"
);
// Now create a standard build configuration
bc
->
insert
Build
Step
(
0
,
new
MakeStep
(
bc
));
bc
->
insertStep
(
ProjectExplorer
::
Build
,
0
,
new
MakeStep
(
bc
));
MakeStep
*
cleanMakeStep
=
new
MakeStep
(
bc
);
bc
->
insert
Clean
Step
(
0
,
cleanMakeStep
);
bc
->
insertStep
(
ProjectExplorer
::
Clean
,
0
,
cleanMakeStep
);
cleanMakeStep
->
setAdditionalArguments
(
QStringList
()
<<
"clean"
);
cleanMakeStep
->
setClean
(
true
);
...
...
src/plugins/cmakeprojectmanager/makestep.cpp
View file @
0d4fdd29
...
...
@@ -317,41 +317,42 @@ MakeStepFactory::~MakeStepFactory()
{
}
bool
MakeStepFactory
::
canCreate
(
BuildConfiguration
*
parent
,
const
QString
&
id
)
const
bool
MakeStepFactory
::
canCreate
(
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
const
QString
&
id
)
const
{
Q_UNUSED
(
type
)
if
(
!
qobject_cast
<
CMakeBuildConfiguration
*>
(
parent
))
return
false
;
return
QLatin1String
(
MS_ID
)
==
id
;
}
BuildStep
*
MakeStepFactory
::
create
(
BuildConfiguration
*
parent
,
const
QString
&
id
)
BuildStep
*
MakeStepFactory
::
create
(
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
const
QString
&
id
)
{
if
(
!
canCreate
(
parent
,
id
))
if
(
!
canCreate
(
parent
,
type
,
id
))
return
0
;
return
new
MakeStep
(
parent
);
}
bool
MakeStepFactory
::
canClone
(
BuildConfiguration
*
parent
,
BuildStep
*
source
)
const
bool
MakeStepFactory
::
canClone
(
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
BuildStep
*
source
)
const
{
return
canCreate
(
parent
,
source
->
id
());
return
canCreate
(
parent
,
type
,
source
->
id
());
}
BuildStep
*
MakeStepFactory
::
clone
(
BuildConfiguration
*
parent
,
BuildStep
*
source
)
BuildStep
*
MakeStepFactory
::
clone
(
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
BuildStep
*
source
)
{
if
(
!
canClone
(
parent
,
source
))
if
(
!
canClone
(
parent
,
type
,
source
))
return
0
;
return
new
MakeStep
(
parent
,
static_cast
<
MakeStep
*>
(
source
));
}
bool
MakeStepFactory
::
canRestore
(
BuildConfiguration
*
parent
,
const
QVariantMap
&
map
)
const
bool
MakeStepFactory
::
canRestore
(
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
const
QVariantMap
&
map
)
const
{
QString
id
(
ProjectExplorer
::
idFromMap
(
map
));
return
canCreate
(
parent
,
id
);
return
canCreate
(
parent
,
type
,
id
);
}
BuildStep
*
MakeStepFactory
::
restore
(
BuildConfiguration
*
parent
,
const
QVariantMap
&
map
)
BuildStep
*
MakeStepFactory
::
restore
(
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
const
QVariantMap
&
map
)
{
if
(
!
canRestore
(
parent
,
map
))
if
(
!
canRestore
(
parent
,
type
,
map
))
return
0
;
MakeStep
*
bs
(
new
MakeStep
(
parent
));
if
(
bs
->
fromMap
(
map
))
...
...
@@ -360,8 +361,9 @@ BuildStep *MakeStepFactory::restore(BuildConfiguration *parent, const QVariantMa
return
0
;
}
QStringList
MakeStepFactory
::
availableCreationIds
(
ProjectExplorer
::
BuildConfiguration
*
parent
)
const
QStringList
MakeStepFactory
::
availableCreationIds
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
)
const
{
Q_UNUSED
(
type
)
if
(
!
qobject_cast
<
CMakeBuildConfiguration
*>
(
parent
))
return
QStringList
();
return
QStringList
()
<<
QLatin1String
(
MS_ID
);
...
...
src/plugins/cmakeprojectmanager/makestep.h
View file @
0d4fdd29
...
...
@@ -119,14 +119,14 @@ public:
explicit
MakeStepFactory
(
QObject
*
parent
=
0
);
virtual
~
MakeStepFactory
();
virtual
bool
canCreate
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
const
QString
&
id
)
const
;
virtual
ProjectExplorer
::
BuildStep
*
create
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
const
QString
&
id
);
virtual
bool
canClone
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
ProjectExplorer
::
BuildStep
*
source
)
const
;
virtual
ProjectExplorer
::
BuildStep
*
clone
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
ProjectExplorer
::
BuildStep
*
source
);
virtual
bool
canRestore
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
const
QVariantMap
&
map
)
const
;
virtual
ProjectExplorer
::
BuildStep
*
restore
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
const
QVariantMap
&
map
);
virtual
QStringList
availableCreationIds
(
ProjectExplorer
::
BuildConfiguration
*
bc
)
const
;
virtual
bool
canCreate
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
const
QString
&
id
)
const
;
virtual
ProjectExplorer
::
BuildStep
*
create
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
const
QString
&
id
);
virtual
bool
canClone
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
ProjectExplorer
::
BuildStep
*
source
)
const
;
virtual
ProjectExplorer
::
BuildStep
*
clone
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
ProjectExplorer
::
BuildStep
*
source
);
virtual
bool
canRestore
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
const
QVariantMap
&
map
)
const
;
virtual
ProjectExplorer
::
BuildStep
*
restore
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
const
QVariantMap
&
map
);
virtual
QStringList
availableCreationIds
(
ProjectExplorer
::
BuildConfiguration
*
bc
,
ProjectExplorer
::
StepType
type
)
const
;
virtual
QString
displayNameForId
(
const
QString
&
id
)
const
;
};
...
...
src/plugins/genericprojectmanager/genericbuildconfiguration.cpp
View file @
0d4fdd29
...
...
@@ -175,7 +175,7 @@ BuildConfiguration *GenericBuildConfigurationFactory::create(ProjectExplorer::Ta
bc
->
setDisplayName
(
buildConfigurationName
);
GenericMakeStep
*
makeStep
=
new
GenericMakeStep
(
bc
);
bc
->
insert
Build
Step
(
0
,
makeStep
);
bc
->
insertStep
(
ProjectExplorer
::
Build
,
0
,
makeStep
);
makeStep
->
setBuildTarget
(
"all"
,
/* on = */
true
);
target
->
addBuildConfiguration
(
bc
);
// also makes the name unique...
...
...
src/plugins/genericprojectmanager/genericmakestep.cpp
View file @
0d4fdd29
...
...
@@ -307,32 +307,38 @@ GenericMakeStepFactory::~GenericMakeStepFactory()
{
}
bool
GenericMakeStepFactory
::
canCreate
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
const
QString
&
id
)
const
bool
GenericMakeStepFactory
::
canCreate
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
const
QString
&
id
)
const
{
Q_UNUSED
(
type
)
if
(
!
qobject_cast
<
GenericBuildConfiguration
*>
(
parent
))
return
false
;
return
id
==
QLatin1String
(
GENERIC_MS_ID
);
}
ProjectExplorer
::
BuildStep
*
GenericMakeStepFactory
::
create
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
const
QString
&
id
)
{
if
(
!
canCreate
(
parent
,
id
))
if
(
!
canCreate
(
parent
,
type
,
id
))
return
0
;
return
new
GenericMakeStep
(
parent
);
}
bool
GenericMakeStepFactory
::
canClone
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
ProjectExplorer
::
BuildStep
*
source
)
const
{
const
QString
id
(
source
->
id
());
return
canCreate
(
parent
,
id
);
return
canCreate
(
parent
,
type
,
id
);
}
ProjectExplorer
::
BuildStep
*
GenericMakeStepFactory
::
clone
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
ProjectExplorer
::
BuildStep
*
source
)
{
if
(
!
canClone
(
parent
,
source
))
if
(
!
canClone
(
parent
,
type
,
source
))
return
0
;
GenericMakeStep
*
old
(
qobject_cast
<
GenericMakeStep
*>
(
source
));
Q_ASSERT
(
old
);
...
...
@@ -340,16 +346,18 @@ ProjectExplorer::BuildStep *GenericMakeStepFactory::clone(ProjectExplorer::Build
}
bool
GenericMakeStepFactory
::
canRestore
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
const
QVariantMap
&
map
)
const
{
QString
id
(
ProjectExplorer
::
idFromMap
(
map
));
return
canCreate
(
parent
,
id
);
return
canCreate
(
parent
,
type
,
id
);
}
ProjectExplorer
::
BuildStep
*
GenericMakeStepFactory
::
restore
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
const
QVariantMap
&
map
)
{
if
(
!
canRestore
(
parent
,
map
))
if
(
!
canRestore
(
parent
,
type
,
map
))
return
0
;
GenericMakeStep
*
bs
(
new
GenericMakeStep
(
parent
));
if
(
bs
->
fromMap
(
map
))
...
...
@@ -358,8 +366,10 @@ ProjectExplorer::BuildStep *GenericMakeStepFactory::restore(ProjectExplorer::Bui
return
0
;
}
QStringList
GenericMakeStepFactory
::
availableCreationIds
(
ProjectExplorer
::
BuildConfiguration
*
parent
)
const
QStringList
GenericMakeStepFactory
::
availableCreationIds
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
)
const
{
Q_UNUSED
(
type
)
if
(
!
qobject_cast
<
GenericBuildConfiguration
*>
(
parent
))
return
QStringList
();
return
QStringList
()
<<
QLatin1String
(
GENERIC_MS_ID
);
...
...
src/plugins/genericprojectmanager/genericmakestep.h
View file @
0d4fdd29
...
...
@@ -113,19 +113,27 @@ public:
explicit
GenericMakeStepFactory
(
QObject
*
parent
=
0
);
virtual
~
GenericMakeStepFactory
();
virtual
bool
canCreate
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
const
QString
&
id
)
const
;
virtual
bool
canCreate
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
const
QString
&
id
)
const
;
virtual
ProjectExplorer
::
BuildStep
*
create
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
const
QString
&
id
);
virtual
bool
canClone
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
ProjectExplorer
::
BuildStep
*
source
)
const
;
virtual
ProjectExplorer
::
BuildStep
*
clone
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
ProjectExplorer
::
BuildStep
*
source
);
virtual
bool
canRestore
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
const
QVariantMap
&
map
)
const
;
virtual
ProjectExplorer
::
BuildStep
*
restore
(
ProjectExplorer
::
BuildConfiguration
*
parent
,
ProjectExplorer
::
StepType
type
,
const
QVariantMap
&
map
);
virtual
QStringList
availableCreationIds
(
ProjectExplorer
::
BuildConfiguration
*
bc
)
const
;
virtual
QStringList
availableCreationIds
(
ProjectExplorer
::
BuildConfiguration
*
bc
,
ProjectExplorer
::
StepType
type
)
const
;
virtual
QString
displayNameForId
(
const
QString
&
id
)
const
;
};
...
...
src/plugins/genericprojectmanager/generictarget.cpp
View file @
0d4fdd29
...
...
@@ -137,7 +137,7 @@ GenericTarget *GenericTargetFactory::create(ProjectExplorer::Project *parent, co
bc
->
setDisplayName
(
"all"
);
GenericMakeStep
*
makeStep
=
new
GenericMakeStep
(
bc
);
bc
->
insert
Build
Step
(
0
,
makeStep
);
bc
->
insertStep
(
ProjectExplorer
::
Build
,
0
,
makeStep
);
makeStep
->
setBuildTarget
(
"all"
,
/* on = */
true
);
...
...
src/plugins/projectexplorer/buildconfiguration.cpp
View file @
0d4fdd29
...
...
@@ -39,20 +39,20 @@ using namespace ProjectExplorer;
namespace
{
IBuildStepFactory
*
findCloneFactory
(
BuildConfiguration
*
parent
,
BuildStep
*
source
)
IBuildStepFactory
*
findCloneFactory
(
BuildConfiguration
*
parent
,
StepType
type
,
BuildStep
*
source
)
{
QList
<
IBuildStepFactory
*>
factories
=
ExtensionSystem
::
PluginManager
::
instance
()
->
getObjects
<
IBuildStepFactory
>
();
foreach
(
IBuildStepFactory
*
factory
,
factories
)
if
(
factory
->
canClone
(
parent
,
source
))
if
(
factory
->
canClone
(
parent
,
type
,
source
))
return
factory
;
return
0
;
}
IBuildStepFactory
*
findRestoreFactory
(
BuildConfiguration
*
parent
,
const
QVariantMap
&
map
)
IBuildStepFactory
*
findRestoreFactory
(
BuildConfiguration
*
parent
,
StepType
type
,
const
QVariantMap
&
map
)
{
QList
<
IBuildStepFactory
*>
factories
=
ExtensionSystem
::
PluginManager
::
instance
()
->
getObjects
<
IBuildStepFactory
>
();
foreach
(
IBuildStepFactory
*
factory
,
factories
)
if
(
factory
->
canRestore
(
parent
,
map
))
if
(
factory
->
canRestore
(
parent
,
type
,
map
))
return
factory
;
return
0
;
}
...
...
@@ -85,19 +85,20 @@ BuildConfiguration::BuildConfiguration(Target *target, BuildConfiguration *sourc
BuildConfiguration
::~
BuildConfiguration
()
{
qDeleteAll
(
m_buildSteps
);
qDeleteAll
(
m_cleanSteps
);
for
(
int
i
=
0
;
i
<
LastStepType
;
++
i
)
{
qDeleteAll
(
m_steps
[
i
]);
}
}
QVariantMap
BuildConfiguration
::
toMap
()
const
{
QVariantMap
map
(
ProjectConfiguration
::
toMap
());
map
.
insert
(
QLatin1String
(
BUILD_STEPS_COUNT_KEY
),
m_
buildSteps
.
count
());
for
(
int
i
=
0
;
i
<
m_
buildSteps
.
count
();
++
i
)
map
.
insert
(
QString
::
fromLatin1
(
BUILD_STEPS_PREFIX
)
+
QString
::
number
(
i
),
m_
buildSteps
.
at
(
i
)
->
toMap
());
map
.
insert
(
QLatin1String
(
CLEAN_STEPS_COUNT_KEY
),
m_
cleanSteps
.
count
());
for
(
int
i
=
0
;
i
<
m_
cleanSteps
.
count
();
++
i
)
map
.
insert
(
QString
::
fromLatin1
(
CLEAN_STEPS_PREFIX
)
+
QString
::
number
(
i
),
m_
cleanSteps
.
at
(
i
)
->
toMap
());
map
.
insert
(
QLatin1String
(
BUILD_STEPS_COUNT_KEY
),
m_
steps
[
Build
]
.
count
());
for
(
int
i
=
0
;
i
<
m_
steps
[
Build
]
.
count
();
++
i
)
map
.
insert
(
QString
::
fromLatin1
(
BUILD_STEPS_PREFIX
)
+
QString
::
number
(
i
),
m_
steps
[
Build
]
.
at
(
i
)
->
toMap
());
map
.
insert
(
QLatin1String
(
CLEAN_STEPS_COUNT_KEY
),
m_
steps
[
Clean
]
.
count
());
for
(
int
i
=
0
;
i
<
m_
steps
[
Clean
]
.
count
();
++
i
)
map
.
insert
(
QString
::
fromLatin1
(
CLEAN_STEPS_PREFIX
)
+
QString
::
number
(
i
),
m_
steps
[
Clean
]
.
at
(
i
)
->
toMap
());
map
.
insert
(
QLatin1String
(
CLEAR_SYSTEM_ENVIRONMENT_KEY
),
m_clearSystemEnvironment
);
map
.
insert
(
QLatin1String
(
USER_ENVIRONMENT_CHANGES_KEY
),
EnvironmentItem
::
toStringList
(
m_userEnvironmentChanges
));
...
...
@@ -107,21 +108,15 @@ QVariantMap BuildConfiguration::toMap() const
void
BuildConfiguration
::
cloneSteps
(
BuildConfiguration
*
source
)
{
Q_ASSERT
(
source
);
foreach
(
BuildStep
*
originalbs
,
source
->
buildSteps
())
{
IBuildStepFactory
*
factory
(
findCloneFactory
(
this
,
originalbs
));
if
(
!
factory
)
continue
;
BuildStep
*
clonebs
(
factory
->
clone
(
this
,
originalbs
));
if
(
clonebs
)
m_buildSteps
.
append
(
clonebs
);
}
foreach
(
BuildStep
*
originalcs
,
source
->
cleanSteps
())
{
IBuildStepFactory
*
factory
=
findCloneFactory
(
this
,
originalcs
);
if
(
!
factory
)
continue
;
BuildStep
*
clonecs
=
factory
->
clone
(
this
,
originalcs
);
if
(
clonecs
)
m_cleanSteps
.
append
(
clonecs
);
for
(
int
i
=
0
;
i
<
LastStepType
;
++
i
)
{
foreach
(
BuildStep
*
originalbs
,
source
->
steps
(
StepType
(
i
)))
{
IBuildStepFactory
*
factory
(
findCloneFactory
(
this
,
StepType
(
i
),
originalbs
));
if
(
!
factory
)
continue
;
BuildStep
*
clonebs
(
factory
->
clone
(
this
,
StepType
(
i
),
originalbs
));
if
(
clonebs
)
m_steps
[
i
].
append
(
clonebs
);
}
}
}
...
...
@@ -139,17 +134,17 @@ bool BuildConfiguration::fromMap(const QVariantMap &map)
qWarning
()
<<
"No buildstep data found (continuing)."
;
continue
;
}
IBuildStepFactory
*
factory
(
findRestoreFactory
(
this
,
bsData
));
IBuildStepFactory
*
factory
(
findRestoreFactory
(
this
,
Build
,
bsData
));
if
(
!
factory
)
{
qWarning
()
<<
"No factory for buildstep found (continuing)."
;
continue
;
}
BuildStep
*
bs
(
factory
->
restore
(
this
,
bsData
));
BuildStep
*
bs
(
factory
->
restore
(
this
,
Build
,
bsData
));
if
(
!
bs
)
{
qWarning
()
<<
"Restoration of buildstep failed (continuing)."
;
continue
;
}
insert
Build
Step
(
m_b
uild
Steps
.
count
(),
bs
);
insertStep
(
B
uild
,
m_steps
[
Build
]
.
count
(),
bs
);
}
maxI
=
map
.
value
(
QLatin1String
(
CLEAN_STEPS_COUNT_KEY
),
0
).
toInt
();
...
...
@@ -161,17 +156,17 @@ bool BuildConfiguration::fromMap(const QVariantMap &map)
qWarning
()
<<
"No cleanstep data found for (continuing)."
;
continue
;
}
IBuildStepFactory
*
factory
(
findRestoreFactory
(
this
,
bsData
));
IBuildStepFactory
*
factory
(
findRestoreFactory
(
this
,
Clean
,
bsData
));
if
(
!
factory
)
{
qWarning
()
<<
"No factory for cleanstep found (continuing)."
;
continue
;
}
BuildStep
*
bs
(
factory
->
restore
(
this
,
bsData
));
BuildStep
*
bs
(
factory
->
restore
(
this
,
Clean
,
bsData
));
if
(
!
bs
)
{
qWarning
()
<<
"Restoration of cleanstep failed (continuing)."
;
continue
;
}
insert
Clean
Step
(
m_c
lean
Steps
.
count
(),
bs
);
insertStep
(
C
lean
,
m_steps
[
Clean
]
.
count
(),
bs
);
}
m_clearSystemEnvironment
=
map
.
value
(
QLatin1String
(
CLEAR_SYSTEM_ENVIRONMENT_KEY
)).
toBool
();
...
...
@@ -180,51 +175,32 @@ bool BuildConfiguration::fromMap(const QVariantMap &map)
return
true
;
}
QList
<
BuildStep
*>
BuildConfiguration
::
buildSteps
(
)
const
QList
<
BuildStep
*>
BuildConfiguration
::
steps
(
StepType
type
)
const
{
return
m_buildSteps
;
Q_ASSERT
(
type
>=
0
&&
type
<
LastStepType
);
return
m_steps
[
type
];
}
void
BuildConfiguration
::
insert
Build
Step
(
int
position
,
BuildStep
*
step
)
void
BuildConfiguration
::
insertStep
(
StepType
type
,
int
position
,
BuildStep
*
step
)
{
m_buildSteps
.
insert
(
position
,
step
);
Q_ASSERT
(
type
>=
0
&&
type
<
LastStepType
);
m_steps
[
type
].
insert
(
position
,
step
);
}
void
BuildConfiguration
::
remove
Build
Step
(
int
position
)
void
BuildConfiguration
::
removeStep
(
StepType
type
,
int
position
)
{
delete
m_buildSteps
.
at
(
position
);
m_buildSteps
.
removeAt
(
position
);
Q_ASSERT
(
type
>=
0
&&
type
<
LastStepType
);
delete
m_steps
[
type
].
at
(
position
);
m_steps
[
type
].
removeAt
(
position
);
}
void
BuildConfiguration
::
move
Build
StepUp
(
int
position
)
void
BuildConfiguration
::
moveStepUp
(
StepType
type
,
int
position
)
{
if
(
position
<=
0
||
m_buildSteps
.
size
()
<=
1
)
Q_ASSERT
(
type
>=
0
&&
type
<
LastStepType
);
if
(
position
<=
0
||
m_steps
[
type
].
size
()
<=
1
)
return
;
m_buildSteps
.
swap
(
position
-
1
,
position
);
}
QList
<
BuildStep
*>
BuildConfiguration
::
cleanSteps
()
const
{
return
m_cleanSteps
;
}
m_steps
[
type
].
swap
(
position
-
1
,
position
);
void
BuildConfiguration
::
insertCleanStep
(
int
position
,
BuildStep
*
step
)
{
m_cleanSteps
.
insert
(
position
,
step
);
}
void
BuildConfiguration
::
removeCleanStep
(
int
position
)
{
delete
m_cleanSteps
.
at
(
position
);
m_cleanSteps
.
removeAt
(
position
);
}
void
BuildConfiguration
::
moveCleanStepUp
(
int
position
)
{
if
(
position
<=
0
||
m_cleanSteps
.
size
()
<=
1
)
return
;
m_cleanSteps
.
swap
(
position
-
1
,
position
);
}
Target
*
BuildConfiguration
::
target
()
const
...
...
src/plugins/projectexplorer/buildconfiguration.h
View file @
0d4fdd29
...
...
@@ -53,15 +53,10 @@ public:
// ctors are protected
virtual
~
BuildConfiguration
();
QList
<
BuildStep
*>
buildSteps
()
const
;
void
insertBuildStep
(
int
position
,
BuildStep
*
step
);
void
removeBuildStep
(
int
position
);
void
moveBuildStepUp
(
int
position
);
QList
<
BuildStep
*>
cleanSteps
()
const
;
void
insertCleanStep
(
int
position
,
BuildStep
*
step
);
void
removeCleanStep
(
int
position
);
void
moveCleanStepUp
(
int
position
);
QList
<
BuildStep
*>
steps
(
StepType
type
)
const
;
void
insertStep
(
StepType
type
,
int
position
,
BuildStep
*
step
);
void
removeStep
(
StepType
type
,
int
position
);
void
moveStepUp
(
StepType
type
,
int
position
);
virtual
QString
buildDirectory
()
const
=
0
;
...
...
@@ -90,8 +85,7 @@ protected:
virtual
bool
fromMap
(
const
QVariantMap
&
map
);
private:
QList
<
BuildStep
*>
m_buildSteps
;
QList
<
BuildStep
*>
m_cleanSteps
;
QList
<
BuildStep
*>
m_steps
[
LastStepType
];
Target
*
m_target
;
bool
m_clearSystemEnvironment
;
...
...
src/plugins/projectexplorer/buildmanager.cpp
View file @
0d4fdd29
...
...
@@ -401,7 +401,7 @@ void BuildManager::buildProjects(const QList<BuildConfiguration *> &configuratio
{
QList
<
BuildStep
*>
steps
;
foreach
(
BuildConfiguration
*
bc
,
configurations
)
steps
.
append
(
bc
->
buildSteps
(
));
steps
.
append
(
bc
->
steps
(
Build
));
bool
success
=
buildQueueAppend
(
steps
);
if
(
!
success
)
{
...
...
@@ -418,7 +418,7 @@ void BuildManager::cleanProjects(const QList<BuildConfiguration *> &configuratio
{
QList
<
BuildStep
*>
steps
;
foreach
(
BuildConfiguration
*
bc
,
configurations
)
steps
.
append
(
bc
->
cleanSteps
(
));
steps
.
append
(
bc
->
steps
(
Clean
));
bool
success
=
buildQueueAppend
(
steps
);
if
(
!
success
)
{
...
...
src/plugins/projectexplorer/buildsettingspropertiespage.cpp
View file @
0d4fdd29
...
...
@@ -292,8 +292,8 @@ void BuildSettingsWidget::updateBuildSettings()
BuildConfigWidget
*
generalConfigWidget
=
m_target
->
project
()
->
createConfigWidget
();
addSubWidget
(
generalConfigWidget
->
displayName
(),
generalConfigWidget
);
addSubWidget
(
tr
(
"Build Steps"
),
new
BuildStepsPage
(
m_target
,
false
));
addSubWidget
(
tr
(
"Clean Steps"
),
new
BuildStepsPage
(
m_target
,
true
));
addSubWidget
(
tr
(
"Build Steps"
),
new
BuildStepsPage
(
m_target
,
Build
));
addSubWidget
(
tr
(
"Clean Steps"
),
new
BuildStepsPage
(
m_target
,
Clean
));
QList
<
BuildConfigWidget
*>
subConfigWidgets
=
m_target
->
project
()
->
subConfigWidgets
();
foreach
(
BuildConfigWidget
*
subConfigWidget
,
subConfigWidgets
)
...
...
src/plugins/projectexplorer/buildstep.h
View file @
0d4fdd29
...
...
@@ -38,6 +38,11 @@
#include <QtGui/QWidget>
namespace
ProjectExplorer
{
enum
StepType
{
Build
=
0
,
Clean
=
1
,
LastStepType
=
2
};
class
BuildConfiguration
;
/*
...
...
@@ -122,17 +127,17 @@ public:
virtual
~
IBuildStepFactory
();
// used to show the list of possible additons to a target, returns a list of types
virtual
QStringList
availableCreationIds
(
BuildConfiguration
*
parent
)
const
=
0
;
virtual
QStringList
availableCreationIds
(
BuildConfiguration
*
parent
,
StepType
type
)
const
=
0
;
// used to translate the types to names to display to the user
virtual
QString
displayNameForId
(
const
QString
&
id
)
const
=
0
;
virtual
bool
canCreate
(
BuildConfiguration
*
parent
,
const
QString
&
id
)
const
=
0
;
virtual
BuildStep
*
create
(
BuildConfiguration
*
parent
,
const
QString
&
id
)
=
0
;
virtual
bool
canCreate
(
BuildConfiguration
*
parent
,
StepType
type
,
const
QString
&
id
)
const
=
0
;
virtual
BuildStep
*
create
(
BuildConfiguration
*
parent
,
StepType
type
,
const
QString
&
id
)
=
0
;
// used to recreate the runConfigurations when restoring settings
virtual
bool
canRestore
(
BuildConfiguration
*
parent
,
const
QVariantMap
&
map
)
const
=
0
;
virtual
BuildStep
*
restore
(
BuildConfiguration
*
parent
,
const
QVariantMap
&
map
)
=
0
;
virtual
bool
canClone
(
BuildConfiguration
*
parent
,
BuildStep
*
product
)
const
=
0
;
virtual
BuildStep
*
clone
(
BuildConfiguration
*
parent
,
BuildStep
*
product
)
=
0
;
virtual
bool
canRestore
(
BuildConfiguration
*
parent
,
StepType
type
,
const
QVariantMap
&
map
)
const
=
0
;
virtual
BuildStep
*
restore
(
BuildConfiguration
*
parent
,
StepType
type
,
const
QVariantMap
&
map
)
=
0
;
virtual
bool
canClone
(
BuildConfiguration
*
parent
,
StepType
type
,
BuildStep
*
product
)
const
=
0
;
virtual
BuildStep
*
clone
(
BuildConfiguration
*
parent
,
StepType
type
,
BuildStep
*
product
)
=
0
;
};
class
PROJECTEXPLORER_EXPORT
BuildConfigWidget
...
...
src/plugins/projectexplorer/buildstepspage.cpp
View file @
0d4fdd29
...
...
@@ -46,9 +46,9 @@
using
namespace
ProjectExplorer
;
using
namespace
ProjectExplorer
::
Internal
;
BuildStepsPage
::
BuildStepsPage
(
Target
*
target
,
bool
clean
)
:
BuildStepsPage
::
BuildStepsPage
(
Target
*
target
,
StepType
type
)
:
BuildConfigWidget
(),
m_
clean
(
clean
),
m_
type
(
type
),
m_addButton
(
0
),
m_leftMargin
(
-
1
)
{
...
...
@@ -79,7 +79,10 @@ void BuildStepsPage::updateSummary()