CppTools: Add target type information to project part

Let project managers store information whether a project part
belongs to an executable or a library and use this information
inside the AutoTest plugin.
This information will help to determine which targets are
relevant for the execution of tests.

Change-Id: I93b42797bf55225425398dc83aecea3c99eea290
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Christian Stenger
2017-08-29 12:11:27 +02:00
parent 8288eadac6
commit e255baaa8f
14 changed files with 50 additions and 1 deletions

View File

@@ -154,6 +154,18 @@ QString Utils::toString(ProjectPart::QtVersion qtVersion)
return QString();
}
QString Utils::toString(ProjectPart::BuildTargetType buildTargetType)
{
#define CASE_BUILDTARGETTYPE(x) case ProjectPart::x: return QLatin1String(#x)
switch (buildTargetType) {
CASE_BUILDTARGETTYPE(Unknown);
CASE_BUILDTARGETTYPE(Executable);
CASE_BUILDTARGETTYPE(Library);
}
#undef CASE_BUILDTARGETTYPE
return QString();
}
QString Utils::toString(ProjectFile::Kind kind)
{
return QString::fromLatin1(projectFileKindToText(kind));
@@ -483,6 +495,7 @@ void Dumper::dumpProjectInfos( const QList<ProjectInfo> &projectInfos)
m_out << i3 << "Project Name : " << projectName << "\n";
m_out << i3 << "Project File : " << projectFilePath << "\n";
m_out << i3 << "Selected For Building: " << part->selectedForBuilding << "\n";
m_out << i3 << "Build Target Type : " << Utils::toString(part->buildTargetType) << "\n";
m_out << i3 << "Lanugage Version : " << Utils::toString(part->languageVersion)<<"\n";
m_out << i3 << "Lanugage Extensions : " << Utils::toString(part->languageExtensions)
<< "\n";

View File

@@ -50,6 +50,7 @@ struct CPPTOOLS_EXPORT Utils
static QString toString(CppTools::ProjectPart::LanguageVersion languageVersion);
static QString toString(CppTools::ProjectPart::LanguageExtensions languageExtension);
static QString toString(CppTools::ProjectPart::QtVersion qtVersion);
static QString toString(CppTools::ProjectPart::BuildTargetType buildTargetType);
static QString toString(const QVector<CppTools::ProjectFile> &projectFiles);
static QString toString(CppTools::ProjectFile::Kind kind);
static QString toString(CPlusPlus::Kind kind);

View File

@@ -186,6 +186,7 @@ static ProjectPart::Ptr projectPartFromRawProjectPart(const RawProjectPart &rawP
part->projectFileColumn = rawProjectPart.projectFileColumn;
part->callGroupId = rawProjectPart.callGroupId;
part->buildSystemTarget = rawProjectPart.buildSystemTarget;
part->buildTargetType = rawProjectPart.buildTargetType;
part->qtVersion = rawProjectPart.qtVersion;
part->projectMacros = rawProjectPart.projectMacros;
part->headerPaths = rawProjectPart.headerPaths;

View File

@@ -133,4 +133,9 @@ void RawProjectPart::setFlagsForCxx(const RawProjectPartFlags &flags)
flagsForCxx = flags;
}
void RawProjectPart::setBuildTargetType(ProjectPart::BuildTargetType type)
{
buildTargetType = type;
}
} // namespace CppTools

View File

@@ -78,6 +78,7 @@ public:
void setFlagsForC(const RawProjectPartFlags &flags);
void setFlagsForCxx(const RawProjectPartFlags &flags);
void setBuildTargetType(ProjectPart::BuildTargetType type);
public:
QString displayName;
QString projectFile;
@@ -97,6 +98,7 @@ public:
QStringList files;
FileClassifier fileClassifier;
ProjectPart::BuildTargetType buildTargetType = ProjectPart::BuildTargetType::Unknown;
};
using RawProjectParts = QVector<RawProjectPart>;

View File

@@ -91,6 +91,12 @@ public:
WordWidth64Bit,
};
enum BuildTargetType {
Unknown,
Executable,
Library
};
using Ptr = QSharedPointer<ProjectPart>;
public:
@@ -134,6 +140,7 @@ public:
ProjectExplorer::Macros toolChainMacros;
ToolChainWordWidth toolChainWordWidth = WordWidth32Bit;
QString toolChainTargetTriple;
BuildTargetType buildTargetType = Unknown;
};
} // namespace CppTools