Repository navigation
Fix: ensure full package and subincludes are parsed for export - #3621
Conversation
| // If [state.ParseMetadata] is set, we need the entire package (and hence its metadata) to be | ||
| // parsed. | ||
| label = label.PackageLabel() |
There was a problem hiding this comment.
What exactly is this for?
There's some subtlety around what these things need to wait for on parsing. I think it's less of a big deal for RecursiveParse because it's only called in here though.
There was a problem hiding this comment.
If ParseMetadata is enabled, then we parse all the targets in the package. Here we change the label from "//:something" to "//:all", this way we handle it as the normal case of parsing the entire package. Again this is required for the --notrim implementation since we'll need to have all targets (and their declared dependencies) available.
| if r.state.ParseMetadata && !pkg.Subrepo.IsExternal() { | ||
| // For storing parse metadata we have to make sure the whole package is done here - all targets | ||
| // but also the subincludes. | ||
| for _, subinc := range pkg.AllSubincludes(r.state.Graph) { |
There was a problem hiding this comment.
What exactly are we trying to solve here? At this point the package is parsed, and all its subincludes must be parsed for AllSubincludes to work? (or fundamentally for it to have finished parsing)
There was a problem hiding this comment.
The intention is to parse any adjacent targets. In a --notrim implementation, we expect the entire package to be exported. For example, subinclude(//lib:a) we'll want to parse the entire //lib:all for any other targets, such as //lib:b.
6d4d603 to
a1cf900
Compare
Fixes an issue where
plz export --notrimfails when an exported package contains unrequested adjacent targets with dependencies outside the primary build graph - meaning that it wasn't parsed by the initial Please build.ParseMetadatais enabled.ParseEntirePackagesince previous changes preferred the use ofParseMetadatafor this purpose.export_notrim_parse_entire_packageundertest/export.