Skip to content

Commit

Permalink
removed -sdk iphonesimulator flag
Browse files Browse the repository at this point in the history
  • Loading branch information
godrei committed Sep 30, 2015
1 parent b30c3b6 commit 8150283
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 70 deletions.
30 changes: 0 additions & 30 deletions step.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,27 +136,6 @@ func printableCommandArgs(fullCommandArgs []string) string {
return strings.Join(cmdArgsDecorated, " ")
}

func findXcodeMajorVersion(str string) (int, error) {
idx := strings.Index(str, xcodeVersionPrefix)
if idx < 0 {
return -1, fmt.Errorf("No prefix (%s) found in xcodebuild -version output (%s)", xcodeVersionPrefix, str)
}
if idx+len(xcodeVersionPrefix)+1 >= len(str) {
return -1, fmt.Errorf("No version number found in xcodebuild -version output (%s)", str)
}
majorVersionStr := str[idx+len(xcodeVersionPrefix) : idx+len(xcodeVersionPrefix)+1]
return strconv.Atoi(majorVersionStr)
}

func majorXcodeVersion() (int, error) {
xcodeVersionStr, err := getXcodeVersion()
if err != nil {
return -1, fmt.Errorf("xcodebuild -version failed, err: %s", err)
}

return findXcodeMajorVersion(xcodeVersionStr)
}

func runTest(action, projectPath, scheme string, cleanBuild bool, deviceDestination string, isRetryOnTimeout, isFullOutputMode bool) (string, error) {
args := []string{action, projectPath, "-scheme", scheme}
if cleanBuild {
Expand All @@ -169,15 +148,6 @@ func runTest(action, projectPath, scheme string, cleanBuild bool, deviceDestinat
// Related Radar link: https://openradar.appspot.com/22413115
// Demonstration project: https://github.com/bitrise-io/simulator-launch-timeout-includes-build-time
args = append(args, "build", "test", "-destination", deviceDestination)

majorXcodeVersion, err := majorXcodeVersion()
if err != nil {
return "", fmt.Errorf("Faild to get major xcode version, err: %s", err)
}
if majorXcodeVersion < 7 {
args = append(args, "-sdk", "iphonesimulator")
}

cmd := exec.Command("xcodebuild", args...)

var outBuffer bytes.Buffer
Expand Down
40 changes: 0 additions & 40 deletions step_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,6 @@ import (
//
// --- TESTS

func TestFindXcodeMajorVersion(t *testing.T) {
// Should find
versionStr := `
Xcode 7.0
Build version 7A220`

version, err := findXcodeMajorVersion(versionStr)
if err != nil {
t.Fatalf("Failed to findMajorVersion: %s", err)
}
if version != 7 {
t.Fatalf("Expected version (7), actual (%d)", version)
}

// Should find
versionStr = `
Xcode 6.1
Build version 7A220`

version, err = findXcodeMajorVersion(versionStr)
if err != nil {
t.Fatalf("Failed to findMajorVersion: %s", err)
}
if version != 6 {
t.Fatalf("Expected version (6), actual (%d)", version)
}

// Should not find
versionStr = `
Build version 7A220`

version, err = findXcodeMajorVersion(versionStr)
if err == nil {
t.Fatalf("Should failed to findMajorVersion: %s", err)
}
if version != -1 {
t.Fatalf("Expected version (-1), actual (%d)", version)
}
}

func Test_isStringFoundInOutput(t *testing.T) {
// Should NOT find
searchPattern := "something"
Expand Down

0 comments on commit 8150283

Please sign in to comment.