diff --git a/src/Build.php b/src/Build.php index 56d7568..abe6d15 100644 --- a/src/Build.php +++ b/src/Build.php @@ -45,7 +45,7 @@ public function check(array &$errors = null):int { */ public function build(array &$errors = null):array { $updatedTasks = []; - foreach($this->taskList as $pathMatch => $task) { + foreach($this->taskList as $task) { if($task->build($errors)) { $updatedTasks []= $task; } @@ -53,4 +53,4 @@ public function build(array &$errors = null):array { return $updatedTasks; } -} \ No newline at end of file +} diff --git a/src/Task.php b/src/Task.php index 6aca741..cdd1674 100644 --- a/src/Task.php +++ b/src/Task.php @@ -57,20 +57,23 @@ public function check(array &$errors = null):void { } public function build(array &$errors = null):bool { - $changes = false; + $hashMiss = false; foreach(Glob::glob($this->absolutePath) as $matchedPath) { $hash = filemtime($matchedPath); $existingHash = $this->fileHashList[$matchedPath] ?? null; if($hash !== $existingHash) { - $changes = $this->execute($errors); + $hashMiss = true; } $this->fileHashList[$matchedPath] = $hash; } - return $changes; + if($hashMiss) { + return $this->execute($errors); + } + return false; } public function requirementFromRequireBlockItem( @@ -160,4 +163,4 @@ protected function isAbsolutePath(string $path):bool { // Windows: || preg_match('~\A[A-Z]:(?![^/\\\\])~i',$path) > 0; } -} \ No newline at end of file +}