@@ -42,7 +42,7 @@ public function parseAutoloadsTypeFiles($paths, PackageInterface $mainPackage)
4242 *
4343 * @see https://github.com/composer/composer/blob/master/src/Composer/Autoload/AutoloadGenerator.php#L115
4444 */
45- public function dumpFiles (Composer $ composer , $ paths , $ targetDir = 'composer ' , $ suffix = '' , $ staticPhpVersion = 70000 )
45+ public function dumpFiles (Composer $ composer , $ paths , $ excludePaths = [], $ targetDir = 'composer ' , $ suffix = '' , $ staticPhpVersion = 70000 )
4646 {
4747 $ installationManager = $ composer ->getInstallationManager ();
4848 $ localRepo = $ composer ->getRepositoryManager ()->getLocalRepository ();
@@ -82,10 +82,19 @@ public function dumpFiles(Composer $composer, $paths, $targetDir = 'composer', $
8282 }
8383 }
8484
85+
8586 $ paths = $ this ->parseAutoloadsTypeFiles ($ paths , $ mainPackage );
8687
8788 $ autoloads ['files ' ] = array_merge ($ paths , $ autoloads ['files ' ]);
8889
90+ // prepend vendor path to exclude paths
91+ foreach ($ excludePaths as &$ path ) {
92+ $ path = $ vendorPath . '/ ' . $ path ;
93+ }
94+ $ autoloads ['files ' ] = array_filter ($ autoloads ['files ' ], function ($ path ) use ($ excludePaths , $ filesystem ) {
95+ return !in_array ($ filesystem ->normalizePath ($ path ), $ excludePaths );
96+ });
97+
8998 $ includeFilesFilePath = $ targetDir .'/autoload_files.php ' ;
9099 if ($ includeFilesFileContents = $ this ->getIncludeFilesFile ($ autoloads ['files ' ], $ filesystem , $ basePath , $ vendorPath , $ vendorPathCode52 , $ appBaseDirCode )) {
91100 file_put_contents ($ includeFilesFilePath , $ includeFilesFileContents );
0 commit comments