eee
This commit is contained in:
+7
-5
@@ -255,12 +255,14 @@ class Router
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($appChangedFiles)) {
|
||||
if (!empty($appChangedFiles) && (bool)($scanConfig['expand_dependencies'] ?? false)) {
|
||||
$appChangedFiles = $scanner->expandDependentFiles($appChangedFiles, APP_PATH . 'app/');
|
||||
}
|
||||
|
||||
$usedArtifact = false;
|
||||
if (($scanConfig['cache_enabled'] ?? false) && $artifactState->has(static::$type)) {
|
||||
$canUseArtifact = $artifactState->has(static::$type)
|
||||
&& (!empty($changedFiles) || ($scanConfig['cache_enabled'] ?? false));
|
||||
if ($canUseArtifact) {
|
||||
$artifact = $artifactState->load(static::$type);
|
||||
$router = $container->get(DataGrip::class)->get(static::$type);
|
||||
$usedArtifact = $router->importArtifact($artifact, $appChangedFiles);
|
||||
@@ -270,12 +272,12 @@ class Router
|
||||
// route artifact 只加速注解路由,不能替代 routes/*.php 的注册副作用。
|
||||
$this->read_dir_file(APP_PATH . 'routes');
|
||||
|
||||
if (!empty($appChangedFiles) && ($scanConfig['cache_enabled'] ?? false)) {
|
||||
$scanner->scanFiles($appChangedFiles, APP_PATH . 'app/', null, true);
|
||||
if (!empty($appChangedFiles) && (($scanConfig['cache_enabled'] ?? false) || $usedArtifact)) {
|
||||
$scanner->scanFiles($appChangedFiles, APP_PATH . 'app/', null, true, !$usedArtifact);
|
||||
} elseif (!$usedArtifact) {
|
||||
$scanner->scan(APP_PATH . 'app/');
|
||||
} else {
|
||||
$scanner->scanFiles([], APP_PATH . 'app/', null, false);
|
||||
$scanner->scanFiles([], APP_PATH . 'app/', null, false, false);
|
||||
}
|
||||
$this->reset($container);
|
||||
$artifactState->store(static::$type, $container->get(DataGrip::class)->get(static::$type)->exportArtifact());
|
||||
|
||||
Reference in New Issue
Block a user