Skip to content
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

Dependency patch resolution #547

Merged
merged 7 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Small cleanups
  • Loading branch information
cweagans committed Feb 14, 2024
commit 51318008899a618bdf173057b17c686e32217074
2 changes: 1 addition & 1 deletion src/Patch.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Patch implements JsonSerializable
public ?string $localPath;

/**
* This is unused in the main plugin, but can be used as a place for other plugins to store data about a patch.
* Can be used as a place for other plugins to store data about a patch.
*
* This should be treated as an associative array and should contain only scalar values.
*
Expand Down
8 changes: 4 additions & 4 deletions src/Resolver/PatchesFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ class PatchesFile extends ResolverBase
*/
public function resolve(PatchCollection $collection): void
{
$patches_file = $this->plugin->getConfig('patches-file');
$valid_patches_file = file_exists(realpath($patches_file)) && is_readable(realpath($patches_file));
$patches_file_path = $this->plugin->getConfig('patches-file');
$valid_patches_file = file_exists(realpath($patches_file_path)) && is_readable(realpath($patches_file_path));

// If we don't have a valid patches file, exit early.
if (!$valid_patches_file) {
return;
}

$this->io->write(' - <info>Resolving patches from patches file.</info>');
$patches_file = $this->readPatchesFile($patches_file);
$patches_file = $this->readPatchesFile($patches_file_path);

foreach ($this->findPatchesInJson($patches_file) as $package => $patches) {
foreach ($patches as $patch) {
/** @var Patch $patch */
$patch->extra['provenance'] = "patches-file:" . $patches_file;
$patch->extra['provenance'] = "patches-file:" . $patches_file_path;
$collection->addPatch($patch);
}
}
Expand Down