GenericTarget *GenericTargetFactory::create(ProjectExplorer::Project *parent, const QString &id) { if (!canCreate(parent, id)) return 0; GenericProject *genericproject = static_cast<GenericProject *>(parent); GenericTarget *t = new GenericTarget(genericproject); // Set up BuildConfiguration: GenericBuildConfiguration *bc = new GenericBuildConfiguration(t); bc->setDisplayName("all"); ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); ProjectExplorer::BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN); GenericMakeStep *makeStep = new GenericMakeStep(buildSteps); buildSteps->insertStep(0, makeStep); makeStep->setBuildTarget("all", /* on = */ true); GenericMakeStep *cleanMakeStep = new GenericMakeStep(cleanSteps); cleanSteps->insertStep(0, cleanMakeStep); cleanMakeStep->setBuildTarget("clean", /* on = */ true); cleanMakeStep->setClean(true); bc->setBuildDirectory(genericproject->projectDirectory()); t->addBuildConfiguration(bc); t->addDeployConfiguration(t->createDeployConfiguration(ProjectExplorer::Constants::DEFAULT_DEPLOYCONFIGURATION_ID)); // Add a runconfiguration. The CustomExecutableRC one will query the user // for its settings, so it is a good choice here. t->addRunConfiguration(new ProjectExplorer::CustomExecutableRunConfiguration(t)); return t; }
BuildConfiguration *GenericBuildConfigurationFactory::create(Target *parent, const Core::Id id, const QString &name) { if (!canCreate(parent, id)) return 0; //TODO asking for name is duplicated everywhere, but maybe more // wizards will show up, that incorporate choosing the nam bool ok = true; QString buildConfigurationName = name; if (buildConfigurationName.isNull()) buildConfigurationName = QInputDialog::getText(0, tr("New Configuration"), tr("New configuration name:"), QLineEdit::Normal, QString(), &ok); buildConfigurationName = buildConfigurationName.trimmed(); if (!ok || buildConfigurationName.isEmpty()) return 0; GenericBuildConfiguration *bc = new GenericBuildConfiguration(parent); bc->setDisplayName(buildConfigurationName); BuildStepList *buildSteps = bc->stepList(Constants::BUILDSTEPS_BUILD); BuildStepList *cleanSteps = bc->stepList(Constants::BUILDSTEPS_CLEAN); Q_ASSERT(buildSteps); GenericMakeStep *makeStep = new GenericMakeStep(buildSteps); buildSteps->insertStep(0, makeStep); makeStep->setBuildTarget(QLatin1String("all"), /* on = */ true); Q_ASSERT(cleanSteps); GenericMakeStep *cleanMakeStep = new GenericMakeStep(cleanSteps); cleanSteps->insertStep(0, cleanMakeStep); cleanMakeStep->setBuildTarget(QLatin1String("clean"), /* on = */ true); cleanMakeStep->setClean(true); return bc; }
BuildConfiguration *GenericBuildConfigurationFactory::create(ProjectExplorer::Target *parent, const QString &id) { if (!canCreate(parent, id)) return 0; GenericTarget *target(static_cast<GenericTarget *>(parent)); //TODO asking for name is duplicated everywhere, but maybe more // wizards will show up, that incorporate choosing the name bool ok; QString buildConfigurationName = QInputDialog::getText(0, tr("New Configuration"), tr("New configuration name:"), QLineEdit::Normal, QString(), &ok); if (!ok || buildConfigurationName.isEmpty()) return 0; GenericBuildConfiguration *bc = new GenericBuildConfiguration(target); bc->setDisplayName(buildConfigurationName); ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); ProjectExplorer::BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN); Q_ASSERT(buildSteps); GenericMakeStep *makeStep = new GenericMakeStep(buildSteps); buildSteps->insertStep(0, makeStep); makeStep->setBuildTarget("all", /* on = */ true); Q_ASSERT(cleanSteps); GenericMakeStep *cleanMakeStep = new GenericMakeStep(cleanSteps); cleanSteps->insertStep(0, cleanMakeStep); cleanMakeStep->setBuildTarget("clean", /* on = */ true); cleanMakeStep->setClean(true); target->addBuildConfiguration(bc); // also makes the name unique... return bc; }