()
| 102 | } |
| 103 | |
| 104 | func (t *targetConfig) generateComponents() (string, error) { |
| 105 | var components strings.Builder |
| 106 | for _, component := range t.Components { |
| 107 | bytes, err := templates.ReadFile("templates/components/Component.cmake.in") |
| 108 | if err != nil { |
| 109 | return "", err |
| 110 | } |
| 111 | |
| 112 | content := string(bytes) |
| 113 | content = strings.ReplaceAll(content, "@COMPONENT@", component.Component) |
| 114 | content = strings.ReplaceAll(content, "@FILENAME@", component.Filename) |
| 115 | |
| 116 | if len(component.Dependencies) == 0 { |
| 117 | content = strings.ReplaceAll(content, "@DEPENDENCIES@", "\n") |
| 118 | } else { |
| 119 | content = strings.ReplaceAll(content, "@DEPENDENCIES@", strings.Join(component.Dependencies, " ")+"\n") |
| 120 | } |
| 121 | |
| 122 | components.WriteString(content) |
| 123 | components.WriteString("\n") |
| 124 | } |
| 125 | return components.String(), nil |
| 126 | } |
| 127 | |
| 128 | func (t *targetConfig) isValidVersionFormat(version string) bool { |
| 129 | // Match patterns: |
no test coverage detected