make sure 'only' completely ignores post-processor
before this commit, if one would put a 'only' inside the post-processor definition, the post process could be skipped
This commit is contained in:
parent
55bfee509a
commit
074a74ec38
|
@ -37,6 +37,10 @@ func TestBuildOnlyFileCommaFlags(t *testing.T) {
|
||||||
if fileExists("cherry.txt") {
|
if fileExists("cherry.txt") {
|
||||||
t.Error("Expected NOT to find cherry.txt")
|
t.Error("Expected NOT to find cherry.txt")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !fileExists("tomato.txt") {
|
||||||
|
t.Error("Expected to find tomato.txt")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBuildStdin(t *testing.T) {
|
func TestBuildStdin(t *testing.T) {
|
||||||
|
@ -114,12 +118,12 @@ func TestBuildExceptFileCommaFlags(t *testing.T) {
|
||||||
fatalCommand(t, c.Meta)
|
fatalCommand(t, c.Meta)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, f := range []string{"chocolate.txt", "apple.txt", "peach.txt"} {
|
for _, f := range []string{"chocolate.txt", "apple.txt"} {
|
||||||
if fileExists(f) {
|
if fileExists(f) {
|
||||||
t.Errorf("Expected NOT to find %s", f)
|
t.Errorf("Expected NOT to find %s", f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, f := range []string{"vanilla.txt", "cherry.txt", "pear.txt"} {
|
for _, f := range []string{"vanilla.txt", "cherry.txt", "pear.txt", "peach.txt"} {
|
||||||
if !fileExists(f) {
|
if !fileExists(f) {
|
||||||
t.Errorf("Expected to find %s", f)
|
t.Errorf("Expected to find %s", f)
|
||||||
}
|
}
|
||||||
|
@ -169,4 +173,5 @@ func cleanup() {
|
||||||
os.RemoveAll("apple.txt")
|
os.RemoveAll("apple.txt")
|
||||||
os.RemoveAll("peach.txt")
|
os.RemoveAll("peach.txt")
|
||||||
os.RemoveAll("pear.txt")
|
os.RemoveAll("pear.txt")
|
||||||
|
os.RemoveAll("tomato.txt")
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,16 @@
|
||||||
"type": "shell-local",
|
"type": "shell-local",
|
||||||
"inline": [ "touch pear.txt" ]
|
"inline": [ "touch pear.txt" ]
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"only": [
|
||||||
|
"vanilla"
|
||||||
|
],
|
||||||
|
"name": "tomato",
|
||||||
|
"type": "shell-local",
|
||||||
|
"inline": [ "touch tomato.txt" ]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -181,12 +181,15 @@ func (c *Core) Build(n string) (Build, error) {
|
||||||
current := make([]coreBuildPostProcessor, 0, len(rawPs))
|
current := make([]coreBuildPostProcessor, 0, len(rawPs))
|
||||||
for _, rawP := range rawPs {
|
for _, rawP := range rawPs {
|
||||||
// If we skip, ignore
|
// If we skip, ignore
|
||||||
rawP.OnlyExcept.Except = append(rawP.OnlyExcept.Except, c.except...)
|
foundExcept := false
|
||||||
if rawP.OnlyExcept.Skip(rawName) {
|
excepts := append(rawP.OnlyExcept.Except, c.except...)
|
||||||
continue
|
for _, except := range excepts {
|
||||||
|
if except == rawName || except == rawP.Name {
|
||||||
|
foundExcept = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if rawP.OnlyExcept.Skip(rawP.Name) {
|
if foundExcept {
|
||||||
break
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the post-processor
|
// Get the post-processor
|
||||||
|
|
Loading…
Reference in New Issue