()
| 281 | } |
| 282 | |
| 283 | func (b BuildConfig) Validate() error { |
| 284 | // Validate buildsystem. |
| 285 | name, _, hasVersion, err := b.parseBuildSystem(b.BuildSystem) |
| 286 | if err != nil { |
| 287 | return err |
| 288 | } |
| 289 | |
| 290 | // Check unsupported buildsystem. |
| 291 | if !slices.Contains(buildSystems, name) { |
| 292 | return fmt.Errorf("unsupported build system for %s, it should be one of %s", b.BuildSystem, strings.Join(buildSystems, ", ")) |
| 293 | } |
| 294 | |
| 295 | // Validate versioned build system. |
| 296 | if hasVersion && name != "cmake" && name != "meson" && name != "gyp" { |
| 297 | return fmt.Errorf("build_system %q does not support version suffix, only cmake, meson and gyp support versions", b.BuildSystem) |
| 298 | } |
| 299 | |
| 300 | // Validate c_standard. |
| 301 | if strings.TrimSpace(b.CStandard) != "" && !slices.Contains(CStandards, b.CStandard) { |
| 302 | return fmt.Errorf("c_standard should be one of %s", strings.Join(CStandards, ", ")) |
| 303 | } |
| 304 | |
| 305 | // Validate cxx_standard. |
| 306 | if strings.TrimSpace(b.CXXStandard) != "" && !slices.Contains(CXXStandards, b.CXXStandard) { |
| 307 | return fmt.Errorf("cxx_standard should be one of %s", strings.Join(CXXStandards, ", ")) |
| 308 | } |
| 309 | |
| 310 | return nil |
| 311 | } |
| 312 | |
| 313 | func (b BuildConfig) Clone(repoUrl, repoRef, archive string, depth int) error { |
| 314 | if fileio.PathExists(b.PortConfig.RepoDir) { |
nothing calls this directly
no test coverage detected