-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding swift pm cache support * dep update * using absolute project path * Adding swiftpm cache input * Bitrise yml fix * Removing unused step param
- Loading branch information
Showing
72 changed files
with
12,128 additions
and
2,295 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
|
||
[[constraint]] | ||
branch = "master" | ||
name = "github.com/bitrise-io/go-steputils" | ||
|
||
[prune] | ||
go-tests = true | ||
unused-packages = true | ||
|
||
[[constraint]] | ||
branch = "master" | ||
name = "github.com/bitrise-io/go-utils" | ||
|
||
[[constraint]] | ||
branch = "master" | ||
name = "github.com/bitrise-io/go-xcode" | ||
|
||
[[constraint]] | ||
name = "github.com/bitrise-steplib/steps-xcode-archive" | ||
branch = "master" | ||
|
||
[prune] | ||
go-tests = true | ||
unused-packages = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package main | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
"io" | ||
"os" | ||
"strings" | ||
|
||
"github.com/bitrise-io/go-utils/colorstring" | ||
"github.com/bitrise-io/go-utils/command" | ||
"github.com/bitrise-io/go-utils/log" | ||
"github.com/bitrise-io/go-xcode/xcodebuild" | ||
cache "github.com/bitrise-io/go-xcode/xcodecache" | ||
"github.com/bitrise-io/go-xcode/xcpretty" | ||
) | ||
|
||
func runCommandWithRetry(cmd *xcodebuild.CommandBuilder, useXcpretty bool, swiftPackagesPath string) (string, error) { | ||
output, err := runCommand(cmd, useXcpretty) | ||
if err != nil && swiftPackagesPath != "" && strings.Contains(output, cache.SwiftPackagesStateInvalid) { | ||
log.Warnf("Build failed, swift packages cache is in an invalid state, error: %s", err) | ||
log.RWarnf("xcode-analyze", "swift-packages-cache-invalid", nil, "swift packages cache is in an invalid state") | ||
if err := os.RemoveAll(swiftPackagesPath); err != nil { | ||
return output, fmt.Errorf("failed to remove invalid Swift package caches, error: %s", err) | ||
} | ||
return runCommand(cmd, useXcpretty) | ||
} | ||
return output, err | ||
} | ||
|
||
func prepareCommand(xcodeCmd *xcodebuild.CommandBuilder, useXcpretty bool, output *bytes.Buffer) (*command.Model, *xcpretty.CommandModel) { | ||
if useXcpretty { | ||
return nil, xcpretty.New(*xcodeCmd) | ||
} | ||
|
||
buildRootCmd := xcodeCmd.Command() | ||
buildRootCmd.SetStdout(io.MultiWriter(os.Stdout, output)) | ||
buildRootCmd.SetStderr(io.MultiWriter(os.Stderr, output)) | ||
return buildRootCmd, nil | ||
} | ||
|
||
func runCommand(buildCmd *xcodebuild.CommandBuilder, useXcpretty bool) (string, error) { | ||
var output bytes.Buffer | ||
xcodebuildCmd, xcprettyCmd := prepareCommand(buildCmd, useXcpretty, &output) | ||
|
||
if xcprettyCmd != nil { | ||
logWithTimestamp(colorstring.Green, "$ %s", xcprettyCmd.PrintableCmd()) | ||
fmt.Println() | ||
return xcprettyCmd.Run() | ||
} | ||
logWithTimestamp(colorstring.Green, "$ %s", xcodebuildCmd.PrintableCommandArgs()) | ||
fmt.Println() | ||
return output.String(), xcodebuildCmd.Run() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.