28#include <wx/process.h>
29#include <wx/txtstrm.h>
30#include <wx/sstream.h>
31#include <wx/wfstream.h>
36 m_jobsFile( aJobsFile ),
37 m_reporter( aReporter )
67 int result =
static_cast<int>( wxExecute( specialJob->
m_command, wxEXEC_SYNC, &
process ) );
74 wxInputStream* inputStream =
process.GetInputStream();
77 inputStream->Read( procOutput );
98 tmp.AssignDir( wxFileName::GetTempDir() );
99 tmp.AppendDir(
KIID().AsString() );
101 wxString tempDirPath = tmp.GetFullPath();
102 if( !wxFileName::Mkdir( tempDirPath, wxS_DIR_DEFAULT ) )
106 msg = wxString::Format( wxT(
"Failed to create temporary directory %s" ), tempDirPath );
115 msg += wxT(
"|--------------------------------\n" );
117 msg += wxString::Format(
"Performing jobs" );
119 msg += wxT(
"|--------------------------------\n" );
121 msg += wxString::Format( wxT(
"|%-5s | %-50s\n" ), wxT(
"No." ), wxT(
"Description" ) );
126 msg += wxString::Format( wxT(
"|%-5d | %-50s\n" ), jobNum,
127 job.m_job->GetDescription() );
130 msg += wxT(
"|--------------------------------\n" );
137 std::vector<JOB_OUTPUT> outputs;
141 int successCount = 0;
146 msg = wxT(
"|--------------------------------\n" );
147 msg += wxString::Format( wxT(
"| Running job %d, %s" ), jobNum, job.m_job->GetDescription() );
149 msg += wxT(
"|--------------------------------\n" );
156 job.m_job->SetTempOutputDirectory( tempDirPath );
166 if( job.m_job->GetType() ==
"special_execute" )
170 result =
static_cast<int>( wxExecute( specialJob->
m_command ) );
178 wxString msg_fmt = wxT(
"\033[32;1m%s\033[0m\n" );
179 msg = wxString::Format( msg_fmt,
_(
"Job successful" ) );
185 wxString msg_fmt = wxT(
"\033[31;1m%s\033[0m\n" );
186 msg = wxString::Format( msg_fmt,
_(
"Job failed" ) );
191 msg += wxT(
"\n\n" );
215 msg = wxString::Format( wxT(
"\n\n\033[33;1m%d %s, %d %s\033[0m\n" ),
217 wxT(
"jobs succeeded" ),
219 wxT(
"job failed" ) );
std::vector< JOBSET_JOB > GetJobsForOutput(JOBSET_OUTPUT *aOutput)
std::vector< JOBSET_OUTPUT > & GetOutputs()
virtual bool HandleOutputs(const wxString &baseTempPath, const std::vector< JOB_OUTPUT > &aOutputsToHandle)=0
bool RunJobsForOutput(JOBSET_OUTPUT *aOutput, bool aBail=false)
int runSpecialExecute(JOBSET_JOB *aJob)
bool RunJobsAllOutputs(bool aBail=false)
JOBS_RUNNER(KIWAY *aKiway, JOBSET *aJobsFile, REPORTER *aReporter=nullptr)
static KIWAY::FACE_T GetKifaceType(const wxString &aName)
wxString GetFullOutputPath() const
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
int ProcessJob(KIWAY::FACE_T aFace, JOB *aJob)
FACE_T
Known KIFACE implementations.
static REPORTER & GetInstance()
A pure virtual class used to derive REPORTER objects from.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
static PGM_BASE * process
std::shared_ptr< JOB > m_job
JOBS_OUTPUT_HANDLER * m_outputHandler