-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support custom xcconfig file path (#297)
Allow passing a file path to an existing xcconfig file, instead of providing the file contents directly. * `xcconfig_content` can now be a path to a xcconfig file, or left empty. This allows using a custom xcconfig file that already exists in the repository.
- Loading branch information
Showing
11 changed files
with
226 additions
and
62 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package main | ||
|
||
import "github.com/bitrise-io/go-utils/sliceutil" | ||
|
||
func generateAdditionalOptions(platform string, customOptions []string) []string { | ||
destination := "generic/platform=" + platform | ||
destinationOptions := []string{"-destination", destination} | ||
|
||
var options []string | ||
if len(customOptions) != 0 { | ||
if !sliceutil.IsStringInSlice("-destination", customOptions) { | ||
options = append(options, destinationOptions...) | ||
} | ||
|
||
options = append(options, customOptions...) | ||
} else { | ||
options = append(options, destinationOptions...) | ||
} | ||
|
||
return options | ||
} |
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,41 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func Test_generateAdditionalOptions(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
platform string | ||
customOptions []string | ||
want []string | ||
}{ | ||
{ | ||
name: "no custom options", | ||
platform: "iOS", | ||
want: []string{"-destination", "generic/platform=iOS"}, | ||
}, | ||
{ | ||
name: "custom opts", | ||
platform: "iOS", | ||
customOptions: []string{"-scmProvider", "system"}, | ||
want: []string{"-destination", "generic/platform=iOS", "-scmProvider", "system"}, | ||
}, | ||
{ | ||
name: "custom opts with destination", | ||
platform: "iOS", | ||
customOptions: []string{"-scmProvider", "system", "-destination", "generic/platform=iOS"}, | ||
want: []string{"-scmProvider", "system", "-destination", "generic/platform=iOS"}, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
got := generateAdditionalOptions(tt.platform, tt.customOptions) | ||
|
||
require.Equal(t, tt.want, got) | ||
}) | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
### Examples | ||
|
||
Build a development IPA: | ||
```yaml | ||
- xcode-archive: | ||
inputs: | ||
- project_path: ./ios-sample/ios-sample.xcodeproj | ||
- scheme: ios-sample | ||
- distribution_method: development | ||
``` | ||
Build a development IPA with custom xcconfig content: | ||
```yaml | ||
- xcode-archive: | ||
inputs: | ||
- project_path: ./ios-sample/ios-sample.xcodeproj | ||
- scheme: ios-sample | ||
- distribution_method: development | ||
- xcconfig_content: | | ||
CODE_SIGN_IDENTITY = Apple Development | ||
``` | ||
Build a development IPA with custom xcconfig file path: | ||
```yaml | ||
- xcode-archive: | ||
inputs: | ||
- project_path: ./ios-sample/ios-sample.xcodeproj | ||
- scheme: ios-sample | ||
- distribution_method: development | ||
- xcconfig_content: ./ios-sample/ios-sample/Configurations/Dev.xcconfig | ||
``` |
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.