MCPcopy Index your code
hub / github.com/dagger/dagger / pendingRelatedModule

Function pendingRelatedModule

engine/server/session_workspaces.go:799–831  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

797// already resolving +defaultPath through another source, it is that outer
798// ContextSource.
799func 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
833func (srv *Server) resolveModuleSourceAsModule(
834 ctx context.Context,

Callers 2

ServeModuleMethod · 0.85
resolveModuleLoadMethod · 0.85

Calls 4

ExtractConfigDefaultsFunction · 0.92
SelfMethod · 0.80
AsStringMethod · 0.45
PinMethod · 0.45

Tested by

no test coverage detected