// Update the module handler in order to have the correct module list
// for the kernel update.
$this->moduleHandler->
setModuleList($module_filenames);
// Clear the static cache of the "extension.list.module" service to pick
// up the new module, since it merges the installation status of modules
// into its statically cached list.
\Drupal::
service('extension.list.module'
)->
reset();
// Update the kernel to include it.
$this->
updateKernel($module_filenames);
// Load the module's .module and .install files.
$this->moduleHandler->
load($module);
$this->moduleHandler->
loadInclude($module, 'install'
);
if (!InstallerKernel::
installationAttempted()) { // Replace the route provider service with a version that will rebuild
// if routes used during installation. This ensures that a module's
// routes are available during installation. This has to occur before
// any services that depend on it are instantiated otherwise those
// services will have the old route provider injected. Note that, since