Use composer authoritative class maps in production build#7362
Use composer authoritative class maps in production build#7362westonruter merged 4 commits intodevelopfrom
Conversation
|
Plugin builds for 84f86a5 are ready 🛎️!%0A- Download development build%0A- Download production build |
|
According to the docs Authoritative class maps relieves autoloader from file lookups in case the class is not present in the class map. Usage of classmap authoritative by autoloader/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
} |
|
I'm looking at the diff of the build before and after this change, and it seems the only change is in amp-wp/vendor/composer/autoload_real.php Lines 37 to 45 in 83681ec @andyblackwell Is this what you were expecting? |
Sorry, didn't see this notification. Yes, that's expected. I downloaded the production build from the github actions comment, and can see the changes you mentioned plus the line: I also see it in the development build, which typically isn't what you'd want, but I don't know your workflow. If you don't actively make edits to the actual development build after the fact, like creating/renaming classes, then that should be fine. |
|
@andyblackwell Thank you for pointing that out. @thelovekesh Could you revert the change to Lines 170 to 173 in 371fa96 To decide whether we run Line 205 in 371fa96 |
| `composer install --no-dev -o${ 'development' === process.env.NODE_ENV ? '' : 'a' }`, | ||
| `composer remove cweagans/composer-patches --update-no-dev -o${ 'development' === process.env.NODE_ENV ? '' : 'a' }`, |
Summary
Fixes #7337
Checklist