This is an archive of the discontinued LLVM Phabricator instance.

[runtimes] Handle interface targets in runtimes distribution components
ClosedPublic

Authored by ldionne on Aug 22 2022, 9:04 AM.

Details

Summary

As reported in [1], cxx-headers is not a valid distribution target
because it is an interface target in CMake. This breaks the most
basic MultiDistributionExample of the runtimes build.

This patch handles interface targets by getting rid of the assumption
that all distribution components have a target associated to them. It
is valid for a distribution component to only have a install-FOO
target.

In the case where only cxx-headers is provided as a distribution
component, ninja toolchain-distribution will not build anything
after this patch, since there is effectively nothing to build for
the cxx-headers target. However, running ninja install-toolchain-distribution
will build everything, as expected.

[1]: https://discord.com/channels/636084430946959380/636732894974312448/1010013287464828968

Diff Detail

Event Timeline

ldionne created this revision.Aug 22 2022, 9:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 22 2022, 9:04 AM
Herald added a subscriber: mgorny. · View Herald Transcript
ldionne requested review of this revision.Aug 22 2022, 9:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 22 2022, 9:04 AM
ldionne added a reviewer: Restricted Project.Aug 22 2022, 9:05 AM
phosek accepted this revision.Aug 22 2022, 9:51 AM

LGTM

This revision is now accepted and ready to land.Aug 22 2022, 9:51 AM

Hey thanks for looking into this @ldionne

Maybe I'm missing some scope here (I'm very much not an expert on LLVMDistributionSupport), but is the intent here that not every component has a build, but every component should have an install (that may depend on a build, but also might not)?

If that's the case, then this looks good, and is a fairly simple and elegant solution, as opposed to my force-a-build-target solution I'm doing downstream at the moment.

ldionne accepted this revision as: Restricted Project.Aug 23 2022, 5:55 AM

Hey thanks for looking into this @ldionne

Maybe I'm missing some scope here (I'm very much not an expert on LLVMDistributionSupport), but is the intent here that not every component has a build, but every component should have an install (that may depend on a build, but also might not)?

If that's the case, then this looks good, and is a fairly simple and elegant solution, as opposed to my force-a-build-target solution I'm doing downstream at the moment.

Yeah, basically, I see build targets as being implementation details of the build. What folks should really care about is having correct dependencies between install-FOO targets. If you build install-cxx-headers, then *that* needs to do the right thing, but who cares whether cxx-headers even exists? The fact that it's an interface (or not) target should not matter. This patch attempts to implement that point of view.

This revision was landed with ongoing or failed builds.Aug 23 2022, 5:56 AM
This revision was automatically updated to reflect the committed changes.