MCPcopy Create free account
hub / github.com/SpartanJ/eepp / runConfig

Method runConfig

src/tools/ecode/projectbuild.cpp:832–910  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

830}
831
832void ProjectBuildManager::runConfig( StatusAppOutputController* saoc ) {
833 if ( !isRunningApp() && !getBuilds().empty() ) {
834 BoolScopedOp op( mRunning, true );
835 const ProjectBuild* build = getCurrentBuild();
836
837 if ( nullptr == build || !build->hasRun() )
838 return;
839
840 const ProjectBuildStep* run = nullptr;
841 for ( const auto& crun : build->mRun ) {
842 if ( crun->name == mConfig.runName || mConfig.runName.empty() ) {
843 run = crun.get();
844 break;
845 }
846 }
847
848 if ( nullptr == run ) {
849 Log::info( "No run configuration found to run with runName: %s", mConfig.runName );
850 return;
851 }
852
853 ProjectBuildCommand finalBuild( build->replaceVars( *run ) );
854 replaceDynamicVars( finalBuild );
855 String::trimInPlace( finalBuild.cmd );
856 if ( finalBuild.cmd.find_first_of( "\\/" ) == std::string::npos &&
857 Sys::which( finalBuild.cmd ).empty() ) {
858 FileSystem::dirAddSlashAtEnd( finalBuild.workingDir );
859 finalBuild.cmd = finalBuild.workingDir + finalBuild.cmd;
860 }
861
862 auto cmd = finalBuild.cmd + ( !finalBuild.args.empty() ? ( " " + finalBuild.args ) : "" );
863 if ( finalBuild.runInTerminal ) {
864 if ( finalBuild.useStatusBarTerminal && mApp->getStatusTerminalController() ) {
865 auto stc = mApp->getStatusTerminalController();
866 stc->show();
867 if ( finalBuild.reusePreviousTerminal ) {
868 stc->getTabWidget()->setTabSelected( (Uint32)0 );
869 auto term = stc->getUITerminal();
870 term->restart();
871 term->executeFile( cmd );
872 } else if ( stc->getTabWidget()->getTabCount() ) {
873 auto term = stc->createTerminal();
874 term->executeFile( cmd );
875 }
876 } else {
877 bool mustReuseLastUsedTerm =
878 finalBuild.reusePreviousTerminal && mLastUsedTerm &&
879 mApp->getSplitter()->ownedWidgetExists( mLastUsedTerm );
880
881 UITerminal* term = mustReuseLastUsedTerm
882 ? mLastUsedTerm
883 : mApp->getTerminalManager()->createTerminalInSplitter(
884 finalBuild.workingDir, "", {}, {}, false );
885
886 Log::info( "Running \"%s\" in terminal", cmd );
887 if ( term == nullptr || term->getTerm() == nullptr ) {
888 mApp->getTerminalManager()->openInExternalTerminal( cmd,
889 finalBuild.workingDir );

Callers

nothing calls this directly

Calls 15

infoFunction · 0.85
hasRunMethod · 0.80
replaceVarsMethod · 0.80
find_first_ofMethod · 0.80
getUITerminalMethod · 0.80
getTabCountMethod · 0.80
createTerminalMethod · 0.80
ownedWidgetExistsMethod · 0.80
getTerminalManagerMethod · 0.80

Tested by

no test coverage detected