def collect_for_build(self, build_dir):
        with patched_finders():
            with patched_settings(STATICBUILDER_COLLECT_BUILT=False):
                # Patch the static files storage used by collectstatic
                storage = BuiltFileStorage()
                old_storage = djstorage.staticfiles_storage
                djstorage.staticfiles_storage = storage

                try:
                    call_command('collectstatic',
                                 verbosity=self.verbosity - 1,
                                 interactive=False,
                                 ignore_patterns=settings.STATICBUILDER_EXCLUDE_FILES)
                finally:
                    djstorage.staticfiles_storage = old_storage

                # Delete the files that have been removed.
                if self.clean:
                    self.clean_built(storage)