// resolveJobPackageCompilationDependencies returns all packages required by all specified jobs, in compilation order (reverse dependency order)
975534
func (c *dependencyCompiler) resolveJobCompilationDependencies(jobs []bireljob.Job) ([]birelpkg.Compilable, error) {
	// collect and de-dupe all required packages (dependencies of jobs)
	packageMap := map[string]birelpkg.Compilable{}

	for _, releaseJob := range jobs {
		for _, releasePackage := range releaseJob.Packages {
			pkgKey := c.pkgKey(releasePackage)
			packageMap[pkgKey] = releasePackage
			c.resolvePackageDependencies(releasePackage, packageMap)
		}
	}

	// flatten map values to array
	packages := make([]birelpkg.Compilable, 0, len(packageMap))

	for _, releasePackage := range packageMap {
		packages = append(packages, releasePackage)
	}

	// sort in compilation order
	sortedPackages, err := birelpkg.Sort(packages)
	if err != nil {
		return nil, err
	}

	pkgs := []string{}

	for _, pkg := range sortedPackages {
		pkgs = append(pkgs, fmt.Sprintf("%s/%s", pkg.Name(), pkg.Fingerprint()))
	}

	c.logger.Debug(c.logTag, "Sorted dependencies:\n%s", strings.Join(pkgs, "\n"))

	return sortedPackages, nil
}
213459
func (o *ObjectConstraint) SchemaDependency(from string, c Constraint) *ObjectConstraint {
	o.deplock.Lock()
	defer o.deplock.Unlock()

	o.schemadeps[from] = c
	return o
}
891897
func (b *jobRenderer) renderJobTemplates(
	releaseJobs []bireljob.Job,
	releaseJobProperties map[string]*biproperty.Map,
	jobProperties biproperty.Map,
	globalProperties biproperty.Map,
	deploymentName string,
	stage biui.Stage,
) ([]RenderedJobRef, error) {
	renderedJobRefs := make([]RenderedJobRef, 0, len(releaseJobs))
	err := stage.Perform("Rendering job templates", func() error {
		renderedJobList, err := b.jobListRenderer.Render(releaseJobs, releaseJobProperties, jobProperties, globalProperties, deploymentName, "")
		if err != nil {
			return err
		}
		defer renderedJobList.DeleteSilently()

		for _, renderedJob := range renderedJobList.All() {
			renderedJobRef, err := b.compressAndUpload(renderedJob)
			if err != nil {
				return err
			}

			renderedJobRefs = append(renderedJobRefs, renderedJobRef)
		}

		return nil
	})

	return renderedJobRefs, err
}
45755
func (s *ListCompilationJobsOutput) SetCompilationJobSummaries(v []*CompilationJobSummary) *ListCompilationJobsOutput {
	s.CompilationJobSummaries = v
	return s
}
547966
func ResolveServiceNetworks(ctx context.Context, c api.ControlClient, spec *api.ServiceSpec) error {
	if len(spec.Task.Networks) == 0 {
		return nil
	}
	networks := make([]*api.NetworkAttachmentConfig, 0, len(spec.Task.Networks))
	for _, na := range spec.Task.Networks {
		n, err := GetNetwork(ctx, c, na.Target)
		if err != nil {
			return err
		}

		networks = append(networks, &api.NetworkAttachmentConfig{
			Target: n.ID,
		})
	}

	spec.Task.Networks = networks
	return nil
}
616911
func (c *dependencyCompiler) Compile(jobs []bireljob.Job, stage biui.Stage) ([]CompiledPackageRef, error) {
	compileOrderReleasePackages, err := c.resolveJobCompilationDependencies(jobs)
	if err != nil {
		return nil, bosherr.WrapError(err, "Resolving job package dependencies")
	}

	compiledPackageRefs, err := c.compilePackages(compileOrderReleasePackages, stage)
	if err != nil {
		return nil, bosherr.WrapError(err, "Compiling job package dependencies")
	}

	return compiledPackageRefs, nil
}
354713
func (s *StopCompilationJobInput) SetCompilationJobName(v string) *StopCompilationJobInput {
	s.CompilationJobName = &v
	return s
}
1257578
func (e *BindMount) GetDependencies(tasks map[string]fi.Task) []fi.Task {
	var deps []fi.Task

	// Requires parent directories to be created
	for _, v := range findCreatesDirParents(e.Mountpoint, tasks) {
		deps = append(deps, v)
	}
	for _, v := range findCreatesDirMatching(e.Mountpoint, tasks) {
		if v != e && findTaskInSlice(deps, v) == -1 {
			deps = append(deps, v)
		}
	}

	// Requires source to be created
	for _, v := range findCreatesDirParents(e.Source, tasks) {
		if findTaskInSlice(deps, v) == -1 {
			deps = append(deps, v)
		}
	}
	for _, v := range findCreatesDirMatching(e.Source, tasks) {
		if v != e && findTaskInSlice(deps, v) == -1 {
			deps = append(deps, v)
		}
	}

	return deps
}
98796
func (s *DescribeCompilationJobOutput) SetCompilationJobName(v string) *DescribeCompilationJobOutput {
	s.CompilationJobName = &v
	return s
}
927533
func (s *Schema) ResolveRefs(loadExternal bool) {
	s.resolveSelfAndBelow(*s, *s, loadExternal)
}
1220574
func ResolveCacheImporterFunc(sm *session.Manager, resolverOpt resolver.ResolveOptionsFunc, rs reference.Store, is imagestore.Store) remotecache.ResolveCacheImporterFunc {

	upstream := registryremotecache.ResolveCacheImporterFunc(sm, resolverOpt)

	return func(ctx context.Context, attrs map[string]string) (remotecache.Importer, specs.Descriptor, error) {
		if dt, err := tryImportLocal(rs, is, attrs["ref"]); err == nil {
			return newLocalImporter(dt), specs.Descriptor{}, nil
		}
		return upstream(ctx, attrs)
	}
}
1233640
func (w *Worker) CodePackageInfo(codeId string) (code CodeInfo, err error) {
	out := CodeInfo{}
	err = w.codes(codeId).Req("GET", nil, &out)
	return out, err
}
1118787
func (s *CompilationJobSummary) SetCompilationJobStatus(v string) *CompilationJobSummary {
	s.CompilationJobStatus = &v
	return s
}
202626
func (m *Module) RegisterDependencies(a app.App) error {
	commandScope := a.CommandScope()
	commandScope.Set("command.h", m.Help)
	commandScope.Set("command.help", m.Help)
	return nil
}
385004
func sortDependenciesR(root Root, seen map[string]bool, sorted *[]Root, depFunc func(Root) []Root) {
	for _, dep := range depFunc(root) {
		if !seen[dep.DSLName()] {
			seen[root.DSLName()] = true
			sortDependenciesR(dep, seen, sorted, depFunc)
		}
	}
	*sorted = append(*sorted, root)
}
946306
func CheckDependencies(ch *chart.Chart, reqs *chartutil.Requirements) error {
	missing := []string{}

	deps := ch.GetDependencies()
	for _, r := range reqs.Dependencies {
		found := false
		for _, d := range deps {
			if d.Metadata.Name == r.Name {
				found = true
				break
			}
		}
		if !found {
			missing = append(missing, r.Name)
		}
	}

	if len(missing) > 0 {
		return fmt.Errorf("found in requirements.yaml, but missing in charts/ directory: %s", strings.Join(missing, ", "))
	}
	return nil
}
65988
func templateChainDependencies(template Template) []Template {
	requires := template.Templates()
	chain := make([]Template, len(requires)*2)
	for _, req := range requires {
		chain = append(chain, templateChainDependencies(req)...)
	}
	chain = append(chain, template)
	return chain
}