File tree Expand file tree Collapse file tree 4 files changed +33
-3
lines changed
Config/Schema/Action/Velox
Velox/Internal/Config/Pipeline/Processor Expand file tree Collapse file tree 4 files changed +33
-3
lines changed Original file line number Diff line number Diff line change 9595 <xs : documentation >Repository name</xs : documentation >
9696 </xs : annotation >
9797 </xs : attribute >
98+ <xs : attribute name =" replace" type =" xs:string" >
99+ <xs : annotation >
100+ <xs : documentation >Replacement source for the plugin (e.g., local path or alternative repository for Go module replacement)</xs : documentation >
101+ </xs : annotation >
102+ </xs : attribute >
98103 </xs : complexType >
99104 </xs : element >
100105 </xs : sequence >
Original file line number Diff line number Diff line change @@ -184,14 +184,16 @@ public function isFile(): bool
184184
185185 /**
186186 * Return a normalized absolute version of this path
187+ *
188+ * @param non-empty-string|null $cwd Current working directory to resolve relative paths against.
187189 */
188- public function absolute (): self
190+ public function absolute (? string $ cwd = null ): self
189191 {
190192 if ($ this ->isAbsolute ()) {
191193 return $ this ;
192194 }
193195
194- $ cwd = \getcwd ();
196+ $ cwd ?? = \getcwd ();
195197 $ cwd === false and throw new \RuntimeException ('Cannot get current working directory. ' );
196198 return self ::create ($ cwd . self ::DS . $ this ->path );
197199 }
Original file line number Diff line number Diff line change @@ -34,4 +34,8 @@ final class Plugin
3434 /** @var non-empty-string|null $repository Repository name */
3535 #[XPath('@repository ' )]
3636 public ?string $ repository = null ;
37+
38+ /** @var non-empty-string|null $replace Replacement source */
39+ #[XPath('@replace ' )]
40+ public ?string $ replace = null ;
3741}
Original file line number Diff line number Diff line change 44
55namespace Internal \DLoad \Module \Velox \Internal \Config \Pipeline \Processor ;
66
7+ use Internal \DLoad \Module \Common \FileSystem \Path ;
78use Internal \DLoad \Module \Velox \Internal \Config \Pipeline \ConfigContext ;
89use Internal \DLoad \Module \Velox \Internal \Config \Pipeline \ConfigProcessor ;
910
@@ -27,10 +28,28 @@ public function __invoke(ConfigContext $context): ConfigContext
2728 $ appliedMixins [] = 'roadrunner_ref ' ;
2829 }
2930
31+ // Merge replacements
32+ foreach ($ context ->action ->plugins as $ plugin ) {
33+ if ($ plugin ->replace === null ) {
34+ continue ;
35+ }
36+
37+
38+ $ tomlData = $ tomlData ->set (
39+ 'github.plugins. ' . $ plugin ->name . '.replace ' ,
40+ \str_starts_with ($ plugin ->replace , 'github.com/ ' )
41+ ? $ plugin ->replace
42+ : Path::create ($ plugin ->replace )->absolute ()->__toString (),
43+ );
44+ }
45+
46+
3047 $ tomlData = $ tomlData ->set ('debug.enabled ' , $ context ->action ->debug );
3148 $ appliedMixins [] = 'debug_enabled ' ;
49+ $ tomlData ->toToml ();
3250
33- return $ context ->withTomlData ($ tomlData )
51+ return $ context
52+ ->withTomlData ($ tomlData )
3453 ->addMetadata ('build_mixins_applied ' , true )
3554 ->addMetadata ('applied_mixins ' , $ appliedMixins );
3655 }
You can’t perform that action at this time.
0 commit comments