diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php
index 5aef46bea..f0c74a728 100644
--- a/src/Composer/Installer.php
+++ b/src/Composer/Installer.php
@@ -297,10 +297,9 @@ class Installer
$this->eventDispatcher->dispatchScript($eventName, $this->devMode);
}
- // force binaries re-generation
- $this->io->writeError('Installing binaries files');
+ // force binaries re-generation in case they are missing
foreach ($localRepo->getPackages() as $package) {
- $this->installationManager->installBinary($package);
+ $this->installationManager->ensureBinariesPresence($package);
}
$vendorDir = $this->config->get('vendor-dir');
diff --git a/src/Composer/Installer/BinaryInstaller.php b/src/Composer/Installer/BinaryInstaller.php
index bbf57f8bf..b1c7703ea 100644
--- a/src/Composer/Installer/BinaryInstaller.php
+++ b/src/Composer/Installer/BinaryInstaller.php
@@ -47,7 +47,7 @@ class BinaryInstaller
$this->filesystem = $filesystem ?: new Filesystem();
}
- public function installBinaries(PackageInterface $package, $installPath)
+ public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true)
{
$binaries = $this->getBinaries($package);
if (!$binaries) {
@@ -75,7 +75,9 @@ class BinaryInstaller
// is a fresh install of the vendor.
Silencer::call('chmod', $link, 0777 & ~umask());
}
- $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
+ if ($warnOnOverwrite) {
+ $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
+ }
continue;
}
diff --git a/src/Composer/Installer/InstallerBinaryInterface.php b/src/Composer/Installer/BinaryPresenceInterface.php
similarity index 73%
rename from src/Composer/Installer/InstallerBinaryInterface.php
rename to src/Composer/Installer/BinaryPresenceInterface.php
index e87a62bd3..2749ffafd 100644
--- a/src/Composer/Installer/InstallerBinaryInterface.php
+++ b/src/Composer/Installer/BinaryPresenceInterface.php
@@ -17,15 +17,14 @@ use Composer\Package\PackageInterface;
/**
* Interface for the package installation manager that handle binary installation.
*
- * @author Konstantin Kudryashov
* @author Jordi Boggiano
*/
-interface InstallerBinaryInterface
+interface BinaryPresenceInterface
{
/**
- * Installs binary file for a specific package.
+ * Make sure binaries are installed for a given package.
*
* @param PackageInterface $package package instance
*/
- public function installBinary(PackageInterface $package);
+ public function ensureBinariesPresence(PackageInterface $package);
}
diff --git a/src/Composer/Installer/InstallationManager.php b/src/Composer/Installer/InstallationManager.php
index 6734aa7e3..b69744e7e 100644
--- a/src/Composer/Installer/InstallationManager.php
+++ b/src/Composer/Installer/InstallationManager.php
@@ -133,7 +133,7 @@ class InstallationManager
*
* @param PackageInterface $package Package instance
*/
- public function installBinary(PackageInterface $package)
+ public function ensureBinariesPresence(PackageInterface $package)
{
try {
$installer = $this->getInstaller($package->getType());
@@ -143,8 +143,8 @@ class InstallationManager
}
// if the given installer support installing binaries
- if ($installer instanceof InstallerBinaryInterface) {
- $installer->installBinary($package);
+ if ($installer instanceof BinaryPresenceInterface) {
+ $installer->ensureBinariesPresence($package);
}
}
diff --git a/src/Composer/Installer/LibraryInstaller.php b/src/Composer/Installer/LibraryInstaller.php
index dc11b6918..4b1a95546 100644
--- a/src/Composer/Installer/LibraryInstaller.php
+++ b/src/Composer/Installer/LibraryInstaller.php
@@ -25,7 +25,7 @@ use Composer\Util\Silencer;
* @author Jordi Boggiano
* @author Konstantin Kudryashov
*/
-class LibraryInstaller implements InstallerInterface, InstallerBinaryInterface
+class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
{
protected $composer;
protected $vendorDir;
@@ -150,14 +150,13 @@ class LibraryInstaller implements InstallerInterface, InstallerBinaryInterface
}
/**
- * Re-install binary by removing previous one
+ * Make sure binaries are installed for a given package.
*
* @param PackageInterface $package Package instance
*/
- public function installBinary(PackageInterface $package)
+ public function ensureBinariesPresence(PackageInterface $package)
{
- $this->binaryInstaller->removeBinaries($package);
- $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package));
+ $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
}
/**
diff --git a/tests/Composer/Test/Fixtures/functional/create-project-command.test b/tests/Composer/Test/Fixtures/functional/create-project-command.test
index 73b3700ce..bdb04303c 100644
--- a/tests/Composer/Test/Fixtures/functional/create-project-command.test
+++ b/tests/Composer/Test/Fixtures/functional/create-project-command.test
@@ -11,4 +11,3 @@ Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
-Installing binaries files
diff --git a/tests/Composer/Test/Fixtures/installer/abandoned-listed.test b/tests/Composer/Test/Fixtures/installer/abandoned-listed.test
index d550bfda5..bc8a0cdb6 100644
--- a/tests/Composer/Test/Fixtures/installer/abandoned-listed.test
+++ b/tests/Composer/Test/Fixtures/installer/abandoned-listed.test
@@ -30,7 +30,6 @@ Updating dependencies (including require-dev)
Package c/c is abandoned, you should avoid using it. Use b/b instead.
Writing lock file
Generating autoload files
-Installing binaries files
--EXPECT--
Installing a/a (1.0.0)
diff --git a/tests/Composer/Test/Fixtures/installer/github-issues-4795-2.test b/tests/Composer/Test/Fixtures/installer/github-issues-4795-2.test
index 7785f4ff2..29fc0d38f 100644
--- a/tests/Composer/Test/Fixtures/installer/github-issues-4795-2.test
+++ b/tests/Composer/Test/Fixtures/installer/github-issues-4795-2.test
@@ -38,7 +38,6 @@ Loading composer repositories with package information
Updating dependencies (including require-dev)
Writing lock file
Generating autoload files
-Installing binaries files
--EXPECT--
Updating a (1.0.0) to a (1.1.0)
diff --git a/tests/Composer/Test/Fixtures/installer/github-issues-4795.test b/tests/Composer/Test/Fixtures/installer/github-issues-4795.test
index 739e3fc6c..5a1158f26 100644
--- a/tests/Composer/Test/Fixtures/installer/github-issues-4795.test
+++ b/tests/Composer/Test/Fixtures/installer/github-issues-4795.test
@@ -40,6 +40,5 @@ Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
-Installing binaries files
--EXPECT--
diff --git a/tests/Composer/Test/Fixtures/installer/suggest-installed.test b/tests/Composer/Test/Fixtures/installer/suggest-installed.test
index bc16f1fc6..df573c997 100644
--- a/tests/Composer/Test/Fixtures/installer/suggest-installed.test
+++ b/tests/Composer/Test/Fixtures/installer/suggest-installed.test
@@ -23,7 +23,6 @@ Loading composer repositories with package information
Updating dependencies (including require-dev)
Writing lock file
Generating autoload files
-Installing binaries files
--EXPECT--
Installing a/a (1.0.0)
diff --git a/tests/Composer/Test/Fixtures/installer/suggest-prod.test b/tests/Composer/Test/Fixtures/installer/suggest-prod.test
index 853735d58..0fe9c8853 100644
--- a/tests/Composer/Test/Fixtures/installer/suggest-prod.test
+++ b/tests/Composer/Test/Fixtures/installer/suggest-prod.test
@@ -21,7 +21,6 @@ Loading composer repositories with package information
Updating dependencies
Writing lock file
Generating autoload files
-Installing binaries files
--EXPECT--
Installing a/a (1.0.0)
diff --git a/tests/Composer/Test/Fixtures/installer/suggest-replaced.test b/tests/Composer/Test/Fixtures/installer/suggest-replaced.test
index d4cb04000..38755d7fb 100644
--- a/tests/Composer/Test/Fixtures/installer/suggest-replaced.test
+++ b/tests/Composer/Test/Fixtures/installer/suggest-replaced.test
@@ -23,7 +23,6 @@ Loading composer repositories with package information
Updating dependencies (including require-dev)
Writing lock file
Generating autoload files
-Installing binaries files
--EXPECT--
Installing c/c (1.0.0)
diff --git a/tests/Composer/Test/Fixtures/installer/suggest-uninstalled.test b/tests/Composer/Test/Fixtures/installer/suggest-uninstalled.test
index 2b321cb03..fda020699 100644
--- a/tests/Composer/Test/Fixtures/installer/suggest-uninstalled.test
+++ b/tests/Composer/Test/Fixtures/installer/suggest-uninstalled.test
@@ -22,7 +22,6 @@ Updating dependencies (including require-dev)
a/a suggests installing b/b (an obscure reason)
Writing lock file
Generating autoload files
-Installing binaries files
--EXPECT--
Installing a/a (1.0.0)
diff --git a/tests/Composer/Test/Installer/InstallationManagerTest.php b/tests/Composer/Test/Installer/InstallationManagerTest.php
index 76fe55c12..f165ca792 100644
--- a/tests/Composer/Test/Installer/InstallationManagerTest.php
+++ b/tests/Composer/Test/Installer/InstallationManagerTest.php
@@ -263,10 +263,10 @@ class InstallationManagerTest extends \PHPUnit_Framework_TestCase
$installer
->expects($this->once())
- ->method('installBinary')
+ ->method('ensureBinariesPresence')
->with($package);
- $manager->installBinary($package);
+ $manager->ensureBinariesPresence($package);
}
private function createInstallerMock()
diff --git a/tests/Composer/Test/Installer/LibraryInstallerTest.php b/tests/Composer/Test/Installer/LibraryInstallerTest.php
index 8fd0ee60a..ce55fb1d9 100644
--- a/tests/Composer/Test/Installer/LibraryInstallerTest.php
+++ b/tests/Composer/Test/Installer/LibraryInstallerTest.php
@@ -259,7 +259,7 @@ class LibraryInstallerTest extends TestCase
* @depends testInstallerCreationShouldNotCreateVendorDirectory
* @depends testInstallerCreationShouldNotCreateBinDirectory
*/
- public function testInstallBinary()
+ public function testEnsureBinariesInstalled()
{
$binaryInstallerMock = $this->getMockBuilder('Composer\Installer\BinaryInstaller')
->disableOriginalConstructor()
@@ -269,16 +269,16 @@ class LibraryInstallerTest extends TestCase
$package = $this->createPackageMock();
$binaryInstallerMock
- ->expects($this->once())
+ ->expects($this->never())
->method('removeBinaries')
->with($package);
$binaryInstallerMock
->expects($this->once())
->method('installBinaries')
- ->with($package, $library->getInstallPath($package));
+ ->with($package, $library->getInstallPath($package), false);
- $library->installBinary($package);
+ $library->ensureBinariesPresence($package);
}
protected function createPackageMock()