-
-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Made patches.lock.json configurable #533 #584
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,23 +85,6 @@ class Patches implements PluginInterface, EventSubscriberInterface, Capable | |
|
||
protected JsonFile $lockFile; | ||
|
||
/** | ||
* Get the path to the current patches lock file. | ||
*/ | ||
public static function getPatchesLockFilePath(): string | ||
{ | ||
$composer_file = \Composer\Factory::getComposerFile(); | ||
|
||
$dir = dirname(realpath($composer_file)); | ||
$base = pathinfo($composer_file, \PATHINFO_FILENAME); | ||
|
||
if ($base === 'composer') { | ||
return "$dir/patches.lock.json"; | ||
} | ||
|
||
return "$dir/$base-patches.lock.json"; | ||
} | ||
|
||
/** | ||
* Apply plugin modifications to composer | ||
* | ||
|
@@ -115,12 +98,6 @@ public function activate(Composer $composer, IOInterface $io): void | |
$this->executor = new ProcessExecutor($this->io); | ||
$this->patches = array(); | ||
$this->installedPatches = array(); | ||
$this->lockFile = new JsonFile( | ||
static::getPatchesLockFilePath(), | ||
null, | ||
$this->io | ||
); | ||
$this->locker = new Locker($this->lockFile); | ||
$this->configuration = [ | ||
'disable-resolvers' => [ | ||
'type' => 'list', | ||
|
@@ -146,12 +123,41 @@ public function activate(Composer $composer, IOInterface $io): void | |
'type' => 'string', | ||
'default' => 'patches.json', | ||
], | ||
'patches-lock-file' => [ | ||
'type' => 'string', | ||
'default' => 'patches.lock.json', | ||
], | ||
"ignore-dependency-patches" => [ | ||
'type' => 'list', | ||
'default' => [], | ||
], | ||
]; | ||
$this->configure($this->composer->getPackage()->getExtra(), 'composer-patches'); | ||
$this->lockFile = new JsonFile( | ||
$this->getPatchesLockFilePath(), | ||
null, | ||
$this->io | ||
); | ||
$this->locker = new Locker($this->lockFile); | ||
} | ||
|
||
/** | ||
* Get the path to the current patches lock file. | ||
*/ | ||
public function getPatchesLockFilePath(): string | ||
{ | ||
$composer_file = \Composer\Factory::getComposerFile(); | ||
|
||
$dir = dirname(realpath($composer_file)); | ||
$base = pathinfo($composer_file, \PATHINFO_FILENAME); | ||
|
||
$lock_file = $this->getConfig('patches-lock-file'); | ||
|
||
if ($base === 'composer') { | ||
return "$dir/$lock_file"; | ||
} | ||
|
||
return "$dir/$base-$lock_file"; | ||
Comment on lines
+156
to
+160
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right now, if you set This isn't incorrect, but it is something that docs and tests will need to account for. Just flagging for visibility. |
||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't remember why this was a static function. Might be worth checking if this breaks any of the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yeah. https://github.com/cweagans/composer-patches/actions/runs/9645839515/job/26616352752?pr=584#step:5:137
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By not calling the method while registering, its fixed.
Parsing extra's just for the description is not worth it?