void QmakeManager::runQMake(ProjectExplorer::Project *p, ProjectExplorer::Node *node) { if (!ProjectExplorerPlugin::saveModifiedFiles()) return; QmakeProject *qmakeProject = qobject_cast<QmakeProject *>(p); QTC_ASSERT(qmakeProject, return); if (!qmakeProject->activeTarget() || !qmakeProject->activeTarget()->activeBuildConfiguration()) return; QmakeBuildConfiguration *bc = static_cast<QmakeBuildConfiguration *>(qmakeProject->activeTarget()->activeBuildConfiguration()); QMakeStep *qs = bc->qmakeStep(); if (!qs) return; //found qmakeStep, now use it qs->setForced(true); if (node != 0 && node != qmakeProject->rootProjectNode()) if (QmakeProFileNode *profile = dynamic_cast<QmakeProFileNode *>(node)) bc->setSubNodeBuild(profile); BuildManager::appendStep(qs, tr("QMake")); bc->setSubNodeBuild(0); }
/// /// Returns all arguments /// That is: possbile subpath /// spec /// config arguemnts /// moreArguments /// user arguments QString QMakeStep::allArguments(bool shorted) { QmakeBuildConfiguration *bc = qmakeBuildConfiguration(); QStringList arguments; if (bc->subNodeBuild()) arguments << bc->subNodeBuild()->path().toUserOutput(); else if (shorted) arguments << project()->projectFilePath().fileName(); else arguments << project()->projectFilePath().toUserOutput(); arguments << QLatin1String("-r"); bool userProvidedMkspec = false; for (QtcProcess::ConstArgIterator ait(m_userArgs); ait.next(); ) { if (ait.value() == QLatin1String("-spec")) { if (ait.next()) { userProvidedMkspec = true; break; } } } FileName specArg = mkspec(); if (!userProvidedMkspec && !specArg.isEmpty()) arguments << QLatin1String("-spec") << specArg.toUserOutput(); // Find out what flags we pass on to qmake arguments << bc->configCommandLineArguments(); arguments << deducedArguments().toArguments(); QString args = QtcProcess::joinArgs(arguments); // User arguments QtcProcess::addArgs(&args, m_userArgs); return args; }
QString MakeStep::effectiveMakeCommand() const { QString makeCmd = m_makeCmd; if (makeCmd.isEmpty()) { QmakeBuildConfiguration *bc = qmakeBuildConfiguration(); ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit()); if (bc && tc) makeCmd = tc->makeCommand(bc->environment()); } return makeCmd; }
void AndroidPackageCreationWidget::updateSigningWarning() { QmakeBuildConfiguration *bc = qobject_cast<QmakeBuildConfiguration *>(m_step->target()->activeBuildConfiguration()); bool debug = bc && (bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild); if (m_step->signPackage() && debug) { m_ui->signingDebugWarningIcon->setVisible(true); m_ui->signingDebugWarningLabel->setVisible(true); } else { m_ui->signingDebugWarningIcon->setVisible(false); m_ui->signingDebugWarningLabel->setVisible(false); } }
void MakeStepConfigWidget::updateDetails() { ToolChain *tc = ToolChainKitInformation::toolChain(m_makeStep->target()->kit()); QmakeBuildConfiguration *bc = m_makeStep->qmakeBuildConfiguration(); if (!bc) bc = qobject_cast<QmakeBuildConfiguration *>(m_makeStep->target()->activeBuildConfiguration()); if (tc && bc) m_ui->makeLabel->setText(tr("Override %1:").arg(QDir::toNativeSeparators(tc->makeCommand(bc->environment())))); else m_ui->makeLabel->setText(tr("Make:")); if (!tc) { setSummaryText(tr("<b>Make:</b> %1").arg(ProjectExplorer::ToolChainKitInformation::msgNoToolChainInTarget())); return; } if (!bc) { setSummaryText(tr("<b>Make:</b> No Qt build configuration.")); return; } ProcessParameters param; param.setMacroExpander(bc->macroExpander()); param.setWorkingDirectory(bc->buildDirectory().toString()); QString makeCmd = tc->makeCommand(bc->environment()); if (!m_makeStep->makeCommand().isEmpty()) makeCmd = m_makeStep->makeCommand(); param.setCommand(makeCmd); QString args = m_makeStep->userArguments(); Utils::Environment env = bc->environment(); Utils::Environment::setupEnglishOutput(&env); // We prepend "L" to the MAKEFLAGS, so that nmake / jom are less verbose // FIXME doing this without the user having a way to override this is rather bad if (tc && m_makeStep->makeCommand().isEmpty()) { if (tc->targetAbi().os() == Abi::WindowsOS && tc->targetAbi().osFlavor() != Abi::WindowsMSysFlavor) { const QString makeFlags = QLatin1String("MAKEFLAGS"); env.set(makeFlags, QLatin1Char('L') + env.value(makeFlags)); } } param.setArguments(args); param.setEnvironment(env); if (param.commandMissing()) setSummaryText(tr("<b>Make:</b> %1 not found in the environment.").arg(makeCmd)); // Override display text else setSummaryText(param.summaryInWorkdir(displayName())); }
QString MakeStep::effectiveMakeCommand() const { QString makeCmd = m_makeCmd; if (makeCmd.isEmpty()) { QmakeBuildConfiguration *bc = qmakeBuildConfiguration(); if (!bc) bc = qobject_cast<QmakeBuildConfiguration *>(target()->activeBuildConfiguration()); ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID); if (bc && tc) makeCmd = tc->makeCommand(bc->environment()); } return makeCmd; }
FileName IosRunConfiguration::bundleDirectory() const { FileName res; Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit()); bool isDevice = (devType == Constants::IOS_DEVICE_TYPE); if (!isDevice && devType != Constants::IOS_SIMULATOR_TYPE) { qCWarning(iosLog) << "unexpected device type in bundleDirForTarget: " << devType.toString(); return res; } QmakeBuildConfiguration *bc = qobject_cast<QmakeBuildConfiguration *>(target()->activeBuildConfiguration()); if (bc) { QmakeProject *pro = qobject_cast<QmakeProject *>(target()->project()); const QmakeProFileNode *node = 0; if (pro) node = pro->rootProjectNode(); if (node) node = node->findProFileFor(profilePath()); if (node) { TargetInformation ti = node->targetInformation(); if (ti.valid) res = FileName::fromString(ti.buildDir); } if (res.isEmpty()) res = bc->buildDirectory(); switch (bc->buildType()) { case BuildConfiguration::Debug : case BuildConfiguration::Unknown : if (isDevice) res.appendPath(QLatin1String("Debug-iphoneos")); else res.appendPath(QLatin1String("Debug-iphonesimulator")); break; case BuildConfiguration::Profile : case BuildConfiguration::Release : if (isDevice) res.appendPath(QLatin1String("Release-iphoneos")); else res.appendPath(QLatin1String("Release-iphonesimulator")); break; default: qCWarning(iosLog) << "IosBuildStep had an unknown buildType " << target()->activeBuildConfiguration()->buildType(); } } res.appendPath(applicationName() + QLatin1String(".app")); return res; }
void QmakeManager::handleSubDirContextMenu(QmakeManager::Action action, bool isFileBuild, ProjectExplorer::Project *contextProject, ProjectExplorer::Node *contextNode, ProjectExplorer::FileNode *contextFile) { QmakeProject *qmakeProject = qobject_cast<QmakeProject *>(contextProject); QTC_ASSERT(qmakeProject, return); if (!qmakeProject->activeTarget() || !qmakeProject->activeTarget()->activeBuildConfiguration()) return; if (!contextNode || !contextFile) isFileBuild = false; QmakeBuildConfiguration *bc = qobject_cast<QmakeBuildConfiguration *>(qmakeProject->activeTarget()->activeBuildConfiguration()); if (!bc) return; if (contextNode) { if (QmakePriFileNode *prifile = dynamic_cast<QmakePriFileNode *>(contextNode)) { if (QmakeProFileNode *profile = prifile->proFileNode()) { if (profile != qmakeProject->rootProjectNode() || isFileBuild) bc->setSubNodeBuild(profile); } } } if (isFileBuild) bc->setFileNodeBuild(contextFile); if (ProjectExplorerPlugin::saveModifiedFiles()) { const Core::Id buildStep = ProjectExplorer::Constants::BUILDSTEPS_BUILD; const Core::Id cleanStep = ProjectExplorer::Constants::BUILDSTEPS_CLEAN; if (action == BUILD) { const QString name = ProjectExplorerPlugin::displayNameForStepId(buildStep); BuildManager::buildList(bc->stepList(buildStep), name); } else if (action == CLEAN) { const QString name = ProjectExplorerPlugin::displayNameForStepId(cleanStep); BuildManager::buildList(bc->stepList(cleanStep), name); } else if (action == REBUILD) { QStringList names; names << ProjectExplorerPlugin::displayNameForStepId(cleanStep) << ProjectExplorerPlugin::displayNameForStepId(buildStep); QList<ProjectExplorer::BuildStepList *> stepLists; stepLists << bc->stepList(cleanStep) << bc->stepList(buildStep); BuildManager::buildLists(stepLists, names); } } bc->setSubNodeBuild(0); bc->setFileNodeBuild(0); }
void AndroidPackageCreationWidget::initGui() { updateAndroidProjectInfo(); ProjectExplorer::Target *target = m_step->target(); m_fileSystemWatcher->addPath(AndroidManager::dirPath(target).toString()); m_fileSystemWatcher->addPath(AndroidManager::manifestPath(target).toString()); m_fileSystemWatcher->addPath(AndroidManager::srcPath(target).toString()); connect(m_fileSystemWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(updateAndroidProjectInfo())); connect(m_fileSystemWatcher, SIGNAL(fileChanged(QString)), this, SLOT(updateAndroidProjectInfo())); connect(m_ui->targetSDKComboBox, SIGNAL(activated(QString)), SLOT(setTargetSDK(QString))); connect(m_qtLibsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), SLOT(setQtLibs(QModelIndex,QModelIndex))); connect(m_prebundledLibs, SIGNAL(dataChanged(QModelIndex,QModelIndex)), SLOT(setPrebundledLibs(QModelIndex,QModelIndex))); connect(m_ui->prebundledLibsListView, SIGNAL(activated(QModelIndex)), SLOT(prebundledLibSelected(QModelIndex))); connect(m_ui->prebundledLibsListView, SIGNAL(clicked(QModelIndex)), SLOT(prebundledLibSelected(QModelIndex))); connect(m_ui->upPushButton, SIGNAL(clicked()), SLOT(prebundledLibMoveUp())); connect(m_ui->downPushButton, SIGNAL(clicked()), SLOT(prebundledLibMoveDown())); connect(m_ui->readInfoPushButton, SIGNAL(clicked()), SLOT(readElfInfo())); m_ui->qtLibsListView->setModel(m_qtLibsModel); m_ui->prebundledLibsListView->setModel(m_prebundledLibs); m_ui->KeystoreLocationLineEdit->setText(m_step->keystorePath().toUserOutput()); // Make the buildconfiguration emit a evironmentChanged() signal // TODO find a better way QmakeBuildConfiguration *bc = qobject_cast<QmakeBuildConfiguration *>(m_step->target()->activeBuildConfiguration()); if (!bc) return; bool use = bc->useSystemEnvironment(); bc->setUseSystemEnvironment(!use); bc->setUseSystemEnvironment(use); activeBuildConfigurationChanged(); connect(m_step->target(), SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)), this, SLOT(activeBuildConfigurationChanged())); }
void AndroidPackageCreationWidget::setTargetSDK(const QString &sdk) { AndroidManager::setBuildTargetSDK(m_step->target(), sdk); QmakeBuildConfiguration *bc = qobject_cast<QmakeBuildConfiguration *>(m_step->target()->activeBuildConfiguration()); if (!bc) return; QMakeStep *qs = bc->qmakeStep(); if (!qs) return; qs->setForced(true); BuildManager::buildList(bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN), ProjectExplorerPlugin::displayNameForStepId(ProjectExplorer::Constants::BUILDSTEPS_CLEAN)); BuildManager::appendStep(qs, ProjectExplorerPlugin::displayNameForStepId(ProjectExplorer::Constants::BUILDSTEPS_CLEAN)); bc->setSubNodeBuild(0); // Make the buildconfiguration emit a evironmentChanged() signal // TODO find a better way bool use = bc->useSystemEnvironment(); bc->setUseSystemEnvironment(!use); bc->setUseSystemEnvironment(use); }
bool MakeStep::init(QList<const BuildStep *> &earlierSteps) { QmakeBuildConfiguration *bc = qmakeBuildConfiguration(); if (!bc) bc = qobject_cast<QmakeBuildConfiguration *>(target()->activeBuildConfiguration()); if (!bc) emit addTask(Task::buildConfigurationMissingTask()); ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit()); if (!tc) emit addTask(Task::compilerMissingTask()); if (!bc || !tc) { emitFaultyConfigurationMessage(); return false; } ProcessParameters *pp = processParameters(); pp->setMacroExpander(bc->macroExpander()); QString workingDirectory; if (bc->subNodeBuild()) workingDirectory = bc->subNodeBuild()->buildDir(); else workingDirectory = bc->buildDirectory().toString(); pp->setWorkingDirectory(workingDirectory); pp->setCommand(effectiveMakeCommand()); // 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; QmakeProjectManager::QmakeProFileNode *subNode = bc->subNodeBuild(); if (subNode) { QString makefile = subNode->makefile(); if (makefile.isEmpty()) makefile = QLatin1String("Makefile"); // Use Makefile.Debug and Makefile.Release // for file builds, since the rules for that are // only in those files. if (subNode->isDebugAndRelease() && bc->fileNodeBuild()) { if (bc->buildType() == QmakeBuildConfiguration::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 { 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(QLatin1String("Makefile")); } } Utils::QtcProcess::addArgs(&args, m_userArgs); if (bc->fileNodeBuild() && subNode) { QString objectsDir = subNode->objectsDirectory(); if (objectsDir.isEmpty()) { objectsDir = subNode->buildDir(bc); if (subNode->isDebugAndRelease()) { if (bc->buildType() == QmakeBuildConfiguration::Debug) objectsDir += QLatin1String("/debug"); else objectsDir += QLatin1String("/release"); } } QString relObjectsDir = QDir(pp->workingDirectory()).relativeFilePath(objectsDir); if (relObjectsDir == QLatin1String(".")) relObjectsDir.clear(); if (!relObjectsDir.isEmpty()) relObjectsDir += QLatin1Char('/'); QString objectFile = relObjectsDir + bc->fileNodeBuild()->filePath().toFileInfo().baseName() + subNode->objectExtension(); Utils::QtcProcess::addArg(&args, objectFile); } Utils::Environment env = bc->environment(); Utils::Environment::setupEnglishOutput(&env); // We also prepend "L" to the MAKEFLAGS, so that nmake / jom are less verbose if (tc && makeCommand().isEmpty()) { if (tc->targetAbi().os() == Abi::WindowsOS && tc->targetAbi().osFlavor() != Abi::WindowsMSysFlavor) { const QString makeFlags = QLatin1String("MAKEFLAGS"); env.set(makeFlags, QLatin1Char('L') + env.value(makeFlags)); } } pp->setEnvironment(env); pp->setArguments(args); pp->resolveAll(); setOutputParser(new ProjectExplorer::GnuMakeParser()); if (tc && tc->targetAbi().os() == Abi::MacOS) appendOutputParser(new XcodebuildParser); IOutputParser *parser = target()->kit()->createOutputParser(); if (parser) appendOutputParser(parser); outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory()); appendOutputParser(new QMakeParser); // make may cause qmake to be run, add last to make sure // it has a low priority. m_scriptTarget = (static_cast<QmakeProject *>(bc->target()->project())->rootProjectNode()->projectType() == ScriptTemplate); return AbstractProcessStep::init(earlierSteps); }
bool QMakeStep::init(QList<const BuildStep *> &earlierSteps) { if (m_commandFuture) return false; QmakeBuildConfiguration *qmakeBc = qmakeBuildConfiguration(); const BaseQtVersion *qtVersion = QtKitInformation::qtVersion(target()->kit()); if (!qtVersion) return false; QString workingDirectory; if (qmakeBc->subNodeBuild()) workingDirectory = qmakeBc->subNodeBuild()->buildDir(); else workingDirectory = qmakeBc->buildDirectory().toString(); m_qmakeExecutable = qtVersion->qmakeCommand().toString(); m_qmakeArguments = allArguments(qtVersion); m_runMakeQmake = (qtVersion->qtVersion() >= QtVersionNumber(5, 0 ,0)); if (m_runMakeQmake) { m_makeExecutable = makeCommand(); if (m_makeExecutable.isEmpty()) return false; } else { m_makeExecutable.clear(); } QString makefile = workingDirectory; if (qmakeBc->subNodeBuild()) { if (!qmakeBc->subNodeBuild()->makefile().isEmpty()) makefile.append(qmakeBc->subNodeBuild()->makefile()); else makefile.append(QLatin1String("/Makefile")); } else if (!qmakeBc->makefile().isEmpty()) { makefile.append(QLatin1Char('/')); makefile.append(qmakeBc->makefile()); } else { makefile.append(QLatin1String("/Makefile")); } // Check whether we need to run qmake bool makefileOutDated = (qmakeBc->compareToImportFrom(makefile) != QmakeBuildConfiguration::MakefileMatches); if (m_forced || makefileOutDated) m_needToRunQMake = true; m_forced = false; ProcessParameters *pp = processParameters(); pp->setMacroExpander(qmakeBc->macroExpander()); pp->setWorkingDirectory(workingDirectory); pp->setEnvironment(qmakeBc->environment()); setOutputParser(new QMakeParser); QmakeProFileNode *node = static_cast<QmakeProject *>(qmakeBc->target()->project())->rootProjectNode(); if (qmakeBc->subNodeBuild()) node = qmakeBc->subNodeBuild(); QString proFile = node->filePath().toString(); QList<ProjectExplorer::Task> tasks = qtVersion->reportIssues(proFile, workingDirectory); Utils::sort(tasks); if (!tasks.isEmpty()) { bool canContinue = true; foreach (const ProjectExplorer::Task &t, tasks) { addTask(t); if (t.type == Task::Error) canContinue = false; }
QString IosManager::resDirForTarget(Target *target) { QmakeBuildConfiguration *bc = qobject_cast<QmakeBuildConfiguration *>(target->activeBuildConfiguration()); return bc->buildDirectory().toString(); }