From be3b3894aefeb3b6d97a77a33536cff4f808c933 Mon Sep 17 00:00:00 2001 From: Bob den Otter Date: Thu, 16 Jul 2020 16:30:58 +0200 Subject: [PATCH] Move `services_bolt.yaml` to `packages/bolt.yaml` --- config/packages/bolt.yaml | 18 ++++++++++++++++++ config/services_bolt.yaml | 18 ------------------ src/Extension/ExtensionCompilerPass.php | 8 +++++--- src/Kernel.php | 7 ------- 4 files changed, 23 insertions(+), 28 deletions(-) create mode 100644 config/packages/bolt.yaml delete mode 100644 config/services_bolt.yaml diff --git a/config/packages/bolt.yaml b/config/packages/bolt.yaml new file mode 100644 index 000000000..c019d8b97 --- /dev/null +++ b/config/packages/bolt.yaml @@ -0,0 +1,18 @@ +# This file is auto-generated by Bolt. Do not modify. + +services: + _defaults: + autowire: true + autoconfigure: true + AcmeCorp\ReferenceExtension\: + resource: '../../vendor/acmecorp/reference-extension/src/*' + exclude: '../../vendor/acmecorp/reference-extension/src/{Entity,Exception}' + BobdenOtter\ConfigurationNotices\: + resource: '../../vendor/bobdenotter/configuration-notices/src/*' + exclude: '../../vendor/bobdenotter/configuration-notices/src/{Entity,Exception}' + BobdenOtter\WeatherWidget\: + resource: '../../vendor/bobdenotter/weatherwidget/src/*' + exclude: '../../vendor/bobdenotter/weatherwidget/src/{Entity,Exception}' + Bolt\NewsWidget\: + resource: '../../vendor/bolt/newswidget/src/*' + exclude: '../../vendor/bolt/newswidget/src/{Entity,Exception}' diff --git a/config/services_bolt.yaml b/config/services_bolt.yaml deleted file mode 100644 index 7badb75ff..000000000 --- a/config/services_bolt.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# This file is auto-generated by Bolt. Do not modify. - -services: - _defaults: - autowire: true - autoconfigure: true - AcmeCorp\ReferenceExtension\: - resource: '../vendor/acmecorp/reference-extension/src/*' - exclude: '../vendor/acmecorp/reference-extension/src/{Entity,Exception}' - BobdenOtter\WeatherWidget\: - resource: '../vendor/bobdenotter/weatherwidget/src/*' - exclude: '../vendor/bobdenotter/weatherwidget/src/{Entity,Exception}' - Bolt\NewsWidget\: - resource: '../vendor/bolt/newswidget/src/*' - exclude: '../vendor/bolt/newswidget/src/{Entity,Exception}' - BobdenOtter\ConfigurationNotices\: - resource: '../vendor/bobdenotter/configuration-notices/src/*' - exclude: '../vendor/bobdenotter/configuration-notices/src/{Entity,Exception}' diff --git a/src/Extension/ExtensionCompilerPass.php b/src/Extension/ExtensionCompilerPass.php index 8beae9315..c2efd04d4 100644 --- a/src/Extension/ExtensionCompilerPass.php +++ b/src/Extension/ExtensionCompilerPass.php @@ -58,7 +58,7 @@ public function buildServices(array $packages): void $yaml = "# This file is auto-generated by Bolt. Do not modify.\n\n"; $yaml .= Yaml::dump($services, 3); - $filename = $this->projectDir . '/config/services_bolt.yaml'; + $filename = $this->projectDir . '/config/packages/bolt.yaml'; file_put_contents($filename, $yaml); } @@ -96,7 +96,7 @@ private function createService(string $package): array return [$namespace, [ 'resource' => $path . '/*', - 'exclude' => $path . '/{Entity,Exception,Exclude}', + 'exclude' => $path . '/{Entity,Exception}', ]]; } @@ -119,7 +119,9 @@ private function addComposerPackages(array $packages): array private function getRelativePath($package): string { $reflection = new \ReflectionClass($package); - return Path::makeRelative(dirname($reflection->getFileName()), $this->projectDir . '/foo'); + + // We add the `/foo/bar` to make the path start with `../../` + return Path::makeRelative(dirname($reflection->getFileName()), $this->projectDir . '/foo/bar'); } } diff --git a/src/Kernel.php b/src/Kernel.php index 8e4ee1c88..dc84719b1 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -64,13 +64,6 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa $this->setBoltParameters($container, $confDir); $this->setContentTypeRequirements($container); $this->setTaxonomyRequirements($container); - - try { - $loader->load($confDir . '/{services}_bolt' . self::CONFIG_EXTS, 'glob'); - } catch (\Throwable $e) { - // Ignore errors. The file will be updated on next `cache:clear` or whenever - // the container gets refreshed - } } protected function configureRoutes(RouteCollectionBuilder $routes): void