Skip to content

Commit

Permalink
Remove unnecessary Xcode version checks (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
ofalvai authored Jan 28, 2022
1 parent 8d54967 commit 4045311
Showing 1 changed file with 5 additions and 24 deletions.
29 changes: 5 additions & 24 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,14 @@ import (
"github.com/bitrise-io/go-utils/pathutil"
"github.com/bitrise-io/go-utils/sliceutil"
"github.com/bitrise-io/go-utils/stringutil"
"github.com/bitrise-io/go-xcode/utility"
"github.com/bitrise-io/go-xcode/xcodebuild"
cache "github.com/bitrise-io/go-xcode/xcodecache"
"github.com/bitrise-io/go-xcode/xcpretty"
"github.com/bitrise-steplib/steps-xcode-archive/utils"
"github.com/kballard/go-shellquote"
)

const (
bitriseXcodeRawResultTextEnvKey = "BITRISE_XCODE_RAW_RESULT_TEXT_PATH"
minSupportedXcodeMajorVersion = 6
)
const bitriseXcodeRawResultTextEnvKey = "BITRISE_XCODE_RAW_RESULT_TEXT_PATH"

// Config ...
type Config struct {
Expand Down Expand Up @@ -65,18 +61,6 @@ func main() {
fail("Failed to expand project path (%s), error: %s", conf.ProjectPath, err)
}

// Detect Xcode major version
xcodebuildVersion, err := utility.GetXcodeVersion()
if err != nil {
fail("Failed to determine xcode version, error: %s", err)
}
log.Printf("- xcodebuildVersion: %s (%s)", xcodebuildVersion.Version, xcodebuildVersion.BuildVersion)

xcodeMajorVersion := xcodebuildVersion.MajorVersion
if xcodeMajorVersion < minSupportedXcodeMajorVersion {
fail("Invalid xcode major version (%d), should not be less then min supported: %d", xcodeMajorVersion, minSupportedXcodeMajorVersion)
}

// Detect xcpretty version
outputTool := conf.OutputTool
if outputTool == "xcpretty" {
Expand Down Expand Up @@ -185,12 +169,9 @@ func main() {
analyzeCmd.SetResultBundlePath(xcresultPath)
}

var swiftPackagesPath string
if xcodeMajorVersion >= 11 {
var err error
if swiftPackagesPath, err = cache.SwiftPackagesPath(absProjectPath); err != nil {
fail("Failed to get Swift Packages path, error: %s", err)
}
swiftPackagesPath, err := cache.SwiftPackagesPath(absProjectPath)
if err != nil {
fail("Failed to get Swift Packages path, error: %s", err)
}

rawXcodebuildOut, xcErr := runCommandWithRetry(analyzeCmd, outputTool == "xcpretty", swiftPackagesPath)
Expand Down Expand Up @@ -224,7 +205,7 @@ func main() {
}

// Cache swift PM
if xcodeMajorVersion >= 11 && conf.CacheLevel == "swift_packages" {
if conf.CacheLevel == "swift_packages" {
if err := cache.CollectSwiftPackages(absProjectPath); err != nil {
log.Warnf("Failed to mark swift packages for caching, error: %s", err)
}
Expand Down

0 comments on commit 4045311

Please sign in to comment.