(m MetadataLegacy)
| 152 | } |
| 153 | |
| 154 | func buildLegacyRuntimeConfig(m MetadataLegacy) RuntimeConfig { |
| 155 | var protocolCommands []SubprocessProtocolCommand |
| 156 | if len(m.Downloaders) > 0 { |
| 157 | protocolCommands = |
| 158 | make([]SubprocessProtocolCommand, 0, len(m.Downloaders)) |
| 159 | for _, d := range m.Downloaders { |
| 160 | protocolCommands = append(protocolCommands, SubprocessProtocolCommand{ |
| 161 | Protocols: d.Protocols, |
| 162 | PlatformCommand: []PlatformCommand{{Command: d.Command}}, |
| 163 | }) |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | platformCommand := m.PlatformCommand |
| 168 | if len(platformCommand) == 0 && len(m.Command) > 0 { |
| 169 | platformCommand = []PlatformCommand{{Command: m.Command}} |
| 170 | } |
| 171 | |
| 172 | platformHooks := m.PlatformHooks |
| 173 | expandHookArgs := true |
| 174 | if len(platformHooks) == 0 && len(m.Hooks) > 0 { |
| 175 | platformHooks = make(PlatformHooks, len(m.Hooks)) |
| 176 | for hookName, hookCommand := range m.Hooks { |
| 177 | platformHooks[hookName] = []PlatformCommand{{Command: "sh", Args: []string{"-c", hookCommand}}} |
| 178 | expandHookArgs = false |
| 179 | } |
| 180 | } |
| 181 | return &RuntimeConfigSubprocess{ |
| 182 | PlatformCommand: platformCommand, |
| 183 | PlatformHooks: platformHooks, |
| 184 | ProtocolCommands: protocolCommands, |
| 185 | expandHookArgs: expandHookArgs, |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | func fromMetadataV1(mv1 MetadataV1) (*Metadata, error) { |
| 190 | config, err := unmarshalConfig(mv1.Type, mv1.Config) |
no outgoing calls
no test coverage detected
searching dependent graphs…