forked from qt-creator/qt-creator
Ensure that target name is relative to build dir and without leading '/'
Fixes: QTCREATORBUG-29349 Change-Id: I7471242cd422a68a2652ff23741d0615380e2e8d Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -183,7 +183,7 @@ QList<ProjectExplorer::BuildTargetInfo> MesonProjectParser::appsTargets() const
|
|||||||
if (target.type == Target::Type::executable) {
|
if (target.type == Target::Type::executable) {
|
||||||
ProjectExplorer::BuildTargetInfo bti;
|
ProjectExplorer::BuildTargetInfo bti;
|
||||||
bti.displayName = target.name;
|
bti.displayName = target.name;
|
||||||
bti.buildKey = Target::fullName(m_srcDir, target);
|
bti.buildKey = Target::fullName(m_buildDir, target);
|
||||||
bti.displayNameUniquifier = bti.buildKey;
|
bti.displayNameUniquifier = bti.buildKey;
|
||||||
bti.targetFilePath = Utils::FilePath::fromString(target.fileName.first());
|
bti.targetFilePath = Utils::FilePath::fromString(target.fileName.first());
|
||||||
bti.workingDirectory = Utils::FilePath::fromString(target.fileName.first()).absolutePath();
|
bti.workingDirectory = Utils::FilePath::fromString(target.fileName.first()).absolutePath();
|
||||||
@@ -237,7 +237,7 @@ void MesonProjectParser::update(const QFuture<MesonProjectParser::ParserData *>
|
|||||||
m_rootNode = std::move(parserData->rootNode);
|
m_rootNode = std::move(parserData->rootNode);
|
||||||
m_targetsNames.clear();
|
m_targetsNames.clear();
|
||||||
for (const Target &target : m_parserResult.targets) {
|
for (const Target &target : m_parserResult.targets) {
|
||||||
m_targetsNames.push_back(Target::fullName(m_srcDir, target));
|
m_targetsNames.push_back(Target::fullName(m_buildDir, target));
|
||||||
}
|
}
|
||||||
addMissingTargets(m_targetsNames);
|
addMissingTargets(m_targetsNames);
|
||||||
m_targetsNames.sort();
|
m_targetsNames.sort();
|
||||||
@@ -253,7 +253,7 @@ ProjectExplorer::RawProjectPart MesonProjectParser::buildRawPart(
|
|||||||
{
|
{
|
||||||
ProjectExplorer::RawProjectPart part;
|
ProjectExplorer::RawProjectPart part;
|
||||||
part.setDisplayName(target.name);
|
part.setDisplayName(target.name);
|
||||||
part.setBuildSystemTarget(Target::fullName(m_srcDir, target));
|
part.setBuildSystemTarget(Target::fullName(m_buildDir, target));
|
||||||
part.setFiles(sources.sources + sources.generatedSources);
|
part.setFiles(sources.sources + sources.generatedSources);
|
||||||
auto flags = splitArgs(sources.parameters);
|
auto flags = splitArgs(sources.parameters);
|
||||||
part.setMacros(flags.macros);
|
part.setMacros(flags.macros);
|
||||||
|
|||||||
@@ -60,15 +60,17 @@ struct Target
|
|||||||
const std::optional<QString> subproject;
|
const std::optional<QString> subproject;
|
||||||
const SourceGroupList sources;
|
const SourceGroupList sources;
|
||||||
|
|
||||||
static inline QString fullName(const Utils::FilePath &srcDir, const Target &target)
|
static inline QString fullName(const Utils::FilePath &buildDir, const Target &target)
|
||||||
{
|
{
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
if (FilePath::fromString((target.fileName.first())).isAbsolutePath()) {
|
auto fname = target.fileName.first();
|
||||||
const auto fname = target.fileName.first().split('/').last();
|
if (FilePath::fromString(fname).isAbsolutePath()) {
|
||||||
QString definedIn = FilePath::fromString(target.definedIn).absolutePath().toString();
|
fname.remove(buildDir.toString());
|
||||||
return definedIn.remove(srcDir.toString()) + '/' + fname;
|
if (fname.startsWith('/'))
|
||||||
|
fname.removeFirst();
|
||||||
|
return fname;
|
||||||
} else {
|
} else {
|
||||||
return target.fileName.first();
|
return fname;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user