Add support for custom source check-update callbacks in artifacts

This commit is contained in:
crazywhalecc
2026-02-28 14:35:48 +08:00
parent 0a07f6b27c
commit 28f4a5c523
4 changed files with 107 additions and 11 deletions

View File

@@ -27,6 +27,9 @@ class Artifact
/** @var null|callable Bind custom source fetcher callback */
protected mixed $custom_source_callback = null;
/** @var null|callable Bind custom source check-update callback */
protected mixed $custom_source_check_update_callback = null;
/** @var array<string, callable> Bind custom binary fetcher callbacks */
protected mixed $custom_binary_callbacks = [];
@@ -408,6 +411,19 @@ class Artifact
return $this->custom_source_callback ?? null;
}
/**
* Set custom source check-update callback.
*/
public function setCustomSourceCheckUpdateCallback(callable $callback): void
{
$this->custom_source_check_update_callback = $callback;
}
public function getCustomSourceCheckUpdateCallback(): ?callable
{
return $this->custom_source_check_update_callback ?? null;
}
public function getCustomBinaryCallback(): ?callable
{
$current_platform = SystemTarget::getCurrentPlatformString();