Repository navigation
fix(solaris): 修复 analyze --source-dir 不生效与重复 --package-name 的问题 - #15
Merged
Nattsu39 merged 1 commit intoSep 24, 2026
Merged
Conversation
问题一:-w/--source-dir 不生效。DataSourceDirSettings 的四个分类目录 (PATCH/HTML5/UNITY/FLASH)在类定义时按缺省 BASE_DIR 固化,构造后修改 BASE_DIR(-w/--source-dir 或 SOLARIS_DATA_BASE_DIR)不会传播,数据始终 从 ./source 读取。改为:分类目录未被显式指定(环境变量或构造参数)时 一律从当前 BASE_DIR 派生;CLI 改为构造时传入 BASE_DIR 而非构造后改属性。 问题二:--package-name 指定多个有交集的包时重复类导致拓扑排序误报 「循环依赖」。递归导入会让父包带上子包已有的分析器类(如 pet 包自带 element_type/peak_pool/peak_cost),CLI 逐包 extend 不去重, _topological_sort_analyzers 按 len(sorted) != len(analyzers) 判定失败。 parse 命令同款模式虽不报错,但会让同一 parser 执行两次。均按类身份去重。 真实复现场景:用公开的 config-sources 仓库跑 solaris analyze -w config-sources data,需改用 SOLARIS_DATA_* 环境变量; 只跑 pet/skill 子包则触发问题二。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
在真实管线里(用公开的 config-sources 仓库跑
solaris analyze自产数据集)踩到两个问题,一并修复:问题一:
-w/--source-dir不生效DataSourceDirSettings的四个分类目录(PATCH_DIR/HTML5_DIR/UNITY_DIR/FLASH_DIR)在类定义时按缺省BASE_DIR(./source)固化,之后修改BASE_DIR不会传播:因此
solaris analyze -w config-sources data实际仍从./source读数据(报source\unity\xxx.json 不存在),只有SOLARIS_DATA_UNITY_DIR等逐目录环境变量有效,与 README「仅设置 SOLARIS_DATA_BASE_DIR 时各分类目录为 BASE_DIR/[patch|html5|unity|flash]」的描述不符。修复:
combine_dirs校验器里,分类目录未被显式指定(环境变量或构造参数,用model_fields_set判断)时一律从当前BASE_DIR派生;CLI 改为构造时传BASE_DIR=source_dir而非构造后改属性。问题二:重复
--package-name导致误报「循环依赖」import_all_classes会递归导入子包,所以 pet 包自带element_type、peak_pool、peak_cost的分析器类;analyze的--package-name逐包extend不去重,同一个类出现两次时_topological_sort_analyzers的len(sorted) != len(analyzers)判定失配,报出误导性的「无法完成拓扑排序,可能存在循环依赖」:修复:
analyze与parse均按类身份去重(parse 的重复虽不报错,但会让同一 parser 执行两次)。测试
tests/analyze/test_data_source_settings.py(BASE_DIR 派生 / 缺省布局 / 显式子目录优先,含SOLARIS_DATA_*环境变量隔离)tests/analyze/test_cli.py(有交集的双包--list-analyzers输出去重)顺带观察(未在本次修改)
analyze组未开invoke_without_command=True,所以不带子命令时solaris analyze --list-analyzers走不到分支、报Missing command(README「查看帮助」一节有此用法示例)。如需要可后续单独处理。