respect a 'only' defined in a post-processor

pull/7262/head
Adrien Delorme 7 years ago
parent 074a74ec38
commit dd3e2c255c

@ -108,7 +108,7 @@ func TestBuildExceptFileCommaFlags(t *testing.T) {
}
args := []string{
"-except=chocolate,apple",
"-except=chocolate,vanilla",
filepath.Join(testFixture("build-only"), "template.json"),
}
@ -118,12 +118,12 @@ func TestBuildExceptFileCommaFlags(t *testing.T) {
fatalCommand(t, c.Meta)
}
for _, f := range []string{"chocolate.txt", "apple.txt"} {
for _, f := range []string{"chocolate.txt", "vanilla.txt", "tomato.txt"} {
if fileExists(f) {
t.Errorf("Expected NOT to find %s", f)
}
}
for _, f := range []string{"vanilla.txt", "cherry.txt", "pear.txt", "peach.txt"} {
for _, f := range []string{"apple.txt", "cherry.txt", "pear.txt", "peach.txt"} {
if !fileExists(f) {
t.Errorf("Expected to find %s", f)
}

@ -180,11 +180,13 @@ func (c *Core) Build(n string) (Build, error) {
for _, rawPs := range c.Template.PostProcessors {
current := make([]coreBuildPostProcessor, 0, len(rawPs))
for _, rawP := range rawPs {
// If we skip, ignore
if rawP.Skip(rawName) {
continue
}
// -except skips post-processor & build
foundExcept := false
excepts := append(rawP.OnlyExcept.Except, c.except...)
for _, except := range excepts {
if except == rawName || except == rawP.Name {
for _, except := range c.except {
if except == rawP.Name {
foundExcept = true
}
}

Loading…
Cancel
Save