mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-03-18 05:04:51 +08:00
fix unpack autoload not working, change exclude_annotate to another name (build 444)
This commit is contained in:
parent
7ce3ef41df
commit
74e91a2950
@ -4,9 +4,11 @@
|
||||
"minimum-stability": "stable",
|
||||
"license": "Apache-2.0",
|
||||
"extra": {
|
||||
"exclude_annotate": [
|
||||
"src/ZM"
|
||||
],
|
||||
"zm": {
|
||||
"exclude-annotation-path": [
|
||||
"src/ZM"
|
||||
]
|
||||
},
|
||||
"hooks": {
|
||||
"post-merge": "composer install",
|
||||
"pre-commit": [
|
||||
|
||||
@ -28,7 +28,7 @@ use ZM\Exception\InitException;
|
||||
|
||||
class ConsoleApplication extends Application
|
||||
{
|
||||
public const VERSION_ID = 443;
|
||||
public const VERSION_ID = 444;
|
||||
|
||||
public const VERSION = '2.7.0-beta4';
|
||||
|
||||
|
||||
@ -156,9 +156,10 @@ class OnWorkerStart implements SwooleEvent
|
||||
$parser = new AnnotationParser();
|
||||
$composer = json_decode(file_get_contents(DataProvider::getSourceRootDir() . '/composer.json'), true);
|
||||
$merge = array_merge($composer['autoload']['psr-4'] ?? [], $composer['autoload-dev']['psr-4'] ?? []);
|
||||
$exclude_annotations = array_merge($composer['extra']['exclude_annotate'] ?? [], $composer['extra']['zm']['exclude-annotation-path'] ?? []);
|
||||
foreach ($merge as $k => $v) {
|
||||
if (is_dir(DataProvider::getSourceRootDir() . '/' . $v)) {
|
||||
if (in_array(trim($k, '\\') . '\\', $composer['extra']['exclude_annotate'] ?? [])) {
|
||||
if (in_array(trim($k, '\\') . '\\', $exclude_annotations)) {
|
||||
continue;
|
||||
}
|
||||
if (trim($k, '\\') == 'ZM') {
|
||||
|
||||
@ -30,7 +30,8 @@ class ModuleUnpacker
|
||||
|
||||
/**
|
||||
* 解包模块
|
||||
* @param bool $ignore_depends
|
||||
*
|
||||
* @param mixed $ignore_depends
|
||||
* @throws ModulePackException
|
||||
* @throws ZMException
|
||||
*/
|
||||
@ -61,7 +62,8 @@ class ModuleUnpacker
|
||||
|
||||
/**
|
||||
* 检查模块依赖关系
|
||||
* @param bool $ignore_depends
|
||||
*
|
||||
* @param mixed $ignore_depends
|
||||
* @throws ModulePackException
|
||||
* @throws ZMException
|
||||
*/
|
||||
@ -125,8 +127,8 @@ class ModuleUnpacker
|
||||
throw new ModulePackException(zm_internal_errcode('E00068'));
|
||||
}
|
||||
$composer = json_decode(file_get_contents($composer_file), true);
|
||||
if (isset($this->module_config['composer-extend-autoload'])) {
|
||||
$autoload = $this->module_config['composer-extend-autoload'];
|
||||
if (isset($this->module_config['unpack']['composer-autoload-items'])) {
|
||||
$autoload = $this->module_config['unpack']['composer-autoload-items'];
|
||||
if (isset($autoload['psr-4'])) {
|
||||
Console::info('Adding extended autoload psr-4 for composer');
|
||||
$composer['autoload']['psr-4'] = isset($composer['autoload']['psr-4']) ? array_merge($composer['autoload']['psr-4'], $autoload['psr-4']) : $autoload['psr-4'];
|
||||
@ -136,6 +138,7 @@ class ModuleUnpacker
|
||||
$composer['autoload']['files'] = isset($composer['autoload']['files']) ? array_merge($composer['autoload']['files'], $autoload['files']) : $autoload['files'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->module_config['composer-extend-require'])) {
|
||||
foreach ($this->module_config['composer-extend-require'] as $k => $v) {
|
||||
Console::info('Adding extended required composer library: ' . $k);
|
||||
|
||||
@ -20,13 +20,14 @@ try {
|
||||
$base_path = DataProvider::getSourceRootDir();
|
||||
$scan_paths = [];
|
||||
$composer = json_decode(file_get_contents($base_path . '/composer.json'), true);
|
||||
$exclude_annotations = array_merge($composer['extra']['exclude_annotate'] ?? [], $composer['extra']['zm']['exclude-annotation-path'] ?? []);
|
||||
foreach (($composer['autoload']['psr-4'] ?? []) as $k => $v) {
|
||||
if (is_dir($base_path . '/' . $v) && !in_array($v, $composer['extra']['exclude_annotate'] ?? [])) {
|
||||
if (is_dir($base_path . '/' . $v) && !in_array($v, $exclude_annotations)) {
|
||||
$scan_paths[trim($k, '\\')] = $base_path . '/' . $v;
|
||||
}
|
||||
}
|
||||
foreach (($composer['autoload-dev']['psr-4'] ?? []) as $k => $v) {
|
||||
if (is_dir($base_path . '/' . $v) && !in_array($v, $composer['extra']['exclude_annotate'] ?? [])) {
|
||||
if (is_dir($base_path . '/' . $v) && !in_array($v, $exclude_annotations)) {
|
||||
$scan_paths[trim($k, '\\')] = $base_path . '/' . $v;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user