mirror of
https://github.com/hashicorp/packer.git
synced 2026-06-09 00:32:09 -04:00
test: only build plugins if not already done
Calling BuildSimplePlugin for a particular version used to mean that we had to build it regardless of if it was previously done or not. This commit changes this behaviour so that it checks first that the plugin wasn't pre-compiled, and if it was, we immediately return.
This commit is contained in:
parent
fde79cc667
commit
fc056a4594
1 changed files with 9 additions and 1 deletions
|
|
@ -95,7 +95,13 @@ func BinaryName(version *version.Version) string {
|
|||
//
|
||||
// The path to the plugin is returned, it won't be removed automatically
|
||||
// though, deletion is the caller's responsibility.
|
||||
func BuildSimplePlugin(versionString string, t *testing.T) {
|
||||
func BuildSimplePlugin(versionString string, t *testing.T) string {
|
||||
// Only build plugin binary if not already done beforehand
|
||||
path, ok := LoadPluginVersion(versionString)
|
||||
if ok {
|
||||
return path
|
||||
}
|
||||
|
||||
v := version.Must(version.NewSemver(versionString))
|
||||
|
||||
t.Logf("Building plugin in version %v", v)
|
||||
|
|
@ -115,6 +121,8 @@ func BuildSimplePlugin(versionString string, t *testing.T) {
|
|||
}
|
||||
|
||||
StorePluginVersion(v.String(), outBin)
|
||||
|
||||
return outBin
|
||||
}
|
||||
|
||||
// currentDir returns the directory in which the current file is located.
|
||||
|
|
|
|||
Loading…
Reference in a new issue