Commit 5c23c44e authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Daniel Teske

Qt4PM: Support "Build File" for debug_and_release configurations

Task-number: QTCREATORBUG-106

Change-Id: I9aef17f8b57051ee4b7d22cc4e454d453ea4c821
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent 3815988c
......@@ -183,15 +183,22 @@ bool MakeStep::init()
ProjectExplorer::ToolChain *toolchain = bc->toolChain();
if (bc->subNodeBuild()) {
QString makefile = bc->subNodeBuild()->makefile();
if (!makefile.isEmpty()) {
Qt4ProjectManager::Qt4ProFileNode *subNode = bc->subNodeBuild();
if (subNode) {
QString makefile = subNode->makefile();
if (makefile.isEmpty())
makefile = QLatin1String("Makefile");
if (subNode->isDebugAndRelease()) {
if (bc->buildType() == Qt4BuildConfiguration::Debug)
makefile += QLatin1String(".Debug");
else
makefile += QLatin1String(".Release");
}
if (makefile != QLatin1String("Makefile")) {
Utils::QtcProcess::addArg(&args, QLatin1String("-f"));
Utils::QtcProcess::addArg(&args, makefile);
m_makeFileToCheck = QDir(workingDirectory).filePath(makefile);
} else {
m_makeFileToCheck = QDir(workingDirectory).filePath(QLatin1String("Makefile"));
}
m_makeFileToCheck = QDir(workingDirectory).filePath(makefile);
} else {
if (!bc->makefile().isEmpty()) {
Utils::QtcProcess::addArg(&args, QLatin1String("-f"));
......@@ -209,23 +216,24 @@ bool MakeStep::init()
Utils::QtcProcess::addArg(&args, bc->defaultMakeTarget());
}
if (bc->fileNodeBuild()) {
Qt4ProjectManager::Qt4ProFileNode *proNode = bc->subNodeBuild();
if (!proNode) {
Qt4Project *qt4project = qobject_cast<Qt4Project *>(project());
if (qt4project)
proNode = qt4project->rootQt4ProjectNode();
}
if (proNode) {
QString objectsDir = QDir(pp->workingDirectory()).relativeFilePath(
proNode->objectsDirectory());
if (!objectsDir.isEmpty())
objectsDir += QLatin1Char('/');
QString objectFile = objectsDir +
QFileInfo(bc->fileNodeBuild()->path()).baseName() +
proNode->objectExtension();
Utils::QtcProcess::addArg(&args, objectFile);
if (bc->fileNodeBuild() && subNode) {
QString objectsDir = subNode->objectsDirectory();
if (objectsDir.isEmpty()) {
objectsDir = subNode->buildDir(bc);
if (subNode->isDebugAndRelease()) {
if (bc->buildType() == Qt4BuildConfiguration::Debug)
objectsDir += QLatin1String("/debug");
else
objectsDir += QLatin1String("/release");
}
}
QString relObjectsDir = QDir(pp->workingDirectory()).relativeFilePath(objectsDir);
if (!relObjectsDir.isEmpty())
relObjectsDir += QLatin1Char('/');
QString objectFile = relObjectsDir +
QFileInfo(bc->fileNodeBuild()->path()).baseName() +
subNode->objectExtension();
Utils::QtcProcess::addArg(&args, objectFile);
}
Utils::Environment env = bc->environment();
// Force output to english for the parsers. Do this here and not in the toolchain's
......
......@@ -1469,7 +1469,7 @@ QString Qt4ProFileNode::objectExtension() const
QString Qt4ProFileNode::objectsDirectory() const
{
if (m_varValues[ObjectsDir].isEmpty())
return buildDir();
return QString();
return m_varValues[ObjectsDir].first();
}
......@@ -1571,8 +1571,7 @@ bool Qt4ProFileNode::hasBuildTargets(Qt4ProjectType projectType) const
bool Qt4ProFileNode::isDebugAndRelease() const
{
const QStringList configValues = m_varValues.value(ConfigVar);
return (configValues.contains(QLatin1String("debug_and_release"))
&& configValues.contains(QLatin1String("debug_and_release_target")));
return configValues.contains(QLatin1String("debug_and_release"));
}
Qt4ProjectType Qt4ProFileNode::projectType() const
......
......@@ -427,12 +427,14 @@ void Qt4Manager::handleSubDirContextMenu(Qt4Manager::Action action, bool isFileB
!qt4pro->activeTarget()->activeBuildConfiguration())
return;
if (!m_contextNode || !m_contextFile)
isFileBuild = false;
Qt4BuildConfiguration *bc = qt4pro->activeTarget()->activeQt4BuildConfiguration();
if (m_contextNode != 0 && m_contextNode != qt4pro->rootProjectNode())
if (m_contextNode != 0 && (m_contextNode != qt4pro->rootProjectNode() || isFileBuild))
if (Qt4ProFileNode *profile = qobject_cast<Qt4ProFileNode *>(m_contextNode))
bc->setSubNodeBuild(profile);
if (isFileBuild && m_contextFile)
if (isFileBuild)
bc->setFileNodeBuild(m_contextFile);
if (projectExplorer()->saveModifiedFiles()) {
const Core::Id buildStep = Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
......
......@@ -376,8 +376,7 @@ void Qt4ProjectManagerPlugin::updateContextActions(ProjectExplorer::Node *node,
Qt4ProFileNode *subProjectNode = node ? qobject_cast<Qt4ProFileNode *>(node->projectNode()) : 0;
ProjectExplorer::FileNode *fileNode = qobject_cast<ProjectExplorer::FileNode *>(node);
bool buildFilePossible = subProjectNode && fileNode
&& (fileNode->fileType() == ProjectExplorer::SourceType)
&& !subProjectNode->isDebugAndRelease();
&& (fileNode->fileType() == ProjectExplorer::SourceType);
m_qt4ProjectManager->setContextNode(subProjectNode);
m_qt4ProjectManager->setContextProject(qt4Project);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment