From 5b9621cd50f5ed5df50cec88015002ea345560b2 Mon Sep 17 00:00:00 2001 From: Dmitry Bukavin Date: Thu, 6 Jun 2019 12:23:41 +0300 Subject: [PATCH 1/5] updated phing to 3 version --- composer.json | 6 ++++-- src/ForeachParallelTask.php | 38 +++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/composer.json b/composer.json index 71a9251..0b9509d 100644 --- a/composer.json +++ b/composer.json @@ -10,9 +10,11 @@ "email": "matthias@krauser.eu" } ], + "prefer-stable": true, + "minimum-stability": "dev", "require": { - "php": ">=5.3", - "phing/phing": ">=2.7.0" + "php": ">=7.1", + "phing/phing": "^3.0.0" }, "autoload": { "psr-4": { diff --git a/src/ForeachParallelTask.php b/src/ForeachParallelTask.php index 2145ada..43885c0 100644 --- a/src/ForeachParallelTask.php +++ b/src/ForeachParallelTask.php @@ -20,16 +20,15 @@ namespace MaK\Phing\Task; -use \BuildException; -use \FileList; -use \FileSet; -use \Mapper; -use \PhingFile; -use \Project; -use \Task; - -use \DocBlox_Parallel_Manager, - \DocBlox_Parallel_Worker; +use BuildException; +use \MehrAlsNix\Parallel\Manager; +use \MehrAlsNix\Parallel\Worker; +use FileList; +use FileSet; +use Mapper; +use PhingFile; +use Project; +use Task; /** * task @@ -136,17 +135,14 @@ public function main() throw new BuildException("You must supply a target to perform"); } - @include_once 'phing/contrib/DocBlox/Parallel/Manager.php'; - @include_once 'phing/contrib/DocBlox/Parallel/Worker.php'; - @include_once 'phing/contrib/DocBlox/Parallel/WorkerPipe.php'; - if (!class_exists('DocBlox_Parallel_Worker')) { + if (!class_exists(Worker::class)) { throw new BuildException( - 'ForeachParallelTask depends on DocBlox being installed and on include_path.', + 'ForeachParallelTask depends on phpDocumentor/Parallel being installed and on include_path.', $this->getLocation() ); } - $parallelManager = new DocBlox_Parallel_Manager(); + $parallelManager = new Manager(); $parallelManager->setProcessLimit($this->threadCount); $mapper = null; @@ -180,7 +176,7 @@ public function main() $prop->setOverride(true); $prop->setName($this->param); $prop->setValue($value); - $worker = new DocBlox_Parallel_Worker( + $worker = new Worker( array($callee, 'main'), array($callee) ); @@ -222,7 +218,7 @@ public function main() * @param array $srcFiles * @param array $srcDirs */ - protected function process(DocBlox_Parallel_Manager $parallelManager, Task $callee, PhingFile $fromDir, $srcFiles, $srcDirs) + protected function process(Manager $parallelManager, Task $callee, PhingFile $fromDir, $srcFiles, $srcDirs) { $mapper = null; @@ -261,7 +257,7 @@ protected function process(DocBlox_Parallel_Manager $parallelManager, Task $call $prop->setValue($value); } - $worker = new DocBlox_Parallel_Worker( + $worker = new Worker( array($callee, 'main'), array($callee) ); @@ -300,7 +296,7 @@ protected function process(DocBlox_Parallel_Manager $parallelManager, Task $call $prop->setValue($value); } - $worker = new DocBlox_Parallel_Worker( + $worker = new Worker( array($callee, 'main'), array($callee) ); @@ -363,7 +359,7 @@ public function addFileSet(FileSet $fs) public function createMapper() { if ($this->mapperElement !== null) { - throw new BuildException("Cannot define more than one mapper", $this->location); + throw new BuildException("Cannot define more than one mapper", $this->getLocation()); } $this->mapperElement = new Mapper($this->project); From 74bee567ba69db7eeedfa42b5f1f8b0ed2e22fa4 Mon Sep 17 00:00:00 2001 From: Dmitry Bukavin Date: Mon, 1 Nov 2021 15:31:48 +0200 Subject: [PATCH 2/5] updated phing to 3.0.0-RC3 --- .gitignore | 8 +++- composer.json | 7 ++-- src/ForeachParallelTask.php | 75 ++++++++++++++++++++++--------------- 3 files changed, 55 insertions(+), 35 deletions(-) diff --git a/.gitignore b/.gitignore index 3001e63..c788e08 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,8 @@ +composer.lock + +custom.type.properties +custom.task.properties + .buildpath .DS_Store .idea @@ -6,7 +11,6 @@ .*.sw* .*.un~ build/ -composer.lock nbproject tmp/ -/vendor \ No newline at end of file +/vendor diff --git a/composer.json b/composer.json index 0b9509d..b98a476 100644 --- a/composer.json +++ b/composer.json @@ -13,12 +13,13 @@ "prefer-stable": true, "minimum-stability": "dev", "require": { - "php": ">=7.1", - "phing/phing": "^3.0.0" + "php": "^7.3 || ^7.4 || ^8.0", + "phing/phing": "^3.0.0", + "ext-json": "*" }, "autoload": { "psr-4": { "MaK\\Phing\\Task\\": "src/" } } -} \ No newline at end of file +} diff --git a/src/ForeachParallelTask.php b/src/ForeachParallelTask.php index 43885c0..cc2e40a 100644 --- a/src/ForeachParallelTask.php +++ b/src/ForeachParallelTask.php @@ -20,15 +20,18 @@ namespace MaK\Phing\Task; -use BuildException; -use \MehrAlsNix\Parallel\Manager; -use \MehrAlsNix\Parallel\Worker; -use FileList; -use FileSet; -use Mapper; -use PhingFile; -use Project; -use Task; +use MehrAlsNix\Parallel\Manager; +use MehrAlsNix\Parallel\Worker; +use Phing\Exception\BuildException; +use Phing\Io\File; +use Phing\Io\FileSystem; +use Phing\Project; +use Phing\Task; +use Phing\Task\System\PhingTask; +use Phing\Task\System\PropertyTask; +use Phing\Type\FileList; +use Phing\Type\FileSet; +use Phing\Type\Mapper; /** * task @@ -62,6 +65,12 @@ */ class ForeachParallelTask extends Task { + /** + * The called Phing task. + * + * @var PhingTask + */ + private $callee; /** Delimter-separated list of values to process. */ private $list; @@ -106,7 +115,7 @@ class ForeachParallelTask extends Task * Total number of directories processed * @var integer */ - private $total_dirs = 0; + private $total_dirs = 0; private function getCallee() { @@ -115,6 +124,7 @@ private function getCallee() $callee->setTaskName($this->getTaskName()); $callee->setLocation($this->getLocation()); $callee->init(); + $this->callee = $callee; return $callee; } @@ -166,7 +176,8 @@ public function main() } $value = array_shift($value); } - $this->log("Setting param '$this->param' to value '$value'" . ($premapped ? " (mapped from '$premapped')" : ''), Project::MSG_VERBOSE); + $this->log("Setting param '$this->param' to value '$value'" . ($premapped ? " (mapped from '$premapped')" : ''), + Project::MSG_VERBOSE); $callee = $this->getCallee(); $callee->setTarget($this->calleeTarget); $callee->setInheritAll(true); @@ -194,9 +205,9 @@ public function main() // filesets foreach ($this->filesets as $fs) { - $ds = $fs->getDirectoryScanner($this->project); + $ds = $fs->getDirectoryScanner($this->project); $srcFiles = $ds->getIncludedFiles(); - $srcDirs = $ds->getIncludedDirectories(); + $srcDirs = $ds->getIncludedDirectories(); $this->process($parallelManager, $this->getCallee(), $fs->getDir($this->project), $srcFiles, $srcDirs); } @@ -204,21 +215,23 @@ public function main() $parallelManager->execute(); if ($this->list === null) { - $this->log("Processed {$this->total_dirs} directories and {$this->total_files} files", Project::MSG_VERBOSE); + $this->log("Processed {$this->total_dirs} directories and {$this->total_files} files", + Project::MSG_VERBOSE); } else { - $this->log("Processed $total_entries entr" . ($total_entries > 1 ? 'ies' : 'y') . " in list", Project::MSG_VERBOSE); + $this->log("Processed $total_entries entr" . ($total_entries > 1 ? 'ies' : 'y') . " in list", + Project::MSG_VERBOSE); } } /** * Processes a list of files & directories * - * @param Task $callee - * @param PhingFile $fromDir - * @param array $srcFiles - * @param array $srcDirs + * @param Task $callee + * @param File $fromDir + * @param array $srcFiles + * @param array $srcDirs */ - protected function process(Manager $parallelManager, Task $callee, PhingFile $fromDir, $srcFiles, $srcDirs) + protected function process(Manager $parallelManager, Task $callee, File $fromDir, $srcFiles, $srcDirs) { $mapper = null; @@ -250,7 +263,8 @@ protected function process(Manager $parallelManager, Task $callee, PhingFile $fr } if ($this->param) { - $this->log("Setting param '$this->param' to value '$value'" . ($premapped ? " (mapped from '$premapped')" : ''), Project::MSG_VERBOSE); + $this->log("Setting param '$this->param' to value '$value'" . ($premapped ? " (mapped from '$premapped')" : ''), + Project::MSG_VERBOSE); $prop = $callee->createProperty(); $prop->setOverride(true); $prop->setName($this->param); @@ -268,7 +282,7 @@ protected function process(Manager $parallelManager, Task $callee, PhingFile $fr $dircount = count($srcDirs); $this->total_dirs += $dircount; - for ($j = 0; $j < $dircount; $j++) { + for ($j = 0; $j < $dircount; $j++) { $value = $srcDirs[$j]; $premapped = ""; @@ -289,7 +303,8 @@ protected function process(Manager $parallelManager, Task $callee, PhingFile $fr } if ($this->param) { - $this->log("Setting param '$this->param' to value '$value'" . ($premapped ? " (mapped from '$premapped')" : ''), Project::MSG_VERBOSE); + $this->log("Setting param '$this->param' to value '$value'" . ($premapped ? " (mapped from '$premapped')" : ''), + Project::MSG_VERBOSE); $prop = $callee->createProperty(); $prop->setOverride(true); $prop->setName($this->param); @@ -307,27 +322,27 @@ protected function process(Manager $parallelManager, Task $callee, PhingFile $fr public function setList($list) { - $this->list = (string) $list; + $this->list = (string)$list; } public function setTarget($target) { - $this->calleeTarget = (string) $target; + $this->calleeTarget = (string)$target; } public function setParam($param) { - $this->param = (string) $param; + $this->param = (string)$param; } public function setAbsparam($absparam) { - $this->absparam = (string) $absparam; + $this->absparam = (string)$absparam; } public function setDelimiter($delimiter) { - $this->delimiter = (string) $delimiter; + $this->delimiter = (string)$delimiter; } /** @@ -367,7 +382,7 @@ public function createMapper() } /** - * @return Property + * @return PropertyTask */ public function createProperty() { @@ -382,6 +397,6 @@ public function createFileList() { $num = array_push($this->filelists, new FileList()); - return $this->filelists[$num-1]; + return $this->filelists[$num - 1]; } } From f9a221ac32a54dd5ba09833286bba7cd919f8b7e Mon Sep 17 00:00:00 2001 From: Dmitry Bukavin Date: Tue, 18 Apr 2023 17:34:32 +0300 Subject: [PATCH 3/5] updated phing to dev-main --- composer.json | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index b98a476..f0d1f6a 100644 --- a/composer.json +++ b/composer.json @@ -13,13 +13,18 @@ "prefer-stable": true, "minimum-stability": "dev", "require": { - "php": "^7.3 || ^7.4 || ^8.0", - "phing/phing": "^3.0.0", + "php": "^7.3 || ^7.4 || ^8.0 || ^8.1 || ^8.2", + "phing/phing": "dev-main", "ext-json": "*" }, "autoload": { "psr-4": { "MaK\\Phing\\Task\\": "src/" } + }, + "config": { + "allow-plugins": { + "phing/phing-composer-configurator": true + } } } From 7487acd04e7249d7e7e4c015deb128a2c737abdd Mon Sep 17 00:00:00 2001 From: Dmitry Bukavin Date: Thu, 20 Apr 2023 17:53:08 +0300 Subject: [PATCH 4/5] fixed dependencies --- composer.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index f0d1f6a..264e73a 100644 --- a/composer.json +++ b/composer.json @@ -14,8 +14,9 @@ "minimum-stability": "dev", "require": { "php": "^7.3 || ^7.4 || ^8.0 || ^8.1 || ^8.2", - "phing/phing": "dev-main", - "ext-json": "*" + "ext-json": "*", + "mehr-als-nix/parallel": "^1.0", + "phing/phing": "dev-main" }, "autoload": { "psr-4": { @@ -23,6 +24,7 @@ } }, "config": { + "sort-packages": true, "allow-plugins": { "phing/phing-composer-configurator": true } From 05db2ac0680bb5c12aa87c6ae162fcb1a2fa8ca8 Mon Sep 17 00:00:00 2001 From: Dmitry Bukavin Date: Thu, 23 May 2024 22:58:36 +0300 Subject: [PATCH 5/5] fixed dependencies --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 264e73a..990dd30 100644 --- a/composer.json +++ b/composer.json @@ -13,10 +13,10 @@ "prefer-stable": true, "minimum-stability": "dev", "require": { - "php": "^7.3 || ^7.4 || ^8.0 || ^8.1 || ^8.2", + "php": "^7.3 || ^7.4 || ^8.0 || ^8.1 || ^8.2 || ^8.3", "ext-json": "*", "mehr-als-nix/parallel": "^1.0", - "phing/phing": "dev-main" + "phing/phing": "*" }, "autoload": { "psr-4": {