Skip to content

Commit

Permalink
Added check for empty artifact list (#24)
Browse files Browse the repository at this point in the history
* Added check for empty artifact list
  • Loading branch information
Szabados Áron authored Jul 16, 2020
1 parent 9d4da7c commit 424490a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions buildspec.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ func (spec buildSpecification) artifactPaths(outputPathPatterns []string, isDir
}

func (spec buildSpecification) exportIOSApp(artifacts []string, deployDir string) error {
if len(artifacts) < 1 {
return fmt.Errorf("- No artifacts found")
}

artifact := artifacts[len(artifacts)-1]
fileName := filepath.Base(artifact)

Expand Down
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,16 @@ build:
} else {
artifacts, err = spec.artifactPaths(spec.outputPathPatterns, true)
}

if err != nil {
failf("failed to find artifacts, error: %s", err)
}

if len(artifacts) < 1 {
failf(`Artifact path pattern (%s) did not match any artifacts on the path (%s).
Check that 'iOS/Android Output Pattern' and 'Project Location' is correct.`, spec.outputPathPatterns, spec.projectLocation)
}

if err := spec.exportArtifacts(artifacts); err != nil {
failf("Failed to export %s artifacts, error: %s", spec.displayName, err)
}
Expand Down

0 comments on commit 424490a

Please sign in to comment.