Skip to content

[enhancement] manifest [features] 支持条件依赖与依赖 feature 转发(dep/feat;挡住 opencv 模块包的 opencv.dnn 接口) #243

Description

@Sunrisepeak

诉求

mcpp.toml(manifest)侧的 [features] 目前支持 sources/implies/defines,
但不支持:

  1. feature 条件依赖(描述符 lua 侧 0.0.97 已支持 features.x.deps,
    manifest 侧没有对应物);
  2. 向依赖转发 feature(cargo 的 dep/feat 语法对应物):
    features.dnn = { deps-features = { "compat.opencv" = ["dnn"] } } 之类。

场景(opencv-m 的 opencv.dnn 模块接口,mcpp-index PR #79 后续)

compat.opencv 已带 dnn feature(+309 TU)。opencv 模块包想提供
import opencv.dnn;,理想形态:

[features]
dnn = { sources = ["src/dnn.cppm"], forward = { "compat.opencv" = ["dnn"] } }

消费端 opencv = { version = "0.0.3", features = ["dnn"] } → 模块包启用
dnn.cppm 源 + 依赖的 compat.opencv 以 features=["dnn"] 解析。没有 (2),
模块包只能永远全量拉 dnn(所有消费者多 300 TU)或不提供 dnn 模块接口。

环境

mcpp 0.0.97

Activity

  1. added 6 commits that reference this issue on Jul 18, 2026
  2. Sunrisepeak commented on Jul 18, 2026

    @Sunrisepeak
    MemberAuthor

    Status (0.0.98): design finalized — see .agents/docs/2026-07-19-issue-243-feature-forwarding-design.md. Scoping clarified: feature-conditional deps ALREADY exist ([feature-deps] / xpkg features.x.deps); the real gap is dep/feat forwarding. Implementation is a follow-up PR (0.0.99+) — the #242 work already converged the per-package feature request onto DependencyEdge/aggregatedRequest, which the forwarding builds on. Keeping open for the impl.

  3. added a commit that references this issue on Jul 19, 2026
  4. added 3 commits that reference this issue on Jul 19, 2026
  5. Sunrisepeak commented on Jul 19, 2026

    @Sunrisepeak
    MemberAuthor

    Resolved in mcpp 0.0.99 (released + indexed).

    Feature dep/feat forwarding is implemented (Cargo parity). A [features] implied token containing / — or the dedicated table-form forward = ["dep/feat"] key — forwards a feature to a dependency:

    [features]
    dnn = { sources = ["src/dnn.cppm"], implies = ["compat.opencv/dnn"] }
    [dependencies]
    compat.opencv = { version = "0.0.3", default-features = false }
    • One data model Manifest::featureForwards, two grammars (TOML + xpkg descriptor) sharing a single split point split_feature_forward_token.
    • Injected into the 0.0.98 aggregatedRequest/DependencyEdge funnel: the forwarded feature is added to a child's request before it is pushed onto the resolution worklist, so both resolution (mergeActiveFeatureDeps pulls the forwarded feature's conditional deps) and activation (recordDependencyEdge → aggregatedRequest → apply emits its defines/sources) observe it. Transitive via the BFS forward edge (root→mid→leaf).
    • Additive with [enhancement] 消费端 default-features 关闭语法(default = [...] 已有,但退不掉;挡住 compat.ffmpeg 裁剪档形态) #242 default-features = false; consistent on mcpp build and mcpp test. Forward to an undeclared dep → strict error / warning; undefined dep feature reuses the existing does-not-declare gate.

    Verification: 3 unit tests + e2e 128_feature_forwarding.sh (transitive tree, both build/test paths); the released 0.0.99 binary installed via xlings passes the forwarding e2e end-to-end. PR #246, design .agents/docs/2026-07-19-v0.0.99-feature-forwarding-238-230-design.md.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions