diff --git a/src/Downloader.php b/src/Downloader.php index f961ae1ee..1894291a0 100644 --- a/src/Downloader.php +++ b/src/Downloader.php @@ -31,6 +31,7 @@ class Downloader private static $MAX_LENGTH = 1000; private static $versions; + private $composerConfig; private $io; private $sess; private $cache; @@ -49,9 +50,9 @@ public function __construct(Composer $composer, IoInterface $io, $rfs) $this->endpoint = rtrim(getenv('SYMFONY_ENDPOINT') ?: ($composer->getPackage()->getExtra()['symfony']['endpoint'] ?? self::$DEFAULT_ENDPOINT), '/'); $this->io = $io; - $config = $composer->getConfig(); + $this->composerConfig = $composer->getConfig(); $this->rfs = $rfs; - $this->cache = new ComposerCache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->endpoint)); + $this->cache = new ComposerCache($io, $this->composerConfig->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->endpoint)); $this->sess = bin2hex(random_bytes(16)); } @@ -91,6 +92,7 @@ public function getRecipes(array $operations): array $this->io->writeError('Using "'.$this->endpoint.'" as the Symfony endpoint'); } + $localManifestPaths = []; $paths = []; $chunk = ''; foreach ($operations as $i => $operation) { @@ -125,6 +127,14 @@ public function getRecipes(array $operations): array } } + $localPackagePath = sprintf( + '%s/%s', + $this->composerConfig->get('vendor-dir'), + $package->getName() + ); + + $localManifestPaths[$package->getName()] = sprintf('%s/recipe/manifest.json', $localPackagePath); + // FIXME: Multi name with getNames() $name = str_replace('/', ',', $package->getName()); $path = sprintf('%s,%s%s', $name, $o, $version); @@ -165,6 +175,22 @@ public function getRecipes(array $operations): array }); } + foreach ($localManifestPaths as $name => $manifestPath) { + if (!file_exists($manifestPath)) { + continue; + } + + $content = json_decode(file_get_contents($manifestPath), true); + + $bodies[] = [ + 'manifests' => [ + $name => [ + 'manifest' => $content + ] + ] + ]; + } + $data = []; foreach ($bodies as $body) { foreach ($body['manifests'] as $name => $manifest) {