Skip to content

fix: restore dconfig_meta_files macro for DTK5 compatibility#541

Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
18202781743:master
Feb 5, 2026
Merged

fix: restore dconfig_meta_files macro for DTK5 compatibility#541
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
18202781743:master

Conversation

@18202781743
Copy link
Contributor

@18202781743 18202781743 commented Feb 5, 2026

  1. Reverted the conditional logic in dtkcore.cmake to install
    DtkDConfigMacros.cmake for DTK5 builds
  2. The macro dconfig_meta_files was removed in DTK6 but is still
    required for DTK5 compatibility
  3. Changed condition from if (NOT DTK5) to if (DTK5) to ensure the
    deprecated macro file is installed when building for DTK5
  4. This preserves backward compatibility for projects that rely on the
    dconfig_meta_files function in DTK5 environments

Log: Restored compatibility with DTK5 projects using dconfig_meta_files
macro

Influence:

  1. Test building with DTK5 enabled to verify DtkDConfigMacros.cmake
    is installed
  2. Verify that the dconfig_meta_files function is available in DTK5
    builds
  3. Test building with DTK6 to ensure the deprecated macro is not
    installed
  4. Check that existing DTK5 projects can successfully use the
    dconfig_meta_files macro
  5. Verify CMake installation paths contain the correct macro files for
    each DTK version

fix: 恢复 dconfig_meta_files 宏以支持 DTK5 兼容性

  1. 在 dtkcore.cmake 中恢复条件逻辑,为 DTK5 构建安装
    DtkDConfigMacros.cmake
  2. dconfig_meta_files 宏在 DTK6 中被移除,但在 DTK5 环境中仍然需要
  3. 将条件从 if (NOT DTK5) 改为 if (DTK5),确保在构建 DTK5 时安装已弃
    用的宏文件
  4. 这为依赖 DTK5 环境中 dconfig_meta_files 函数的项目保留了向后兼容性

Log: 恢复与使用 dconfig_meta_files 宏的 DTK5 项目的兼容性

Influence:

  1. 测试启用 DTK5 的构建,验证 DtkDConfigMacros.cmake 是否正确安装
  2. 验证 dconfig_meta_files 函数在 DTK5 构建中是否可用
  3. 测试使用 DTK6 构建,确保不安装已弃用的宏
  4. 检查现有 DTK5 项目能否成功使用 dconfig_meta_files 宏
  5. 验证 CMake 安装路径是否包含适用于各 DTK 版本的正确宏文件

@18202781743 18202781743 requested review from BLumia and mhduiy February 5, 2026 08:43
1. Reverted the conditional logic in dtkcore.cmake to install
DtkDConfigMacros.cmake for DTK5 builds
2. The macro `dconfig_meta_files` was removed in DTK6 but is still
required for DTK5 compatibility
3. Changed condition from `if (NOT DTK5)` to `if (DTK5)` to ensure the
deprecated macro file is installed when building for DTK5
4. This preserves backward compatibility for projects that rely on the
`dconfig_meta_files` function in DTK5 environments

Log: Restored compatibility with DTK5 projects using dconfig_meta_files
macro

Influence:
1. Test building with DTK5 enabled to verify DtkDConfigMacros.cmake
is installed
2. Verify that the `dconfig_meta_files` function is available in DTK5
builds
3. Test building with DTK6 to ensure the deprecated macro is not
installed
4. Check that existing DTK5 projects can successfully use the
dconfig_meta_files macro
5. Verify CMake installation paths contain the correct macro files for
each DTK version

fix: 恢复 dconfig_meta_files 宏以支持 DTK5 兼容性

1. 在 dtkcore.cmake 中恢复条件逻辑,为 DTK5 构建安装
DtkDConfigMacros.cmake
2. `dconfig_meta_files` 宏在 DTK6 中被移除,但在 DTK5 环境中仍然需要
3. 将条件从 `if (NOT DTK5)` 改为 `if (DTK5)`,确保在构建 DTK5 时安装已弃
用的宏文件
4. 这为依赖 DTK5 环境中 `dconfig_meta_files` 函数的项目保留了向后兼容性

Log: 恢复与使用 dconfig_meta_files 宏的 DTK5 项目的兼容性

Influence:
1. 测试启用 DTK5 的构建,验证 DtkDConfigMacros.cmake 是否正确安装
2. 验证 `dconfig_meta_files` 函数在 DTK5 构建中是否可用
3. 测试使用 DTK6 构建,确保不安装已弃用的宏
4. 检查现有 DTK5 项目能否成功使用 dconfig_meta_files 宏
5. 验证 CMake 安装路径是否包含适用于各 DTK 版本的正确宏文件
@18202781743 18202781743 changed the title fix: remove dconfig_meta_files for DTK5 fix: restore dconfig_meta_files macro for DTK5 compatibility Feb 5, 2026
@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, mhduiy

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot
Copy link
Contributor

deepin pr auto review

这段代码修改位于 dtkcore.cmake 文件中,主要涉及条件判断逻辑的变更。以下是对该修改的详细审查意见:

1. 语法逻辑

  • 修改内容:将 if (NOT DTK5) 修改为 if (DTK5)
  • 逻辑分析
    • 修改前:当 DTK5 未定义或为 OFF/FALSE/0 时,执行 set(DCONFIG_DEPRECATED_FUNCS ...)。这意味着在非 DTK5 环境(例如 DTK6 或更旧版本)中,dconfig_meta_files 等函数被标记为废弃。
    • 修改后:当 DTK5 被定义且为 ON/TRUE/1 时,执行上述 set 操作。
  • 潜在问题
    • 注释中明确写道 # deprecated since dtk6(自 dtk6 起废弃)。这意味着这些函数在 DTK6 中是不推荐使用的,但在 DTK5 中可能仍然是有效的或需要保留的。
    • 如果修改后的意图是"在 DTK5 环境下将这些函数标记为废弃",这与 deprecated since dtk6 的语义相矛盾。通常,deprecated since X 意味着在 X 版本之后(即 X+1 或更高版本)才废弃。
    • 结论:从语义和注释来看,修改前的逻辑 (NOT DTK5) 似乎更为合理。修改后的逻辑可能导致在 DTK5 编译时就引入了废弃警告,而实际上这些警告应该出现在 DTK6 编译时。

2. 代码质量

  • 宏定义清晰度:代码中使用了 DTK_NAME_SUFFIXDTK5。建议确保这些变量在项目顶层 CMake 文件中有清晰的文档说明,明确 DTK5ON 时代表构建 DTK5 版本,为 OFF 时代表构建 DTK6 版本。
  • 注释一致性:代码中的注释 # deprecated since dtk6 非常重要。如果逻辑确实需要修改(例如 DTK5 和 DTK6 的构建策略发生了变化),建议同步更新注释以反映新的逻辑,例如改为 # deprecated in dtk5,以避免混淆。

3. 代码性能

  • 此修改仅涉及 CMake 配置阶段的条件判断,不涉及编译后的运行时代码,因此对最终生成的二进制文件性能无影响

4. 代码安全

  • 构建一致性风险:如果 DTK5 变量未在所有依赖此模块的子模块或下游项目中统一设置,可能会导致构建行为不一致。例如,一个模块认为自己在构建 DTK5(从而设置了废弃宏),而另一个模块认为自己在构建 DTK6。
  • 废弃函数的使用:强制标记函数为废弃(如果这是该宏的作用)可能会破坏下游依赖这些旧 API 的代码的编译。需要确认下游项目是否已经准备好处理这些废弃警告或错误。

改进建议

  1. 确认逻辑意图

    • 如果目的是"在 DTK6 及更高版本中标记废弃",请回退此修改,保持 if (NOT DTK5)。因为当构建 DTK6 时,DTK5 通常为 OFF,此时 NOT DTK5 为真,符合 deprecated since dtk6 的逻辑。
    • 如果目的是"在 DTK5 中就标记废弃以便提前迁移",请更新注释为 # deprecated in dtk5,并通知所有开发者进行适配。
  2. 增强代码健壮性

    • 考虑使用更明确的版本变量,例如 if (DTK_VERSION VERSION_GREATER_EQUAL 6.0.0),这比单纯依赖布尔变量 DTK5 更易于维护和理解,特别是当未来出现 DTK7 时。
  3. 示例代码优化(假设意图是针对 DTK6 及以上废弃)

# 建议的修改方式(如果支持版本变量)
if (DTK_VERSION VERSION_GREATER_EQUAL 6.0.0)
    set(DCONFIG_DEPRECATED_FUNCS [=[
# deprecated since dtk6
function(dconfig_meta_files)
...

或者,如果必须使用 DTK5 变量:

# 保持原有逻辑,因为它更符合 "deprecated since dtk6" 的语义
if (NOT DTK5)
    set(DCONFIG_DEPRECATED_FUNCS [=[
# deprecated since dtk6
function(dconfig_meta_files)
...

总结:当前的修改(if (DTK5))与注释(# deprecated since dtk6)存在逻辑冲突,建议根据实际版本规划慎重评估是否需要回退此修改,或者更新注释以匹配新的逻辑。

@18202781743
Copy link
Contributor Author

/forcemerge

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Feb 5, 2026

This pr force merged! (status: blocked)

@deepin-bot deepin-bot bot merged commit 7f14cdc into linuxdeepin:master Feb 5, 2026
16 of 19 checks passed
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.

3 participants