Compare commits

..

No commits in common. "master" and "v2.13.0" have entirely different histories.

3 changed files with 14 additions and 32 deletions

View File

@ -89,19 +89,11 @@ class TaskmanArtefact
{ {
if(!isset($this->sources_affected[$idx])) if(!isset($this->sources_affected[$idx]))
{ {
//NOTE: more conservative implementation which always checks for staleness $sources = $this->task->getFileChanges() != null ?
//$sources = $this->task->getFileChanges() != null ? //tries to match changed files with sources spec
// //tries to match changed files with sources spec $this->getChangedSources($idx) :
// $this->getChangedSources($idx) : $this->getSources($idx);
// $this->getSources($idx); $this->sources_affected[$idx] = is_stale($this->getPath(), $sources);
//$this->sources_affected[$idx] = is_stale($this->getPath(), $sources);
//NOTE: if there any file changes we simply check if there are any changed sources,
// and if yes then we mark the artefact as affected
if($this->task->getFileChanges() != null)
$this->sources_affected[$idx] = count($this->getChangedSources($idx)) > 0;
else
$this->sources_affected[$idx] = is_stale($this->getPath(), $this->getSources($idx));
} }
return $this->sources_affected[$idx]; return $this->sources_affected[$idx];

View File

@ -171,7 +171,6 @@ function _process_argv(array &$argv)
global $TASKMAN_BATCH; global $TASKMAN_BATCH;
global $TASKMAN_NO_DEPS; global $TASKMAN_NO_DEPS;
global $TASKMAN_FILE_CHANGES; global $TASKMAN_FILE_CHANGES;
global $TASKMAN_SHOW_BENCH;
$filtered = array(); $filtered = array();
$process_defs = false; $process_defs = false;
@ -186,6 +185,10 @@ function _process_argv(array &$argv)
$filtered[] = $argv[$j]; $filtered[] = $argv[$j];
break; break;
} }
else if($v == '-D')
{
$process_defs = true;
}
else if($v == '-V') else if($v == '-V')
{ {
$TASKMAN_LOG_LEVEL = 2; $TASKMAN_LOG_LEVEL = 2;
@ -210,10 +213,6 @@ function _process_argv(array &$argv)
{ {
$TASKMAN_NO_DEPS = true; $TASKMAN_NO_DEPS = true;
} }
else if($v == '--bench')
{
$TASKMAN_SHOW_BENCH = true;
}
else if($v == '-c') else if($v == '-c')
{ {
if(!isset($argv[$i+1])) if(!isset($argv[$i+1]))
@ -230,10 +229,6 @@ function _process_argv(array &$argv)
++$i; ++$i;
} }
else if($v == '-D')
{
$process_defs = true;
}
else if($process_defs) else if($process_defs)
{ {
$eq_pos = strpos($v, '='); $eq_pos = strpos($v, '=');
@ -296,10 +291,8 @@ function _extract_lines_from_file(string $file_path) : array
function _show_bench(array $tasks, int $limit = 5) function _show_bench(array $tasks, int $limit = 5)
{ {
if(!$tasks)
return;
$times = array(); $times = array();
foreach($tasks as $name => $task) foreach($tasks as $name => $task)
{ {
if($task->hasRun()) if($task->hasRun())
@ -307,18 +300,17 @@ function _show_bench(array $tasks, int $limit = 5)
} }
uasort($times, fn($a, $b) => $b <=> $a); uasort($times, fn($a, $b) => $b <=> $a);
if(count($times) > $limit) array_splice($times, $limit);
array_splice($times, $limit);
if(!$times) if(!$times)
return; return;
\taskman\log(1, "Top ".count($times)." time consuming tasks:\n"); \taskman\log(2, "Top ".count($times)." time consuming tasks:\n");
$n = 0; $n = 0;
foreach($times as $name => $time) foreach($times as $name => $time)
{ {
++$n; ++$n;
\taskman\log(1, "$n) Task '$name': $time sec\n"); \taskman\log(2, "$n) Task '$name': $time sec\n");
} }
} }

View File

@ -16,7 +16,6 @@ $GLOBALS['TASKMAN_LOGGER'] = '\taskman\internal\_default_logger';
$GLOBALS['TASKMAN_ERROR_HANDLER'] = null; $GLOBALS['TASKMAN_ERROR_HANDLER'] = null;
$GLOBALS['TASKMAN_START_TIME'] = 0; $GLOBALS['TASKMAN_START_TIME'] = 0;
$GLOBALS['TASKMAN_FILES_CHANGES'] = null; $GLOBALS['TASKMAN_FILES_CHANGES'] = null;
$GLOBALS['TASKMAN_SHOW_BENCH'] = false;
include_once(__DIR__ . '/internal.inc.php'); include_once(__DIR__ . '/internal.inc.php');
include_once(__DIR__ . '/util.inc.php'); include_once(__DIR__ . '/util.inc.php');
@ -526,8 +525,7 @@ function main(
else if($default_task) else if($default_task)
run($default_task, $argv); run($default_task, $argv);
if($GLOBALS['TASKMAN_SHOW_BENCH']) internal\_show_bench($task_objs);
internal\_show_bench($task_objs);
log(0, "***** All done (".round(microtime(true)-$GLOBALS['TASKMAN_START_TIME'],2)." sec.) *****\n"); log(0, "***** All done (".round(microtime(true)-$GLOBALS['TASKMAN_START_TIME'],2)." sec.) *****\n");
} }