Skip to content

refactor: export ControlUnit#1235

Merged
MistEO merged 1 commit intomainfrom
refactor/export
Mar 27, 2026
Merged

refactor: export ControlUnit#1235
MistEO merged 1 commit intomainfrom
refactor/export

Conversation

@MistEO
Copy link
Copy Markdown
Member

@MistEO MistEO commented Mar 27, 2026

Summary by Sourcery

将 ControlUnit 接口作为公共的 MaaControlUnit 模块导出,并更新代码库以使用新的公共头文件。

增强功能:

  • 引入专用的 MaaControlUnit 公共头文件集,包括便捷的 MaaControlUnitAPI 统一头文件以及共享的命名空间定义。
  • 重构内部引用,在所有控制单元实现和相关组件中使用新的 MaaControlUnit 头文件路径。

构建:

  • 在构建过程中安装 MaaControlUnit 公共头文件,并更新 control-unit 的 CMake 目标以引用公共包含路径,而非私有路径。
Original summary in English

Summary by Sourcery

Export the ControlUnit interfaces as a public MaaControlUnit module and update the codebase to consume the new public headers.

Enhancements:

  • Introduce a dedicated MaaControlUnit public header set, including a convenience MaaControlUnitAPI umbrella header and shared namespace definitions.
  • Refactor internal includes to use the new MaaControlUnit header paths across all control unit implementations and related components.

Build:

  • Install the MaaControlUnit public headers as part of the build and update control-unit CMake targets to reference public include paths instead of private ones.

Copilot AI review requested due to automatic review settings March 27, 2026 03:32
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - 我发现了 1 个问题

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="include/MaaControlUnit/MaaControlUnitDef.h" line_range="5" />
<code_context>
+
+#include "MaaFramework/MaaPort.h"
+
+#define MAA_CTRL_UNIT_NS MaaNS::CtrlUnitNs
+#define MAA_CTRL_UNIT_NS_BEGIN \
+    namespace MAA_CTRL_UNIT_NS \
</code_context>
<issue_to_address>
**suggestion:** 请考虑在这里使用与其他 MAA_* 命名空间辅助宏相同的基础命名空间宏,以避免不一致。

在其他地方,这个宏被定义为 `MAA_CTRL_UNIT_NS MAA_NS::CtrlUnitNs`,而这里则直接使用了 `MaaNS::CtrlUnitNs`,这与 `Common/Conf.h` 中仍然通过 `MAA_NS` 的其他宏不同。如果 `MAA_NS``MaaNS` 将来出现差异,这个宏的行为就会不同。除非有明确的理由绕过 `MAA_NS`,否则为了保持一致性并便于未来重构,在这里继续使用 `MAA_NS::CtrlUnitNs` 会更安全。

```suggestion
#define MAA_CTRL_UNIT_NS MAA_NS::CtrlUnitNs
```
</issue_to_address>

Sourcery 对开源项目免费——如果你觉得我们的代码审查有帮助,请考虑分享 ✨
帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据你的反馈来改进后续的代码审查。
Original comment in English

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="include/MaaControlUnit/MaaControlUnitDef.h" line_range="5" />
<code_context>
+
+#include "MaaFramework/MaaPort.h"
+
+#define MAA_CTRL_UNIT_NS MaaNS::CtrlUnitNs
+#define MAA_CTRL_UNIT_NS_BEGIN \
+    namespace MAA_CTRL_UNIT_NS \
</code_context>
<issue_to_address>
**suggestion:** Consider using the same base namespace macro here as in other MAA_* namespace helpers to avoid inconsistencies.

Elsewhere this macro was defined as `MAA_CTRL_UNIT_NS MAA_NS::CtrlUnitNs`, while here it uses `MaaNS::CtrlUnitNs` directly, unlike other macros in `Common/Conf.h` that still go through `MAA_NS`. If `MAA_NS` and `MaaNS` ever diverge, this macro will behave differently. Unless there’s a specific reason to bypass `MAA_NS`, it would be safer to keep using `MAA_NS::CtrlUnitNs` here for consistency and easier future refactoring.

```suggestion
#define MAA_CTRL_UNIT_NS MAA_NS::CtrlUnitNs
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@neko-para
Copy link
Copy Markdown
Contributor

这玩意导出出来能用来干什么(

@MistEO
Copy link
Copy Markdown
Member Author

MistEO commented Mar 27, 2026

这玩意导出出来能用来干什么(

给 MAA 单独用 Win32ControlUnit(

@MistEO MistEO merged commit e306f5f into main Mar 27, 2026
25 checks passed
@MistEO MistEO deleted the refactor/export branch March 27, 2026 04:07
@neko-para
Copy link
Copy Markdown
Contributor

@neko-para
Copy link
Copy Markdown
Contributor

但是maa和maafw的MaaDeps版本不完全一致吧, 混用真的不会爆炸吗(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants