MCPcopy Index your code
hub / github.com/jetify-com/devbox / BuildInputsForSymlinkJoin

Method BuildInputsForSymlinkJoin

internal/shellgen/flake_input.go:48–95  ·  view source on GitHub ↗

BuildInputsForSymlinkJoin returns a list of SymlinkJoin objects that can be used as the buildInput. Used for packages that have non-default outputs that need to be combined into a single buildInput.

()

Source from the content-addressed store, hash-verified

46// as the buildInput. Used for packages that have non-default outputs that need to
47// be combined into a single buildInput.
48func (f *flakeInput) BuildInputsForSymlinkJoin() ([]*SymlinkJoin, error) {
49 joins := []*SymlinkJoin{}
50 for _, pkg := range f.Packages {
51
52 // Skip packages that don't need a symlink join.
53 if needs, err := needsSymlinkJoin(pkg); err != nil {
54 return nil, err
55 } else if !needs {
56 continue
57 }
58
59 // Skip packages that are already in the binary cache. These will be directly
60 // included in the buildInputs using `builtins.fetchClosure` of their store paths.
61 inCache, err := pkg.IsInBinaryCache()
62 if err != nil {
63 return nil, err
64 }
65 if inCache {
66 continue
67 }
68
69 attributePath, err := pkg.FullPackageAttributePath()
70 if err != nil {
71 return nil, err
72 }
73
74 if pkg.Patch {
75 return nil, errors.New("patch_glibc is not yet supported for packages with non-default outputs")
76 }
77
78 outputNames, err := pkg.GetOutputNames()
79 if err != nil {
80 return nil, err
81 }
82
83 joins = append(joins, &SymlinkJoin{
84 Name: pkg.String() + "-combined",
85 Paths: lo.Map(outputNames, func(outputName string, _ int) string {
86 if !f.Ref.IsNixpkgs() {
87 return f.Name + "." + attributePath + "." + outputName
88 }
89 parts := strings.Split(attributePath, ".")
90 return f.PkgImportName() + "." + strings.Join(parts[2:], ".") + "." + outputName
91 }),
92 })
93 }
94 return joins, nil
95}
96
97func (f *flakeInput) BuildInputs() ([]string, error) {
98 var err error

Callers

nothing calls this directly

Calls 7

PkgImportNameMethod · 0.95
needsSymlinkJoinFunction · 0.85
IsInBinaryCacheMethod · 0.80
GetOutputNamesMethod · 0.80
IsNixpkgsMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected