Skip to content

Commit 9100942

Browse files
committed
The M3 refusal reads the resolution's declaredShared fact for the package that constrains its form
1 parent 6b0f130 commit 9100942

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

‎src/build/prepare.cppm‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11953,8 +11953,8 @@ prepare_build(bool print_fingerprint,
1195311953
== dist::Contract::SelfContained;
1195411954
// A refused library, and the statement that makes it shared when its
1195511955
// own package makes it so: an edge's `linkage = "static"` cannot change
11956-
// a form the package constrains, so that remedy is offered only where
11957-
// the resolution says a request or a default decided.
11956+
// a form the package constrains (`declaredShared`), so that remedy is
11957+
// offered only where a request or the package's default decided.
1195811958
struct Refused { std::string name; std::string statedBy; };
1195911959
std::vector<Refused> withoutRuntime;
1196011960
const auto runtimeObjects = mcpp::build::package_link_objects(ctx.plan, providerName);
@@ -11969,14 +11969,13 @@ prepare_build(bool print_fingerprint,
1196911969
continue;
1197011970
}
1197111971
Refused r{ lu.targetName, {} };
11972-
for (std::size_t i = 1; i < packages.size(); ++i) {
11973-
auto form = graphLinkForms.find(i);
11974-
if (form == graphLinkForms.end()) continue;
11975-
if (form->second.second != "package-kind" && form->second.second != "row-kind")
11976-
continue;
11972+
for (auto const& [i, form] : dependencyLinkForms) {
11973+
if (!form.facts.declaredShared || i >= packages.size()) continue;
1197711974
for (auto const& t : packages[i].manifest.targets)
11978-
if (t.name == lu.targetName && !t.kindDeclaredBy.empty())
11979-
r.statedBy = t.kindDeclaredBy;
11975+
if (t.name == lu.targetName)
11976+
r.statedBy = form.facts.declaredSharedBy.empty()
11977+
? std::string("its manifest declares a shared library target")
11978+
: form.facts.declaredSharedBy;
1198011979
}
1198111980
withoutRuntime.push_back(std::move(r));
1198211981
}

0 commit comments

Comments
 (0)