Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cmd/xcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var (
paramXcodeProjectFilePath = ""
paramXcodeScheme = ""
paramXcodebuildOutputLogFilePath = ""
paramXcodebuildSDK = ""
)

func init() {
Expand All @@ -42,6 +43,9 @@ func init() {
xcodeCmd.Flags().StringVar(&paramXcodebuildOutputLogFilePath,
"xcodebuild-log", "",
"xcodebuild output log (file path). If specified it will be used instead of running xcodebuild")
xcodeCmd.Flags().StringVar(&paramXcodebuildSDK,
"xcodebuild-sdk", "",
"xcodebuild -sdk param. If a value is specified for this flag it'll be passed to xcodebuild as the value of the -sdk flag. For more info about the values please see xcodebuild's -sdk flag docs. Example value: iphoneos")
}

func printXcodeScanFinishedWithError(format string, args ...interface{}) error {
Expand Down Expand Up @@ -111,6 +115,10 @@ func scanXcodeProject(cmd *cobra.Command, args []string) error {
}
xcodeCmd.Scheme = schemeToUse

if paramXcodebuildSDK != "" {
xcodeCmd.SDK = paramXcodebuildSDK
}

fmt.Println()
fmt.Println()
log.Println("🔦 Running an Xcode Archive, to get all the required code signing settings...")
Expand Down
23 changes: 21 additions & 2 deletions xcode/xcodecmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,25 @@ import (

// CommandModel ...
type CommandModel struct {
// --- Required ---

// ProjectFilePath - might be a `xcodeproj` or `xcworkspace`
ProjectFilePath string
Scheme string
ProjectFilePath string

// --- Optional ---

// Scheme will be passed to xcodebuild as the -scheme flag's value
// Only passed to xcodebuild if not empty!
Scheme string

// CodeSignIdentity will be passed to xcodebuild as an CODE_SIGN_IDENTITY= argument.
// Only passed to xcodebuild if not empty!
CodeSignIdentity string

// SDK: if defined it'll be passed as the -sdk flag to xcodebuild.
// For more info about the possible values please see xcodebuild's docs about the -sdk flag.
// Only passed to xcodebuild if not empty!
SDK string
}

func parseSchemesFromXcodeOutput(xcodeOutput string) []string {
Expand Down Expand Up @@ -180,6 +195,10 @@ func (xccmd CommandModel) transformToXcodebuildParams(xcodebuildActionArgs ...st
baseArgs = append(baseArgs, "-scheme", xccmd.Scheme)
}

if xccmd.SDK != "" {
baseArgs = append(baseArgs, "-sdk", xccmd.SDK)
}

if xccmd.CodeSignIdentity != "" {
baseArgs = append(baseArgs, `CODE_SIGN_IDENTITY=`+xccmd.CodeSignIdentity)
}
Expand Down