pendingRelatedModule adapts a related module of a primary module into the existing pendingModule loading path. Related modules are modules attached through the primary module source's blueprint or toolchains. They are resolved separately from regular dependencies but still need the same legacy comp
( defaultPathContextSrc dagql.ObjectResult[*core.ModuleSource], related *core.ModuleSource, cfg *modules.ModuleConfigDependency, entrypoint bool, )
| 797 | // already resolving +defaultPath through another source, it is that outer |
| 798 | // ContextSource. |
| 799 | func pendingRelatedModule( |
| 800 | defaultPathContextSrc dagql.ObjectResult[*core.ModuleSource], |
| 801 | related *core.ModuleSource, |
| 802 | cfg *modules.ModuleConfigDependency, |
| 803 | entrypoint bool, |
| 804 | ) pendingModule { |
| 805 | mod := pendingModule{ |
| 806 | Ref: related.AsString(), |
| 807 | RefPin: related.Pin(), |
| 808 | Entrypoint: entrypoint, |
| 809 | // LegacyDefaultPath is intentionally not set here. Related modules |
| 810 | // are loaded as siblings of an explicit -m entrypoint: their |
| 811 | // +defaultPath must resolve against that entrypoint's repo (the |
| 812 | // -m argument), not against the session's currentWorkspace — the |
| 813 | // latter is the user's CWD, which may be empty, partial, or a |
| 814 | // different checkout entirely. |
| 815 | } |
| 816 | if defaultPathContextSrc.Self() != nil { |
| 817 | mod.DefaultPathContextSourceRef = defaultPathContextSrc.Self().AsString() |
| 818 | mod.DefaultPathContextSourcePin = defaultPathContextSrc.Self().Pin() |
| 819 | } |
| 820 | if cfg != nil { |
| 821 | if cfg.Name != "" { |
| 822 | mod.Name = cfg.Name |
| 823 | } |
| 824 | mod.ConfigDefaults = workspace.ExtractConfigDefaults(cfg.Customizations) |
| 825 | mod.ArgCustomizations = cfg.Customizations |
| 826 | } |
| 827 | if entrypoint && defaultPathContextSrc.Self() != nil && defaultPathContextSrc.Self().Kind == core.ModuleSourceKindLocal { |
| 828 | mod.LegacyCallerModuleDir = defaultPathContextSrc.Self().AsString() |
| 829 | } |
| 830 | return mod |
| 831 | } |
| 832 | |
| 833 | func (srv *Server) resolveModuleSourceAsModule( |
| 834 | ctx context.Context, |
no test coverage detected