void MakeStepConfigWidget::updateDetails() { Qt4BuildConfiguration *bc = m_makeStep->qt4BuildConfiguration(); QString workingDirectory = bc->buildDirectory(); QString makeCmd = bc->makeCommand(); if (!m_makeStep->m_makeCmd.isEmpty()) makeCmd = m_makeStep->m_makeCmd; if (!QFileInfo(makeCmd).isAbsolute()) { Environment environment = bc->environment(); // Try to detect command in environment const QString tmp = environment.searchInPath(makeCmd); if (tmp.isEmpty()) { m_summaryText = tr("<b>Make:</b> %1 not found in the environment.").arg(makeCmd); emit updateSummary(); return; } makeCmd = tmp; } // -w option enables "Enter"/"Leaving directory" messages, which we need for detecting the // absolute file path // FIXME doing this without the user having a way to override this is rather bad // so we only do it for unix and if the user didn't override the make command // but for now this is the least invasive change QStringList args = m_makeStep->userArguments(); ProjectExplorer::ToolChain::ToolChainType t = ProjectExplorer::ToolChain::UNKNOWN; ProjectExplorer::ToolChain *toolChain = bc->toolChain(); if (toolChain) t = toolChain->type(); if (t != ProjectExplorer::ToolChain::MSVC && t != ProjectExplorer::ToolChain::WINCE) { if (m_makeStep->m_makeCmd.isEmpty()) args << "-w"; } m_summaryText = tr("<b>Make:</b> %1 %2 in %3").arg(QFileInfo(makeCmd).fileName(), args.join(" "), QDir::toNativeSeparators(workingDirectory)); emit updateSummary(); }
bool MakeStep::init() { Qt4BuildConfiguration *bc = qt4BuildConfiguration(); m_tasks.clear(); if (!bc->toolChain()) { m_tasks.append(ProjectExplorer::Task(ProjectExplorer::Task::Error, tr("Qt Creator needs a tool chain set up to build. Please configure a tool chain in Project mode."), QString(), -1, QLatin1String(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM))); } ProjectExplorer::ProcessParameters *pp = processParameters(); pp->setMacroExpander(bc->macroExpander()); Utils::Environment environment = bc->environment(); pp->setEnvironment(environment); QString workingDirectory; if (bc->subNodeBuild()) workingDirectory = bc->subNodeBuild()->buildDir(); else workingDirectory = bc->buildDirectory(); pp->setWorkingDirectory(workingDirectory); QString makeCmd = bc->makeCommand(); if (!m_makeCmd.isEmpty()) makeCmd = m_makeCmd; pp->setCommand(makeCmd); // If we are cleaning, then make can fail with a error code, but that doesn't mean // we should stop the clean queue // That is mostly so that rebuild works on a already clean project setIgnoreReturnValue(m_clean); QString args; ProjectExplorer::ToolChain *toolchain = bc->toolChain(); if (bc->subNodeBuild()) { QString makefile = bc->subNodeBuild()->makefile(); if(!makefile.isEmpty()) { Utils::QtcProcess::addArg(&args, QLatin1String("-f")); Utils::QtcProcess::addArg(&args, makefile); m_makeFileToCheck = QDir(workingDirectory).filePath(makefile); } else { m_makeFileToCheck = QDir(workingDirectory).filePath("Makefile"); } } else { if (!bc->makefile().isEmpty()) { Utils::QtcProcess::addArg(&args, QLatin1String("-f")); Utils::QtcProcess::addArg(&args, bc->makefile()); m_makeFileToCheck = QDir(workingDirectory).filePath(bc->makefile()); } else { m_makeFileToCheck = QDir(workingDirectory).filePath("Makefile"); } } Utils::QtcProcess::addArgs(&args, m_userArgs); if (!isClean()) { if (!bc->defaultMakeTarget().isEmpty()) Utils::QtcProcess::addArg(&args, bc->defaultMakeTarget()); } // -w option enables "Enter"/"Leaving directory" messages, which we need for detecting the // absolute file path // FIXME doing this without the user having a way to override this is rather bad // so we only do it for unix and if the user didn't override the make command // but for now this is the least invasive change if (toolchain && toolchain->targetAbi().binaryFormat() != ProjectExplorer::Abi::PEFormat && m_makeCmd.isEmpty()) Utils::QtcProcess::addArg(&args, QLatin1String("-w")); setEnabled(true); pp->setArguments(args); ProjectExplorer::IOutputParser *parser = 0; if (bc->qtVersion()) parser = bc->qtVersion()->createOutputParser(); if (parser) parser->appendOutputParser(new QtSupport::QtParser); else parser = new QtSupport::QtParser; if (toolchain) parser->appendOutputParser(toolchain->outputParser()); parser->setWorkingDirectory(workingDirectory); setOutputParser(parser); return AbstractProcessStep::init(); }
bool MakeStep::init() { Qt4BuildConfiguration *bc = qt4BuildConfiguration(); Environment environment = bc->environment(); setEnvironment(environment); QString workingDirectory; if (bc->subNodeBuild()) workingDirectory = bc->subNodeBuild()->buildDir(); else workingDirectory = bc->buildDirectory(); setWorkingDirectory(workingDirectory); QString makeCmd = bc->makeCommand(); if (!m_makeCmd.isEmpty()) makeCmd = m_makeCmd; if (!QFileInfo(makeCmd).isAbsolute()) { // Try to detect command in environment const QString tmp = environment.searchInPath(makeCmd); if (tmp.isEmpty()) { QTextCharFormat textCharFormat; textCharFormat.setForeground(Qt::red); emit addOutput(tr("Could not find make command: %1 in the build environment").arg(makeCmd), textCharFormat); return false; } makeCmd = tmp; } setCommand(makeCmd); // If we are cleaning, then make can fail with a error code, but that doesn't mean // we should stop the clean queue // That is mostly so that rebuild works on a already clean project setIgnoreReturnValue(m_clean); QStringList args = m_userArgs; if (!m_clean) { if (!bc->defaultMakeTarget().isEmpty()) args << bc->defaultMakeTarget(); } // -w option enables "Enter"/"Leaving directory" messages, which we need for detecting the // absolute file path // FIXME doing this without the user having a way to override this is rather bad // so we only do it for unix and if the user didn't override the make command // but for now this is the least invasive change ProjectExplorer::ToolChain *toolchain = bc->toolChain(); if (toolchain) { if (toolchain->type() != ProjectExplorer::ToolChain::MSVC && toolchain->type() != ProjectExplorer::ToolChain::WINCE) { if (m_makeCmd.isEmpty()) args << "-w"; } } setEnabled(true); setArguments(args); setOutputParser(new ProjectExplorer::GnuMakeParser(workingDirectory)); if (toolchain) appendOutputParser(toolchain->outputParser()); return AbstractProcessStep::init(); }