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

Method resolveModuleLoad

engine/server/session_workspaces.go:722–784  ·  view source on GitHub ↗
(
	ctx context.Context,
	dag *dagql.Server,
	load moduleLoadRequest,
)

Source from the content-addressed store, hash-verified

720}
721
722func (srv *Server) resolveModuleLoad(
723 ctx context.Context,
724 dag *dagql.Server,
725 load moduleLoadRequest,
726) (resolvedModuleLoad, error) {
727 primary, err := srv.resolveModule(ctx, dag, load.mod)
728 if err != nil {
729 return resolvedModuleLoad{}, err
730 }
731
732 resolved := resolvedModuleLoad{
733 primary: primary,
734 primaryEntrypoint: load.mod.Entrypoint,
735 }
736 if !load.extra {
737 return resolved, nil
738 }
739
740 if !primary.Self().Source.Valid || primary.Self().Source.Value.Self() == nil {
741 return resolved, nil
742 }
743 src := primary.Self().Source.Value
744 defaultPathContextSrc := src
745 if primary.Self().ContextSource.Valid && primary.Self().ContextSource.Value.Self() != nil {
746 defaultPathContextSrc = primary.Self().ContextSource.Value
747 }
748
749 for i, toolchainSrc := range src.Self().Toolchains {
750 if toolchainSrc.Self() == nil {
751 continue
752 }
753 var cfg *modules.ModuleConfigDependency
754 if i < len(src.Self().ConfigToolchains) {
755 cfg = src.Self().ConfigToolchains[i]
756 }
757 pending := pendingRelatedModule(defaultPathContextSrc, toolchainSrc.Self(), cfg, false)
758 toolchainMod, err := srv.resolveModuleSourceAsModule(ctx, dag, toolchainSrc, pending)
759 if err != nil {
760 return resolvedModuleLoad{}, fmt.Errorf("resolving toolchain module: %w", err)
761 }
762 resolved.related = append(resolved.related, resolvedServedModule{
763 mod: toolchainMod,
764 entrypoint: false,
765 })
766 }
767
768 if src.Self().Blueprint.Self() != nil {
769 pending := pendingRelatedModule(defaultPathContextSrc, src.Self().Blueprint.Self(), src.Self().ConfigBlueprint, true)
770 blueprintMod, err := srv.resolveModuleSourceAsModule(ctx, dag, src.Self().Blueprint, pending)
771 if err != nil {
772 return resolvedModuleLoad{}, fmt.Errorf("resolving blueprint module: %w", err)
773 }
774 resolved.related = append(resolved.related, resolvedServedModule{
775 mod: blueprintMod,
776 entrypoint: true,
777 })
778 // When the selected module points at a separate blueprint, only the
779 // blueprint should contribute Query-root entrypoint proxies.

Callers 1

ensureModulesLoadedMethod · 0.95

Calls 4

resolveModuleMethod · 0.95
pendingRelatedModuleFunction · 0.85
SelfMethod · 0.80

Tested by

no test coverage detected