Repository navigation
fix(xvm): let a package's own target own its ungrouped headers - #391
Merged
Merged
Conversation
The normalizer never sets a group on a header, and registration rejected an ungrouped header whenever there was more than one candidate group. Every node without a binding becomes its own singleton group, so any recipe that registers several independent targets -- a program plus a library is the common shape -- and then declares headers failed to install outright with HeaderAmbiguous. Break the tie with the package's own target: headers shipped by package p belong with p. Recipes conventionally register a target under the package name, so this resolves the ordinary case without guessing. It stays ambiguous, deliberately, when that target is absent from the batch or is bound into more than one group -- naming it then identifies no single owner, and picking a group arbitrarily is how headers end up attached to something that does not ship them. The error now names the hint it tried and says to put an explicit group on the header. Tests: the resolving case, both ambiguous cases, and an adapter-level case shaped like a real recipe (program + lib + headers) that goes through the normalizer, so it also pins the wiring -- that the batch carries the package's own name. The two pre-existing tests asserting HeaderAmbiguous still hold: neither registers a target under the package name, so neither has an owner to infer.
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.
Problem
normalize_xpkg_registration_plan构造 header 时从不设.group:plan.batch.headers.push_back({ .sourceDir = operation.includedir });而
apply_registration_batch对无 group 的 header 要求groups.size() == 1,否则HeaderAmbiguous硬失败。由于每个无 binding 的节点都会各自成为一个单例 group,任何注册了多个独立 target 再声明 headers 的 recipe 都会直接装不上 —— program + lib 是最常见的形态:
这在
origin/main上是能装的。Change
用包自身的 target 打破平局:包
p发布的头文件属于p。recipe 惯例上都会注册一个与包同名的 target,所以这解决了常规情形而不需要猜。RegistrationBatch增加primaryTarget,由 normalizer 填node.name。保持歧义(有意为之) 的两种情况:
这两种情况下随便挑一个 group,正是"头文件挂到不发布它的组上"的成因。错误信息现在会说明尝试过的 hint 以及怎么解决(在 header 上显式指定 group)。
Tests
UngroupedHeaderFallsBackToThePrimaryTargetUngroupedHeaderStaysAmbiguousWhenPrimaryTargetIsNotRegisteredUngroupedHeaderStaysAmbiguousWhenPrimaryTargetSpansGroupsUngroupedHeaderRoutesToThePackagesOwnTarget最后一条同时钉住了接线(批次确实携带包名)—— 这正是 P0.1 里我无法覆盖的那类缺口,这次补上了。
构造第三条测试时发现:同一 target 注册两个版本且都无 binding,会在更早的
GroupConflict就被拒(两者的 label 都是 target 名,root 不同)。所以能真正走到"跨组"分支的是两个不同 root 的绑定,测试已按此构造。两条既有的
HeaderAmbiguous测试保持通过 —— 它们都没有注册与包同名的 target,因此本来就无 owner 可推断。Verification
CI 状态为已知上游拉取签名(见 #386),依计划 §3.1.1 合入集成分支。