void CustomBuildJob::start() { if( type == CustomBuildSystemTool::Undefined ) { setError( UndefinedBuildType ); setErrorText( i18n( "Undefined Build type" ) ); emitResult(); } else if( cmd.isEmpty() ) { setError( NoCommand ); setErrorText( i18n( "No command given" ) ); emitResult(); } else if( !enabled ) { setError( ToolDisabled ); setErrorText( i18n( "This command is disabled" ) ); emitResult(); } else { KShell::Errors err; QStringList strargs = KShell::splitArgs( arguments, KShell::AbortOnMeta, &err ); if( err != KShell::NoError ) { setError( WrongArgs ); setErrorText( i18n( "The given arguments would need a real shell, this is not supported currently." ) ); emitResult(); } setStandardToolView( KDevelop::IOutputView::BuildView ); setBehaviours( KDevelop::IOutputView::AllowUserClose | KDevelop::IOutputView::AutoScroll ); KDevelop::OutputModel* model = new KDevelop::OutputModel( builddir ); model->setFilteringStrategy( KDevelop::OutputModel::CompilerFilter ); setModel( model ); startOutput(); exec = new KDevelop::CommandExecutor( cmd, this ); exec->setArguments( strargs ); exec->setEnvironment( KDevelop::EnvironmentGroupList( KGlobal::config() ).createEnvironment( environment, KProcess::systemEnvironment() ) ); exec->setWorkingDirectory( builddir ); connect( exec, SIGNAL(completed(int)), SLOT(procFinished(int)) ); connect( exec, SIGNAL(failed( QProcess::ProcessError )), SLOT(procError( QProcess::ProcessError )) ); connect( exec, SIGNAL(receivedStandardError(QStringList)), model, SLOT(appendLines(QStringList)) ); connect( exec, SIGNAL(receivedStandardOutput(QStringList)), model, SLOT(appendLines(QStringList)) ); model->appendLine( QString("%1>%2 %3").arg( builddir ).arg( cmd ).arg( arguments ) ); exec->start(); } }
QbsKJob::QbsKJob(const QbsKJob::CreateQbsJobFunction &function, const QString &buildDir, QObject *parent) : KDevelop::OutputJob(parent) , m_createQbsJobFunction(function) , m_job(nullptr) { KDevelop::OutputModel* model = new KDevelop::OutputModel( QUrl::fromLocalFile(buildDir) ); model->setFilteringStrategy( KDevelop::OutputModel::CompilerFilter ); setModel(model); setCapabilities(Killable); setStandardToolView(KDevelop::IOutputView::BuildView); setBehaviours(KDevelop::IOutputView::AllowUserClose | KDevelop::IOutputView::AutoScroll ); setObjectName(buildDir); setDelegate(new KDevelop::OutputDelegate); setKillJobOnOutputClose(true); }
void QMakeJob::start() { if (!m_project) { setError(NoProjectError); setErrorText(i18n("No project specified.")); return emitResult(); } setStandardToolView(KDevelop::IOutputView::BuildView); setBehaviours(KDevelop::IOutputView::AllowUserClose | KDevelop::IOutputView::AutoScroll); setModel(new KDevelop::OutputModel); startOutput(); QString cmd = QMakeConfig::qmakeBinary(m_project); m_cmd = new KDevelop::CommandExecutor(cmd, this); connect(m_cmd, SIGNAL(receivedStandardError(const QStringList&)), model(), SLOT(appendLines(const QStringList&))); connect(m_cmd, SIGNAL(receivedStandardOutput(const QStringList&)), model(), SLOT(appendLines(const QStringList&))); m_cmd->setWorkingDirectory(m_project->path().toUrl().toLocalFile()); connect(m_cmd, SIGNAL(failed(QProcess::ProcessError)), this, SLOT(slotFailed(QProcess::ProcessError))); connect(m_cmd, SIGNAL(completed(int)), this, SLOT(slotCompleted(int))); m_cmd->start(); }