From 0e9662cb0d05965e1e7d49c7a45d97b4d6e1bf16 Mon Sep 17 00:00:00 2001 From: Leo Feyer <1192057+leofeyer@users.noreply.github.com> Date: Wed, 8 May 2024 11:06:51 +0200 Subject: [PATCH] Create a separate cache per tool and branch (see #7201) Description ----------- As discussed on the Contao camp, the tool cache is invalidated every time we switch branches, and then running the tools is slow until a new cache is built. Creating a separate cache per branch should solve this problem. Commits ------- 2faddc96 Do not store the tools cache in the global /tmp directory 2b4ca9fb Dynamically set the `tmpDir` parameter in PHPStan 8cf87ade Run the tools --- .gitignore | 2 +- ecs.php | 2 +- phpstan.neon | 1 + rector.php | 2 +- vendor-bin/ecs/config/legacy.php | 2 +- vendor-bin/ecs/config/template.php | 2 +- vendor-bin/phpstan/config/config.php | 17 +++++++++++++++++ .../src/ExtensionReturnTypeExtension.php | 8 ++++++++ .../phpstan/src/GraphReturnTypeExtension.php | 8 ++++++++ .../phpstan/src/HelperReturnTypeExtension.php | 8 ++++++++ 10 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 vendor-bin/phpstan/config/config.php diff --git a/.gitignore b/.gitignore index eff737e347c..0b588bcd44d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ /vendor/ # Composer bin -/vendor-bin/*/vendor +/vendor-bin/*/vendor/ # Monorepo Tools /.monorepo-split-cache/ diff --git a/ecs.php b/ecs.php index f24b0c2025f..969c4752eac 100644 --- a/ecs.php +++ b/ecs.php @@ -56,5 +56,5 @@ ->withParallel() ->withSpacing(Option::INDENTATION_SPACES, "\n") ->withConfiguredRule(HeaderCommentFixer::class, ['header' => "This file is part of Contao.\n\n(c) Leo Feyer\n\n@license LGPL-3.0-or-later"]) - ->withCache(sys_get_temp_dir().'/ecs_cache') + ->withCache(sys_get_temp_dir().'/ecs/contao53') ; diff --git a/phpstan.neon b/phpstan.neon index c14632e1bf2..1c48edd4ff7 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,4 +1,5 @@ includes: + - vendor-bin/phpstan/config/config.php - vendor-bin/phpstan/vendor/phpstan/phpstan/conf/bleedingEdge.neon - vendor-bin/phpstan/vendor/phpstan/phpstan-phpunit/extension.neon - vendor-bin/phpstan/vendor/phpstan/phpstan-phpunit/rules.neon diff --git a/rector.php b/rector.php index 3a3e35505a8..a53aa28f95c 100644 --- a/rector.php +++ b/rector.php @@ -64,5 +64,5 @@ ]) ->withRootFiles() ->withParallel() - ->withCache(sys_get_temp_dir().'/rector_cache') + ->withCache(sys_get_temp_dir().'/rector/contao53') ; diff --git a/vendor-bin/ecs/config/legacy.php b/vendor-bin/ecs/config/legacy.php index 58e60fb94dc..421faee32ff 100644 --- a/vendor-bin/ecs/config/legacy.php +++ b/vendor-bin/ecs/config/legacy.php @@ -119,5 +119,5 @@ ->withConfiguredRule(HeaderCommentFixer::class, ['header' => "This file is part of Contao.\n\n(c) Leo Feyer\n\n@license LGPL-3.0-or-later"]) ->withConfiguredRule(ListSyntaxFixer::class, ['syntax' => 'long']) ->withConfiguredRule(NoExtraBlankLinesFixer::class, ['tokens' => ['curly_brace_block', 'extra', 'parenthesis_brace_block', 'square_brace_block', 'use']]) - ->withCache(sys_get_temp_dir().'/ecs_legacy_cache') + ->withCache(sys_get_temp_dir().'/ecs/contao53-legacy') ; diff --git a/vendor-bin/ecs/config/template.php b/vendor-bin/ecs/config/template.php index 97b2de954cb..89e8e46559b 100644 --- a/vendor-bin/ecs/config/template.php +++ b/vendor-bin/ecs/config/template.php @@ -56,5 +56,5 @@ ->withParallel() ->withSpacing(Option::INDENTATION_SPACES, "\n") ->withFileExtensions(['html5']) - ->withCache(sys_get_temp_dir().'/ecs_template_cache') + ->withCache(sys_get_temp_dir().'/ecs/contao53-template') ; diff --git a/vendor-bin/phpstan/config/config.php b/vendor-bin/phpstan/config/config.php new file mode 100644 index 00000000000..228d649021f --- /dev/null +++ b/vendor-bin/phpstan/config/config.php @@ -0,0 +1,17 @@ + [ + 'tmpDir' => sys_get_temp_dir().'/phpstan/contao53', + ], +]; diff --git a/vendor-bin/phpstan/src/ExtensionReturnTypeExtension.php b/vendor-bin/phpstan/src/ExtensionReturnTypeExtension.php index c1adf537544..561cad988e2 100644 --- a/vendor-bin/phpstan/src/ExtensionReturnTypeExtension.php +++ b/vendor-bin/phpstan/src/ExtensionReturnTypeExtension.php @@ -2,6 +2,14 @@ declare(strict_types=1); +/* + * This file is part of Contao. + * + * (c) Leo Feyer + * + * @license LGPL-3.0-or-later + */ + namespace Contao\Tools\PHPStan; use PhpParser\Node\Expr\MethodCall; diff --git a/vendor-bin/phpstan/src/GraphReturnTypeExtension.php b/vendor-bin/phpstan/src/GraphReturnTypeExtension.php index c6a684ca504..93c69b01e05 100644 --- a/vendor-bin/phpstan/src/GraphReturnTypeExtension.php +++ b/vendor-bin/phpstan/src/GraphReturnTypeExtension.php @@ -2,6 +2,14 @@ declare(strict_types=1); +/* + * This file is part of Contao. + * + * (c) Leo Feyer + * + * @license LGPL-3.0-or-later + */ + namespace Contao\Tools\PHPStan; use PhpParser\Node\Expr\MethodCall; diff --git a/vendor-bin/phpstan/src/HelperReturnTypeExtension.php b/vendor-bin/phpstan/src/HelperReturnTypeExtension.php index 83deaeb82f8..b4c2b48d8d3 100644 --- a/vendor-bin/phpstan/src/HelperReturnTypeExtension.php +++ b/vendor-bin/phpstan/src/HelperReturnTypeExtension.php @@ -2,6 +2,14 @@ declare(strict_types=1); +/* + * This file is part of Contao. + * + * (c) Leo Feyer + * + * @license LGPL-3.0-or-later + */ + namespace Contao\Tools\PHPStan; use PhpParser\Node\Expr\MethodCall;