diff --git a/src/Pipeline/AbstractStage.php b/src/Pipeline/AbstractStage.php index a2c17dc..5e9e7fe 100644 --- a/src/Pipeline/AbstractStage.php +++ b/src/Pipeline/AbstractStage.php @@ -26,6 +26,8 @@ */ abstract readonly class AbstractStage { + protected const META_DATA_FILE = '.box.manifests.bin'; + private ?HelperInterface $debugFormatterHelper; /** diff --git a/src/Pipeline/BuildStage.php b/src/Pipeline/BuildStage.php index dcb70c0..df12590 100644 --- a/src/Pipeline/BuildStage.php +++ b/src/Pipeline/BuildStage.php @@ -10,12 +10,15 @@ use Bartlett\BoxManifest\Composer\ManifestFactory; use Bartlett\BoxManifest\Composer\ManifestOptions; use Bartlett\BoxManifest\Helper\ManifestFile; -use Bartlett\BoxManifest\Helper\ManifestFormat; use Symfony\Component\Console\Input\ArrayInput; +use function array_merge; +use function file_exists; +use function file_get_contents; use function serialize; use function sprintf; +use function unserialize; /** * @author Laurent Laville @@ -63,8 +66,15 @@ public function __invoke(array $payload): array } } - $manifests = serialize($payload['response']['artifacts'] ?? []); - $this->writeToStream('.box.manifests.bin', $manifests, 'Unable to write Manifests Metadata'); + if (file_exists(self::META_DATA_FILE)) { + // @phpstan-ignore argument.type + $metadata = unserialize(file_get_contents(self::META_DATA_FILE)); + } else { + $metadata = []; + } + + $manifests = serialize(array_merge($metadata, $payload['response']['artifacts'] ?? [])); + $this->writeToStream(self::META_DATA_FILE, $manifests, 'Unable to write Manifests Metadata'); $this->debugPrintStage( sprintf(