class-alias-loader icon indicating copy to clipboard operation
class-alias-loader copied to clipboard

Include of autogenerating files are not idempotent

Open websi opened this issue 1 year ago • 1 comments

The path to file typo3/alias-loader-include.php is an absolute path. Composer use an hash to the file for the include. So the hash changes for different paths. This is very common in the CI system. This prevents effective caching of the generated files.

Similar use cases from composer: https://github.com/composer/composer/issues/7049 and https://github.com/composer/composer/issues/11226

Diff Image:

image

Patch:

Index: src/IncludeFile.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/IncludeFile.php b/src/IncludeFile.php
--- a/src/IncludeFile.php
+++ b/src/IncludeFile.php    (date 1724418719532)
@@ -67,7 +67,7 @@
         // Register the file in the root package
         $rootPackage = $this->composer->getPackage();
         $autoloadDefinition = $rootPackage->getAutoload();
-        $autoloadDefinition['files'][] = $includeFile;
+        $autoloadDefinition['files'][] = $this->composer->getConfig()->get('vendor-dir', \Composer\Config::RELATIVE_PATHS) . self::INCLUDE_FILE;
         $rootPackage->setAutoload($autoloadDefinition);
     }

websi avatar Aug 26 '24 09:08 websi