installFrameworks installs framework components (APM agents, etc.)
()
| 125 | |
| 126 | // installFrameworks installs framework components (APM agents, etc.) |
| 127 | func (s *Supplier) installFrameworks() error { |
| 128 | // Create framework context |
| 129 | ctx := &common.Context{ |
| 130 | Stager: s.Stager, |
| 131 | Manifest: s.Manifest, |
| 132 | Installer: s.Installer, |
| 133 | Log: s.Log, |
| 134 | Command: s.Command, |
| 135 | } |
| 136 | |
| 137 | // Create and populate framework registry |
| 138 | registry := frameworks.NewRegistry(ctx) |
| 139 | registry.RegisterStandardFrameworks() |
| 140 | |
| 141 | // Detect all frameworks that should be installed |
| 142 | detectedFrameworks, frameworkNames, err := registry.DetectAll() |
| 143 | if err != nil { |
| 144 | s.Log.Warning("Failed to detect frameworks: %s", err.Error()) |
| 145 | return nil // Don't fail the build if framework detection fails |
| 146 | } |
| 147 | |
| 148 | if len(detectedFrameworks) == 0 { |
| 149 | s.Log.Info("No frameworks detected") |
| 150 | return nil |
| 151 | } |
| 152 | |
| 153 | s.Log.BeginStep("Installing frameworks [%v]", strings.Join(frameworkNames, ", ")) |
| 154 | |
| 155 | // Install all detected frameworks |
| 156 | // Framework installation errors are fatal and will abort the build, |
| 157 | // matching the behavior of the Ruby buildpack |
| 158 | for i, framework := range detectedFrameworks { |
| 159 | s.Log.Info("Installing %s%s", frameworkNames[i], s.frameworkVersionSuffix(framework)) |
| 160 | if err := framework.Supply(); err != nil { |
| 161 | return fmt.Errorf("failed to install framework %s: %w", frameworkNames[i], err) |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | return nil |
| 166 | } |
| 167 | |
| 168 | func (s *Supplier) frameworkVersionSuffix(framework frameworks.Framework) string { |
| 169 | provider, ok := framework.(frameworks.DependencyIdentifierProvider) |
no test coverage detected