@@ -913,20 +913,26 @@ public function create_run_dir() {
913913 public function build_phar ( $ version = 'same ' ) {
914914 $ this ->variables ['PHAR_PATH ' ] = $ this ->variables ['RUN_DIR ' ] . '/ ' . uniqid ( 'wp-cli-build- ' , true ) . '.phar ' ;
915915
916+ $ is_bundle = false ;
917+
916918 // Test running against a package installed as a WP-CLI dependency
917919 // WP-CLI bundle installed as a project dependency
918920 $ make_phar_path = self ::get_vendor_dir () . '/wp-cli/wp-cli-bundle/utils/make-phar.php ' ;
919921 if ( ! file_exists ( $ make_phar_path ) ) {
920922 // Running against WP-CLI bundle proper
923+ $ is_bundle = true ;
924+
921925 $ make_phar_path = self ::get_vendor_dir () . '/../utils/make-phar.php ' ;
922926 }
923927
924928 // Temporarily modify the Composer autoloader used within the Phar
925929 // so that it doesn't clash if autoloading is already happening outside of it,
926930 // for example when generating code coverage.
927931 // This modifies composer.json.
928- $ this ->composer_command ( 'config autoloader-suffix "WpCliTestsPhar" --working-dir= ' . dirname ( self ::get_vendor_dir () ) );
929- $ this ->composer_command ( 'dump-autoload --working-dir= ' . dirname ( self ::get_vendor_dir () ) );
932+ if ( $ is_bundle ) {
933+ $ this ->composer_command ( 'config autoloader-suffix "WpCliTestsPhar" --working-dir= ' . dirname ( self ::get_vendor_dir () ) );
934+ $ this ->composer_command ( 'dump-autoload --working-dir= ' . dirname ( self ::get_vendor_dir () ) );
935+ }
930936
931937 $ this ->proc (
932938 Utils \esc_cmd (
@@ -938,8 +944,10 @@ public function build_phar( $version = 'same' ) {
938944 )->run_check ();
939945
940946 // Revert the suffix change again
941- $ this ->composer_command ( 'config autoloader-suffix "WpCliBundle" --working-dir= ' . dirname ( self ::get_vendor_dir () ) );
942- $ this ->composer_command ( 'dump-autoload --working-dir= ' . dirname ( self ::get_vendor_dir () ) );
947+ if ( $ is_bundle ) {
948+ $ this ->composer_command ( 'config autoloader-suffix "WpCliBundle" --working-dir= ' . dirname ( self ::get_vendor_dir () ) );
949+ $ this ->composer_command ( 'dump-autoload --working-dir= ' . dirname ( self ::get_vendor_dir () ) );
950+ }
943951 }
944952
945953 public function download_phar ( $ version = 'same ' ) {
0 commit comments