Skip to content

Commit

Permalink
Merge pull request #9 from moufmouf/debug_multi_packages
Browse files Browse the repository at this point in the history
Removing duplicate packages from Composer before generating dump
  • Loading branch information
moufmouf authored Jan 5, 2018
2 parents c7503a4 + 7308ba8 commit 8bad73d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
language: php
php:
- 7.0
- 7.1
- 7.0
- 7.1
- 7.2
before_script:
- composer self-update
- composer clear-cache
Expand Down
11 changes: 10 additions & 1 deletion src/AssetsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,16 @@ public function findAssetTypes(RepositoryInterface $repository) : array
{
$unorderedPackagesList = $repository->getPackages();

$orderedPackageList = PackagesOrderer::reorderPackages($unorderedPackagesList);
// For some weird reason, some packages can be in double in the repository.
// This has been observed when doing a "composer install" on an empty vendor directory.
// Let's ensure each package is represented only once.
$dedupPackages = [];
foreach($unorderedPackagesList as $package) {
$dedupPackages[$package->getName()] = $package;
}
$dedupPackages = array_values($dedupPackages);

$orderedPackageList = PackagesOrderer::reorderPackages($dedupPackages);

$packages = array_filter($orderedPackageList, function (PackageInterface $package) {
$packageInstallPath = $this->getInstallPath($package);
Expand Down

0 comments on commit 8bad73d

Please sign in to comment.