( ctx context.Context, dag *dagql.Server, load moduleLoadRequest, )
| 720 | } |
| 721 | |
| 722 | func (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. |
no test coverage detected