gwenhywfar 5.12.0
buildctx_run.c File Reference
#include "gwenbuild/buildctx/buildctx_p.h"
#include "gwenbuild/buildctx/buildctx_run.h"
#include "gwenbuild/buildctx/buildctx_bdeps.h"
#include "gwenbuild/buildctx/buildctx_depfile.h"
#include <gwenhywfar/debug.h>
#include <gwenhywfar/text.h>
#include <gwenhywfar/directory.h>
#include <unistd.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <string.h>
Include dependency graph for buildctx_run.c:

Go to the source code of this file.

Macros

#define DISABLE_DEBUGLOG
#define GWB_BUILDCTX_PROCESS_WAIT_TIMEOUT   10.0

Functions

static void _abortAllCommands (GWB_BUILD_CONTEXT *bctx)
static void _abortCommandsInQueue (GWB_BUILD_CMD_LIST2 *cmdList)
static int _checkDatesOfFileAgainstList (const char *fileName, const GWEN_STRINGLIST *sl)
static int _checkDependencies (GWB_BUILD_CMD *bcmd, GWB_BUILD_SUBCMD *subCmd, const char *firstOutFileName)
static int _checkRunningQueue (GWB_BUILD_CONTEXT *bctx)
static int _checkWaitingQueue (GWB_BUILD_CONTEXT *bctx, int maxStartAllowed)
static void _createCommandQueues (GWB_BUILD_CONTEXT *bctx)
static void _decBlockingFilesInWaitingBuildCommands (GWB_BUILD_CMD_LIST2 *waitingCommands)
GWEN_STRINGLIST_fileListToTopBuildDirStringList (const char *initialSourceDir, GWB_FILE_LIST2 *fileList)
static void _finishCurrentCommand (GWB_BUILD_CONTEXT *bctx, GWB_BUILD_CMD *bcmd, GWB_BUILD_SUBCMD *currentCommand)
static time_t _getHighestModificationTime (const GWEN_STRINGLIST *slFiles)
static time_t _getLowestModificationTime (const GWEN_STRINGLIST *slFiles)
static int _inFilesNewerThanOutFiles (const GWEN_STRINGLIST *slInFiles, const GWEN_STRINGLIST *slOutFiles)
static int _needRunCurrentCommand (GWB_BUILD_CMD *bcmd, const GWEN_STRINGLIST *slInFiles, const GWEN_STRINGLIST *slOutFiles)
static void _printCmdOutputIfNotEmptyAndDeleteFile (GWB_BUILD_CMD *cmd, GWB_BUILD_SUBCMD *subCmd)
static void _setupCommands (GWB_BUILD_CONTEXT *bctx, int forPrepareCommands)
static void _signalJobFinished (GWB_BUILD_CMD *bcmd)
static int _startCommand (GWB_BUILD_CONTEXT *bctx, GWB_BUILD_CMD *bcmd, const GWEN_STRINGLIST *slOutFiles)
static void _unlinkFilesInStringList (const GWEN_STRINGLIST *slFiles)
static int _waitForRunningJobs (GWB_BUILD_CONTEXT *bctx)
int GWB_BuildCtx_Run (GWB_BUILD_CONTEXT *bctx, int maxConcurrentJobs, int usePrepareCommands, const char *builderName)

Variables

static int _commandLogNum =0

Macro Definition Documentation

◆ DISABLE_DEBUGLOG

#define DISABLE_DEBUGLOG

Definition at line 14 of file buildctx_run.c.

◆ GWB_BUILDCTX_PROCESS_WAIT_TIMEOUT

#define GWB_BUILDCTX_PROCESS_WAIT_TIMEOUT   10.0

Definition at line 35 of file buildctx_run.c.

Referenced by _waitForRunningJobs().

Function Documentation

◆ _abortAllCommands()

void _abortAllCommands ( GWB_BUILD_CONTEXT * bctx)
static

Definition at line 174 of file buildctx_run.c.

References _abortCommandsInQueue(), and NULL.

Referenced by GWB_BuildCtx_Run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _abortCommandsInQueue()

void _abortCommandsInQueue ( GWB_BUILD_CMD_LIST2 * cmdList)
static

Definition at line 191 of file buildctx_run.c.

References GWB_BuildCmd_SetCurrentProcess(), and NULL.

Referenced by _abortAllCommands().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _checkDatesOfFileAgainstList()

int _checkDatesOfFileAgainstList ( const char * fileName,
const GWEN_STRINGLIST * sl )
static

Definition at line 524 of file buildctx_run.c.

References DBG_DEBUG, GWBUILD_GetModificationTimeOfFile(), GWEN_StringList_FirstEntry(), GWEN_StringListEntry_Data(), GWEN_StringListEntry_Next(), and NULL.

Referenced by _checkDependencies().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _checkDependencies()

int _checkDependencies ( GWB_BUILD_CMD * bcmd,
GWB_BUILD_SUBCMD * subCmd,
const char * firstOutFileName )
static

Definition at line 488 of file buildctx_run.c.

References _checkDatesOfFileAgainstList(), DBG_DEBUG, GWB_BuildCmd_GetFolder(), GWB_BuildCtx_ReadAndTranslateDepfile(), GWB_BuildSubCmd_GetDepFilePath(), GWEN_StringList_free(), and NULL.

Referenced by _needRunCurrentCommand().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _checkRunningQueue()

◆ _checkWaitingQueue()

int _checkWaitingQueue ( GWB_BUILD_CONTEXT * bctx,
int maxStartAllowed )
static

◆ _createCommandQueues()

void _createCommandQueues ( GWB_BUILD_CONTEXT * bctx)
static

Definition at line 230 of file buildctx_run.c.

Referenced by GWB_BuildCtx_Run().

Here is the caller graph for this function:

◆ _decBlockingFilesInWaitingBuildCommands()

void _decBlockingFilesInWaitingBuildCommands ( GWB_BUILD_CMD_LIST2 * waitingCommands)
static

Definition at line 746 of file buildctx_run.c.

References GWB_BuildCmd_DecBlockingFiles().

Referenced by _signalJobFinished().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _fileListToTopBuildDirStringList()

GWEN_STRINGLIST * _fileListToTopBuildDirStringList ( const char * initialSourceDir,
GWB_FILE_LIST2 * fileList )

◆ _finishCurrentCommand()

void _finishCurrentCommand ( GWB_BUILD_CONTEXT * bctx,
GWB_BUILD_CMD * bcmd,
GWB_BUILD_SUBCMD * currentCommand )
static

Definition at line 701 of file buildctx_run.c.

References _signalJobFinished(), and GWB_BuildCmd_SetCurrentCommand().

Referenced by _checkRunningQueue(), and _checkWaitingQueue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _getHighestModificationTime()

time_t _getHighestModificationTime ( const GWEN_STRINGLIST * slFiles)
static

Definition at line 428 of file buildctx_run.c.

References DBG_INFO, GWBUILD_GetModificationTimeOfFile(), GWEN_StringList_FirstEntry(), GWEN_StringListEntry_Data(), GWEN_StringListEntry_Next(), and NULL.

Referenced by _inFilesNewerThanOutFiles().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _getLowestModificationTime()

time_t _getLowestModificationTime ( const GWEN_STRINGLIST * slFiles)
static

Definition at line 391 of file buildctx_run.c.

References DBG_INFO, GWBUILD_GetModificationTimeOfFile(), GWEN_StringList_FirstEntry(), GWEN_StringListEntry_Data(), GWEN_StringListEntry_Next(), and NULL.

Referenced by _inFilesNewerThanOutFiles().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _inFilesNewerThanOutFiles()

int _inFilesNewerThanOutFiles ( const GWEN_STRINGLIST * slInFiles,
const GWEN_STRINGLIST * slOutFiles )
static

Definition at line 373 of file buildctx_run.c.

References _getHighestModificationTime(), _getLowestModificationTime(), DBG_INFO, and NULL.

Referenced by _needRunCurrentCommand().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _needRunCurrentCommand()

int _needRunCurrentCommand ( GWB_BUILD_CMD * bcmd,
const GWEN_STRINGLIST * slInFiles,
const GWEN_STRINGLIST * slOutFiles )
static

◆ _printCmdOutputIfNotEmptyAndDeleteFile()

void _printCmdOutputIfNotEmptyAndDeleteFile ( GWB_BUILD_CMD * cmd,
GWB_BUILD_SUBCMD * subCmd )
static

◆ _setupCommands()

void _setupCommands ( GWB_BUILD_CONTEXT * bctx,
int forPrepareCommands )
static

Definition at line 204 of file buildctx_run.c.

References GWB_BuildCmd_GetBuildCommandList(), GWB_BuildCmd_GetPrepareCommandList(), and GWB_BuildCmd_SetCurrentCommand().

Referenced by GWB_BuildCtx_Run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _signalJobFinished()

void _signalJobFinished ( GWB_BUILD_CMD * bcmd)
static

Definition at line 717 of file buildctx_run.c.

References _decBlockingFilesInWaitingBuildCommands(), GWB_BuildCmd_GetOutFileList2(), and GWB_File_GetWaitingBuildCmdList2().

Referenced by _finishCurrentCommand().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _startCommand()

◆ _unlinkFilesInStringList()

void _unlinkFilesInStringList ( const GWEN_STRINGLIST * slFiles)
static

Definition at line 465 of file buildctx_run.c.

References DBG_DEBUG, GWEN_StringList_FirstEntry(), GWEN_StringListEntry_Data(), GWEN_StringListEntry_Next(), and NULL.

Referenced by _startCommand().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _waitForRunningJobs()

int _waitForRunningJobs ( GWB_BUILD_CONTEXT * bctx)
static

Definition at line 135 of file buildctx_run.c.

References _checkRunningQueue(), DBG_DEBUG, DBG_ERROR, DBG_INFO, GWB_BUILDCTX_PROCESS_WAIT_TIMEOUT, GWEN_ERROR_TIMEOUT, and NULL.

Referenced by GWB_BuildCtx_Run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWB_BuildCtx_Run()

int GWB_BuildCtx_Run ( GWB_BUILD_CONTEXT * bctx,
int maxConcurrentJobs,
int usePrepareCommands,
const char * builderName )

Definition at line 68 of file buildctx_run.c.

References _abortAllCommands(), _checkRunningQueue(), _checkWaitingQueue(), _createCommandQueues(), _setupCommands(), _waitForRunningJobs(), DBG_DEBUG, DBG_ERROR, DBG_INFO, GWB_BuildCtx_FillWaitingQueue(), GWB_BuildCtx_SetupDependencies(), GWEN_ERROR_GENERIC, and NULL.

Referenced by GWB_Build(), and GWB_Prepare().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ _commandLogNum

int _commandLogNum =0
static

Definition at line 38 of file buildctx_run.c.

Referenced by _printCmdOutputIfNotEmptyAndDeleteFile().