From 4319b16d4daca4feaf52cf4ca754866244519f79 Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Tue, 11 Nov 2025 17:18:28 +0400 Subject: [PATCH 1/3] feat(Velox): Support `replace` option --- src/Module/Common/FileSystem/Path.php | 6 ++++-- .../Config/Schema/Action/Velox/Plugin.php | 4 ++++ .../Processor/BuildMixinsProcessor.php | 21 ++++++++++++++++++- .../Pipeline/Processor/RemoteApiProcessor.php | 1 + 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/Module/Common/FileSystem/Path.php b/src/Module/Common/FileSystem/Path.php index 57447ef..59fd588 100644 --- a/src/Module/Common/FileSystem/Path.php +++ b/src/Module/Common/FileSystem/Path.php @@ -184,14 +184,16 @@ public function isFile(): bool /** * Return a normalized absolute version of this path + * + * @param non-empty-string|null $cwd Current working directory to resolve relative paths against. */ - public function absolute(): self + public function absolute(?string $cwd = null): self { if ($this->isAbsolute()) { return $this; } - $cwd = \getcwd(); + $cwd ??= \getcwd(); $cwd === false and throw new \RuntimeException('Cannot get current working directory.'); return self::create($cwd . self::DS . $this->path); } diff --git a/src/Module/Config/Schema/Action/Velox/Plugin.php b/src/Module/Config/Schema/Action/Velox/Plugin.php index a69f978..09542c9 100644 --- a/src/Module/Config/Schema/Action/Velox/Plugin.php +++ b/src/Module/Config/Schema/Action/Velox/Plugin.php @@ -34,4 +34,8 @@ final class Plugin /** @var non-empty-string|null $repository Repository name */ #[XPath('@repository')] public ?string $repository = null; + + /** @var non-empty-string|null $replace Replacement source */ + #[XPath('@replace')] + public ?string $replace = null; } diff --git a/src/Module/Velox/Internal/Config/Pipeline/Processor/BuildMixinsProcessor.php b/src/Module/Velox/Internal/Config/Pipeline/Processor/BuildMixinsProcessor.php index 020737a..fc12249 100644 --- a/src/Module/Velox/Internal/Config/Pipeline/Processor/BuildMixinsProcessor.php +++ b/src/Module/Velox/Internal/Config/Pipeline/Processor/BuildMixinsProcessor.php @@ -4,6 +4,7 @@ namespace Internal\DLoad\Module\Velox\Internal\Config\Pipeline\Processor; +use Internal\DLoad\Module\Common\FileSystem\Path; use Internal\DLoad\Module\Velox\Internal\Config\Pipeline\ConfigContext; use Internal\DLoad\Module\Velox\Internal\Config\Pipeline\ConfigProcessor; @@ -27,10 +28,28 @@ public function __invoke(ConfigContext $context): ConfigContext $appliedMixins[] = 'roadrunner_ref'; } + // Merge replacements + foreach ($context->action->plugins as $plugin) { + if ($plugin->replace === null) { + continue; + } + + + $tomlData = $tomlData->set( + 'github.plugins.' . $plugin->name . '.replace', + \str_starts_with($plugin->replace, 'github.com/') + ? $plugin->replace + : Path::create($plugin->replace)->absolute()->__toString(), + ); + } + + $tomlData = $tomlData->set('debug.enabled', $context->action->debug); $appliedMixins[] = 'debug_enabled'; + $tomlData->toToml(); - return $context->withTomlData($tomlData) + return $context + ->withTomlData($tomlData) ->addMetadata('build_mixins_applied', true) ->addMetadata('applied_mixins', $appliedMixins); } diff --git a/src/Module/Velox/Internal/Config/Pipeline/Processor/RemoteApiProcessor.php b/src/Module/Velox/Internal/Config/Pipeline/Processor/RemoteApiProcessor.php index 610923a..3f5aa31 100644 --- a/src/Module/Velox/Internal/Config/Pipeline/Processor/RemoteApiProcessor.php +++ b/src/Module/Velox/Internal/Config/Pipeline/Processor/RemoteApiProcessor.php @@ -4,6 +4,7 @@ namespace Internal\DLoad\Module\Velox\Internal\Config\Pipeline\Processor; +use Internal\DLoad\Module\Common\FileSystem\Path; use Internal\DLoad\Module\Velox\ApiClient; use Internal\DLoad\Module\Velox\Internal\Config\Pipeline\ConfigContext; use Internal\DLoad\Module\Velox\Internal\Config\Pipeline\ConfigProcessor; From d5eb984191f0058bc9301628afc3cc8a381c3877 Mon Sep 17 00:00:00 2001 From: github-actions Date: Tue, 11 Nov 2025 13:20:38 +0000 Subject: [PATCH 2/3] style(php-cs-fixer): fix coding standards --- .../Internal/Config/Pipeline/Processor/RemoteApiProcessor.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Module/Velox/Internal/Config/Pipeline/Processor/RemoteApiProcessor.php b/src/Module/Velox/Internal/Config/Pipeline/Processor/RemoteApiProcessor.php index 3f5aa31..610923a 100644 --- a/src/Module/Velox/Internal/Config/Pipeline/Processor/RemoteApiProcessor.php +++ b/src/Module/Velox/Internal/Config/Pipeline/Processor/RemoteApiProcessor.php @@ -4,7 +4,6 @@ namespace Internal\DLoad\Module\Velox\Internal\Config\Pipeline\Processor; -use Internal\DLoad\Module\Common\FileSystem\Path; use Internal\DLoad\Module\Velox\ApiClient; use Internal\DLoad\Module\Velox\Internal\Config\Pipeline\ConfigContext; use Internal\DLoad\Module\Velox\Internal\Config\Pipeline\ConfigProcessor; From f79f0ea39cf0df921cf89aefd8de635f84f7a5a2 Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Tue, 11 Nov 2025 17:25:10 +0400 Subject: [PATCH 3/3] chore(Velox): Update XML schema --- dload.xsd | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dload.xsd b/dload.xsd index a73eac3..7c79880 100644 --- a/dload.xsd +++ b/dload.xsd @@ -95,6 +95,11 @@ Repository name + + + Replacement source for the plugin (e.g., local path or alternative repository for Go module replacement) + +