MCPcopy Create free account
hub / github.com/dagger/dagger / BuildLegacyAsModuleArgs

Function BuildLegacyAsModuleArgs

core/schema/modulesource.go:3195–3249  ·  view source on GitHub ↗

load the given module source's dependencies as modules BuildLegacyAsModuleArgs is the single builder for the asModule args salted into AsModuleVariantDigest, so every load path yields one module identity.

(
	nameOverride string,
	legacyDefaultPath bool,
	defaultPathContextSourceRef string,
	defaultPathContextSourcePin string,
	configDefaults map[string]any,
	defaultsFromDotEnv bool,
	argCustomizations []*modules.ModuleConfigArgument,
)

Source from the content-addressed store, hash-verified

3193// BuildLegacyAsModuleArgs is the single builder for the asModule args salted
3194// into AsModuleVariantDigest, so every load path yields one module identity.
3195func BuildLegacyAsModuleArgs(
3196 nameOverride string,
3197 legacyDefaultPath bool,
3198 defaultPathContextSourceRef string,
3199 defaultPathContextSourcePin string,
3200 configDefaults map[string]any,
3201 defaultsFromDotEnv bool,
3202 argCustomizations []*modules.ModuleConfigArgument,
3203) ([]dagql.NamedInput, error) {
3204 args := []dagql.NamedInput{}
3205 if nameOverride != "" {
3206 args = append(args, dagql.NamedInput{
3207 Name: "legacyNameOverride", Value: dagql.String(nameOverride),
3208 })
3209 }
3210 if legacyDefaultPath {
3211 args = append(args, dagql.NamedInput{
3212 Name: "legacyDefaultPath", Value: dagql.Boolean(true),
3213 })
3214 }
3215 if defaultPathContextSourceRef != "" {
3216 args = append(args, dagql.NamedInput{
3217 Name: "defaultPathContextSourceRef", Value: dagql.String(defaultPathContextSourceRef),
3218 })
3219 if defaultPathContextSourcePin != "" {
3220 args = append(args, dagql.NamedInput{
3221 Name: "defaultPathContextSourcePin", Value: dagql.String(defaultPathContextSourcePin),
3222 })
3223 }
3224 }
3225 if len(configDefaults) > 0 {
3226 wsJSON, err := json.Marshal(configDefaults)
3227 if err != nil {
3228 return nil, fmt.Errorf("encoding workspace config: %w", err)
3229 }
3230 args = append(args, dagql.NamedInput{
3231 Name: "legacyWorkspaceConfigJson", Value: dagql.String(string(wsJSON)),
3232 })
3233 if defaultsFromDotEnv {
3234 args = append(args, dagql.NamedInput{
3235 Name: "legacyDefaultsFromDotEnv", Value: dagql.Boolean(true),
3236 })
3237 }
3238 }
3239 if len(argCustomizations) > 0 {
3240 custJSON, err := json.Marshal(argCustomizations)
3241 if err != nil {
3242 return nil, fmt.Errorf("encoding arg customizations: %w", err)
3243 }
3244 args = append(args, dagql.NamedInput{
3245 Name: "legacyArgCustomizationsJson", Value: dagql.String(string(custJSON)),
3246 })
3247 }
3248 return args, nil
3249}
3250
3251func (s *moduleSourceSchema) loadDependencyModules(
3252 ctx context.Context,

Callers 2

loadDependencyModulesMethod · 0.85

Calls 3

StringTypeAlias · 0.92
BooleanTypeAlias · 0.92
MarshalMethod · 0.65

Tested by

no test coverage detected