break a chain of post-processors when one is skipped & make `-only`
"blind" to post-processors * to avoid trouble * other arrays of post processors might still be there ! * add docs * update tests
This commit is contained in:
parent
75af18661f
commit
58245f2557
|
@ -27,12 +27,13 @@ func TestBuildOnlyFileCommaFlags(t *testing.T) {
|
|||
fatalCommand(t, c.Meta)
|
||||
}
|
||||
|
||||
if !fileExists("chocolate.txt") {
|
||||
t.Error("Expected to find chocolate.txt")
|
||||
}
|
||||
if !fileExists("vanilla.txt") {
|
||||
t.Error("Expected to find vanilla.txt")
|
||||
for _, f := range []string{"chocolate.txt", "vanilla.txt",
|
||||
"apple.txt", "peach.txt", "pear.txt"} {
|
||||
if !fileExists(f) {
|
||||
t.Errorf("Expected to find %s", f)
|
||||
}
|
||||
}
|
||||
|
||||
if fileExists("cherry.txt") {
|
||||
t.Error("Expected NOT to find cherry.txt")
|
||||
}
|
||||
|
@ -57,14 +58,10 @@ func TestBuildStdin(t *testing.T) {
|
|||
fatalCommand(t, c.Meta)
|
||||
}
|
||||
|
||||
if !fileExists("chocolate.txt") {
|
||||
t.Error("Expected to find chocolate.txt")
|
||||
}
|
||||
if !fileExists("vanilla.txt") {
|
||||
t.Error("Expected to find vanilla.txt")
|
||||
}
|
||||
if !fileExists("cherry.txt") {
|
||||
t.Error("Expected to find cherry.txt")
|
||||
for _, f := range []string{"vanilla.txt", "cherry.txt", "chocolate.txt"} {
|
||||
if !fileExists(f) {
|
||||
t.Errorf("Expected to find %s", f)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,7 +73,9 @@ func TestBuildOnlyFileMultipleFlags(t *testing.T) {
|
|||
args := []string{
|
||||
"-only=chocolate",
|
||||
"-only=cherry",
|
||||
"-only=apple",
|
||||
"-only=apple", // ignored
|
||||
"-only=peach", // ignored
|
||||
"-only=pear", // ignored
|
||||
filepath.Join(testFixture("build-only"), "template.json"),
|
||||
}
|
||||
|
||||
|
@ -86,17 +85,16 @@ func TestBuildOnlyFileMultipleFlags(t *testing.T) {
|
|||
fatalCommand(t, c.Meta)
|
||||
}
|
||||
|
||||
if !fileExists("chocolate.txt") {
|
||||
t.Error("Expected to find chocolate.txt")
|
||||
for _, f := range []string{"vanilla.txt"} {
|
||||
if fileExists(f) {
|
||||
t.Errorf("Expected NOT to find %s", f)
|
||||
}
|
||||
}
|
||||
if fileExists("vanilla.txt") {
|
||||
t.Error("Expected NOT to find vanilla.txt")
|
||||
}
|
||||
if !fileExists("cherry.txt") {
|
||||
t.Error("Expected to find cherry.txt")
|
||||
}
|
||||
if !fileExists("apple.txt") {
|
||||
t.Error("Expected to find apple.txt")
|
||||
for _, f := range []string{"chocolate.txt", "cherry.txt",
|
||||
"apple.txt", "peach.txt", "pear.txt"} {
|
||||
if !fileExists(f) {
|
||||
t.Errorf("Expected to find %s", f)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,12 +114,12 @@ func TestBuildExceptFileCommaFlags(t *testing.T) {
|
|||
fatalCommand(t, c.Meta)
|
||||
}
|
||||
|
||||
for _, f := range []string{"chocolate.txt", "apple.txt"} {
|
||||
for _, f := range []string{"chocolate.txt", "apple.txt", "peach.txt"} {
|
||||
if fileExists(f) {
|
||||
t.Errorf("Expected NOT to find %s", f)
|
||||
}
|
||||
}
|
||||
for _, f := range []string{"vanilla.txt", "cherry.txt", "peach.txt"} {
|
||||
for _, f := range []string{"vanilla.txt", "cherry.txt", "pear.txt"} {
|
||||
if !fileExists(f) {
|
||||
t.Errorf("Expected to find %s", f)
|
||||
}
|
||||
|
@ -170,4 +168,5 @@ func cleanup() {
|
|||
os.RemoveAll("cherry.txt")
|
||||
os.RemoveAll("apple.txt")
|
||||
os.RemoveAll("peach.txt")
|
||||
os.RemoveAll("pear.txt")
|
||||
}
|
||||
|
|
|
@ -1,34 +1,43 @@
|
|||
{
|
||||
"builders": [
|
||||
{
|
||||
"name":"chocolate",
|
||||
"type":"file",
|
||||
"content":"chocolate",
|
||||
"target":"chocolate.txt"
|
||||
"name": "chocolate",
|
||||
"type": "file",
|
||||
"content": "chocolate",
|
||||
"target": "chocolate.txt"
|
||||
},
|
||||
{
|
||||
"name":"vanilla",
|
||||
"type":"file",
|
||||
"content":"vanilla",
|
||||
"target":"vanilla.txt"
|
||||
"name": "vanilla",
|
||||
"type": "file",
|
||||
"content": "vanilla",
|
||||
"target": "vanilla.txt"
|
||||
},
|
||||
{
|
||||
"name":"cherry",
|
||||
"type":"file",
|
||||
"content":"cherry",
|
||||
"target":"cherry.txt"
|
||||
"name": "cherry",
|
||||
"type": "file",
|
||||
"content": "cherry",
|
||||
"target": "cherry.txt"
|
||||
}
|
||||
],
|
||||
"post-processors": [
|
||||
{
|
||||
"name": "apple",
|
||||
"type": "shell-local",
|
||||
"inline": ["touch apple.txt"]
|
||||
},
|
||||
{
|
||||
"name": "peach",
|
||||
"type": "shell-local",
|
||||
"inline": ["touch peach.txt"]
|
||||
}
|
||||
[
|
||||
{
|
||||
"name": "apple",
|
||||
"type": "shell-local",
|
||||
"inline": [ "touch apple.txt" ]
|
||||
},
|
||||
{
|
||||
"name": "peach",
|
||||
"type": "shell-local",
|
||||
"inline": [ "touch peach.txt" ]
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"name": "pear",
|
||||
"type": "shell-local",
|
||||
"inline": [ "touch pear.txt" ]
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
|
@ -182,12 +182,11 @@ func (c *Core) Build(n string) (Build, error) {
|
|||
for _, rawP := range rawPs {
|
||||
// If we skip, ignore
|
||||
rawP.OnlyExcept.Except = append(rawP.OnlyExcept.Except, c.except...)
|
||||
rawP.OnlyExcept.Only = append(rawP.OnlyExcept.Only, c.only...)
|
||||
if rawP.OnlyExcept.Skip(rawName) {
|
||||
continue
|
||||
}
|
||||
if rawP.OnlyExcept.Skip(rawP.Name) {
|
||||
continue
|
||||
break
|
||||
}
|
||||
|
||||
// Get the post-processor
|
||||
|
|
|
@ -26,10 +26,12 @@ artifacts that are created will be outputted at the end of the build.
|
|||
will stop between each step, waiting for keyboard input before continuing.
|
||||
This will allow the user to inspect state and so on.
|
||||
|
||||
- `-except=foo,bar,baz` - Run all the builds and post-processors except
|
||||
those with the given comma-separated names. Build and post-processor names
|
||||
by default are their type, unless a specific `name` attribute is specified
|
||||
within the configuration.
|
||||
- `-except=foo,bar,baz` - Run all the builds and post-processors except those
|
||||
with the given comma-separated names. Build and post-processor names by
|
||||
default are their type, unless a specific `name` attribute is specified
|
||||
within the configuration. Any post-processor following a skipped
|
||||
post-processor will not run. Because post-processors can be nested in
|
||||
arrays a differ post-processor chain can still run.
|
||||
|
||||
- `-force` - Forces a builder to run when artifacts from a previous build
|
||||
prevent a build from running. The exact behavior of a forced build is left
|
||||
|
@ -44,10 +46,10 @@ artifacts that are created will be outputted at the end of the build.
|
|||
presents a prompt and waits for you to decide to clean up, abort, or retry
|
||||
the failed step.
|
||||
|
||||
- `-only=foo,bar,baz` - Only run the builds and post-processors with the
|
||||
given comma-separated names. Build and post-processor names by default are
|
||||
their type, unless a specific `name` attribute is specified within the
|
||||
configuration.
|
||||
- `-only=foo,bar,baz` - Only run the builds with the given comma-separated
|
||||
names. Build names by default are their type, unless a specific `name`
|
||||
attribute is specified within the configuration. `-only` does not apply to
|
||||
post-processors.
|
||||
|
||||
- `-parallel=false` - Disable parallelization of multiple builders (on by
|
||||
default).
|
||||
|
|
|
@ -77,10 +77,11 @@ effectively the same:
|
|||
}
|
||||
```
|
||||
|
||||
The values within `only` or `except` can be *build or post-processor names*,
|
||||
not builder types. If you recall, build and post-processor names by default are
|
||||
just their builder type, but if you specify a custom `name` parameter, then you
|
||||
should use that as the value instead of the type.
|
||||
The values within `only` or `except` are *build names*, not builder types. If
|
||||
you recall, build names by default are just their builder type, but if you
|
||||
specify a custom `name` parameter, then you should use that as the value
|
||||
instead of the type.
|
||||
Values within `except` could also be a *post-processor* name.
|
||||
|
||||
## Build-Specific Overrides
|
||||
|
||||
|
|
Loading…
Reference in New Issue