Skip to content

Commit 9f4ef18

Browse files
authored
Handle errors with project path prefix (#311)
1 parent b8816b9 commit 9f4ef18

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

step/errors.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ func findXcodebuildErrors(out string) []string {
120120
}
121121

122122
switch {
123-
case strings.HasPrefix(line, "error: "):
124-
errorLines = append(errorLines, line)
125123
case strings.HasPrefix(line, "xcodebuild: error: "):
126124
xcodebuildError = line
127125
isXcodebuildError = true
126+
case strings.HasPrefix(line, "error: ") || strings.Contains(line, " error: "):
127+
errorLines = append(errorLines, line)
128128
case strings.HasPrefix(line, "Error "):
129129
if e := NewNSError(line); e != nil {
130130
nserrors = append(nserrors, *e)

step/errors_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,31 @@ func Test_findXcodebuildErrors(t *testing.T) {
4848
out: `error: exportArchive: "code-sign-test.app" requires a provisioning profile.`,
4949
want: []string{`error: exportArchive: "code-sign-test.app" requires a provisioning profile.`},
5050
},
51+
{
52+
name: "Regular error with project path prefix",
53+
out: `./steps-xcode-archive/_tmp/code-sign-test.xcodeproj: error: No profile for team 'ASDF8V3WYL' matching 'BitriseBot-Wildcard' found: Xcode couldn't find any provisioning profiles matching 'ASDF8V3WYL/BitriseBot-Wildcard'. Install the profile (by dragging and dropping it onto Xcode's dock item) or select a different one in the Signing & Capabilities tab of the target editor. (in target 'code-sign-test' from project 'code-sign-test')`,
54+
want: []string{`./steps-xcode-archive/_tmp/code-sign-test.xcodeproj: error: No profile for team 'ASDF8V3WYL' matching 'BitriseBot-Wildcard' found: Xcode couldn't find any provisioning profiles matching 'ASDF8V3WYL/BitriseBot-Wildcard'. Install the profile (by dragging and dropping it onto Xcode's dock item) or select a different one in the Signing & Capabilities tab of the target editor. (in target 'code-sign-test' from project 'code-sign-test')`},
55+
},
5156
{
5257
name: "xcodebuild error",
5358
out: `xcodebuild: error: Failed to build project code-sign-test with scheme code-sign-test.
5459
Reason: This scheme builds an embedded Apple Watch app. watchOS 9.0 must be installed in order to archive the scheme
5560
Recovery suggestion: watchOS 9.0 is not installed. To use with Xcode, first download and install the platform`,
5661
want: []string{`xcodebuild: error: Failed to build project code-sign-test with scheme code-sign-test.
5762
Reason: This scheme builds an embedded Apple Watch app. watchOS 9.0 must be installed in order to archive the scheme
63+
Recovery suggestion: watchOS 9.0 is not installed. To use with Xcode, first download and install the platform`},
64+
},
65+
{
66+
name: "xcodebuild error and regular error with project path prefix",
67+
out: `./steps-xcode-archive/_tmp/code-sign-test.xcodeproj: error: No profile for team 'ASDF8V3WYL' matching 'BitriseBot-Wildcard' found: Xcode couldn't find any provisioning profiles matching 'ASDF8V3WYL/BitriseBot-Wildcard'. Install the profile (by dragging and dropping it onto Xcode's dock item) or select a different one in the Signing & Capabilities tab of the target editor. (in target 'code-sign-test' from project 'code-sign-test')
68+
69+
xcodebuild: error: Failed to build project code-sign-test with scheme code-sign-test.
70+
Reason: This scheme builds an embedded Apple Watch app. watchOS 9.0 must be installed in order to archive the scheme
71+
Recovery suggestion: watchOS 9.0 is not installed. To use with Xcode, first download and install the platform`,
72+
want: []string{
73+
`./steps-xcode-archive/_tmp/code-sign-test.xcodeproj: error: No profile for team 'ASDF8V3WYL' matching 'BitriseBot-Wildcard' found: Xcode couldn't find any provisioning profiles matching 'ASDF8V3WYL/BitriseBot-Wildcard'. Install the profile (by dragging and dropping it onto Xcode's dock item) or select a different one in the Signing & Capabilities tab of the target editor. (in target 'code-sign-test' from project 'code-sign-test')`,
74+
`xcodebuild: error: Failed to build project code-sign-test with scheme code-sign-test.
75+
Reason: This scheme builds an embedded Apple Watch app. watchOS 9.0 must be installed in order to archive the scheme
5876
Recovery suggestion: watchOS 9.0 is not installed. To use with Xcode, first download and install the platform`},
5977
},
6078
{

0 commit comments

Comments
 (0)