File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
Sources/SwiftDocC/Infrastructure Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -138,15 +138,9 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
138138 }
139139
140140 /// The root module nodes of the Topic Graph.
141- public var rootModules : [ ResolvedTopicReference ] {
142- return topicGraph. nodes. values. compactMap { node in
143- guard node. kind == . module,
144- !onlyHasSnippetRelatedChildren( for: node. reference) else {
145- return nil
146- }
147- return node. reference
148- }
149- }
141+ ///
142+ /// This property is initialized during the registration of a documentation bundle.
143+ public private( set) var rootModules : [ ResolvedTopicReference ] !
150144
151145 /// The topic reference of the root module, if it's the only registered module.
152146 var soleRootModuleReference : ResolvedTopicReference ? {
@@ -1859,6 +1853,16 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
18591853
18601854 try shouldContinueRegistration ( )
18611855
1856+ // Keep track of the root modules registered from symbol graph files, we'll need them to automatically
1857+ // curate articles.
1858+ rootModules = topicGraph. nodes. values. compactMap { node in
1859+ guard node. kind == . module,
1860+ !onlyHasSnippetRelatedChildren( for: node. reference) else {
1861+ return nil
1862+ }
1863+ return node. reference
1864+ }
1865+
18621866 // Articles that will be automatically curated can be resolved but they need to be pre registered before resolving links.
18631867 let rootNodeForAutomaticCuration = soleRootModuleReference. flatMap ( topicGraph. nodeWithReference ( _: ) )
18641868 if rootNodeForAutomaticCuration != nil {
You can’t perform that action at this time.
0 commit comments