()
| 79 | } |
| 80 | |
| 81 | func (b BuildConfig) preBuild() error { |
| 82 | for _, script := range b.PreBuild { |
| 83 | script = strings.TrimSpace(script) |
| 84 | if script == "" { |
| 85 | continue |
| 86 | } |
| 87 | |
| 88 | title := fmt.Sprintf("[pre build %s]", b.PortConfig.nameVersion()) |
| 89 | script = b.expandVariables(script) |
| 90 | if err := checkUnexpandedVariables(script, title); err != nil { |
| 91 | return err |
| 92 | } |
| 93 | executor := cmd.NewExecutor(title, script) |
| 94 | |
| 95 | // prebuild port does not have repo dir. |
| 96 | if fileio.PathExists(b.PortConfig.RepoDir) { |
| 97 | executor.SetWorkDir(b.PortConfig.RepoDir) |
| 98 | } |
| 99 | |
| 100 | if err := executor.Execute(); err != nil { |
| 101 | return err |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | return nil |
| 106 | } |
| 107 | |
| 108 | func (b BuildConfig) postBuild() error { |
| 109 | for _, script := range b.PostBuild { |
nothing calls this directly
no test coverage detected