diff --git a/doc/03-cli.md b/doc/03-cli.md
index 9fc3d552a..ad31c2220 100644
--- a/doc/03-cli.md
+++ b/doc/03-cli.md
@@ -88,6 +88,7 @@ resolution.
installation and show you what would happen.
* **--dev:** Install packages listed in `require-dev` (this is the default behavior).
* **--no-dev:** Skip installing packages listed in `require-dev`.
+* **--no-autoloader:** Skips autoloader generation.
* **--no-scripts:** Skips execution of scripts defined in `composer.json`.
* **--no-plugins:** Disables plugins.
* **--no-progress:** Removes the progress display that can mess with some
@@ -130,6 +131,7 @@ php composer.phar update vendor/*
* **--dry-run:** Simulate the command without actually doing anything.
* **--dev:** Install packages listed in `require-dev` (this is the default behavior).
* **--no-dev:** Skip installing packages listed in `require-dev`.
+* **--no-autoloader:** Skips autoloader generation.
* **--no-scripts:** Skips execution of scripts defined in `composer.json`.
* **--no-plugins:** Disables plugins.
* **--no-progress:** Removes the progress display that can mess with some
diff --git a/src/Composer/Command/InstallCommand.php b/src/Composer/Command/InstallCommand.php
index 669c03582..c1de25ce7 100644
--- a/src/Composer/Command/InstallCommand.php
+++ b/src/Composer/Command/InstallCommand.php
@@ -41,6 +41,7 @@ class InstallCommand extends Command
new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
new InputOption('no-plugins', null, InputOption::VALUE_NONE, 'Disables all plugins.'),
new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
+ new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
@@ -113,6 +114,7 @@ EOT
->setPreferSource($preferSource)
->setPreferDist($preferDist)
->setDevMode(!$input->getOption('no-dev'))
+ ->setRunAutoloader(!$input->getOption('no-autoloader'))
->setRunScripts(!$input->getOption('no-scripts'))
->setOptimizeAutoloader($optimize)
->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
diff --git a/src/Composer/Command/UpdateCommand.php b/src/Composer/Command/UpdateCommand.php
index 5e83658c9..cb3b50209 100644
--- a/src/Composer/Command/UpdateCommand.php
+++ b/src/Composer/Command/UpdateCommand.php
@@ -41,6 +41,7 @@ class UpdateCommand extends Command
new InputOption('lock', null, InputOption::VALUE_NONE, 'Only updates the lock file hash to suppress warning about the lock file being out of date.'),
new InputOption('no-plugins', null, InputOption::VALUE_NONE, 'Disables all plugins.'),
new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
+ new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Add also all dependencies of whitelisted packages to the whitelist.'),
@@ -117,6 +118,7 @@ EOT
->setPreferSource($preferSource)
->setPreferDist($preferDist)
->setDevMode(!$input->getOption('no-dev'))
+ ->setRunAutoloader(!$input->getOption('no-autoloader'))
->setRunScripts(!$input->getOption('no-scripts'))
->setOptimizeAutoloader($optimize)
->setUpdate(true)
diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php
index 35df7e61b..041a2f6c9 100644
--- a/src/Composer/Installer.php
+++ b/src/Composer/Installer.php
@@ -105,6 +105,7 @@ class Installer
protected $dryRun = false;
protected $verbose = false;
protected $update = false;
+ protected $runAutoloader = true;
protected $runScripts = true;
protected $ignorePlatformReqs = false;
protected $preferStable = false;
@@ -317,16 +318,18 @@ class Installer
}
}
- // write autoloader
- if ($this->optimizeAutoloader) {
- $this->io->write('Generating optimized autoload files');
- } else {
- $this->io->write('Generating autoload files');
+ if ($this->runAutoloader) {
+ // write autoloader
+ if ($this->optimizeAutoloader) {
+ $this->io->write('Generating optimized autoload files');
+ } else {
+ $this->io->write('Generating autoload files');
+ }
+
+ $this->autoloadGenerator->setDevMode($this->devMode);
+ $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
}
- $this->autoloadGenerator->setDevMode($this->devMode);
- $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
-
if ($this->runScripts) {
// dispatch post event
$eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
@@ -1163,6 +1166,21 @@ class Installer
return $this;
}
+
+ /**
+ * set whether to run autoloader or not
+ *
+ * @param boolean $runAutoloader
+ * @return Installer
+ */
+ public function setRunAutoloader($runAutoloader = true)
+ {
+ $this->runAutoloader = (boolean) $runAutoloader;
+
+ return $this;
+ }
+
+
/**
* set whether to run scripts or not
*