Skip to content

Commit

Permalink
Step 1818 xcconfig (#37)
Browse files Browse the repository at this point in the history
* Update step.yml

* Add fallback_provisioning_profile_url_list input

* Update e2e tests

* Restore e2e test secrets

* Add fallback profile test

* Update bitrise.yml

* Update bitrise.yml

* Update bitrise.yml

* Update go-xcode/v2 to pull latest xcconfig package

* Update step.yml

* Update step.yml

* Remove fallback_provisioning_profile_url_list input and related feature

* Remove test_api_key_signing_manual_fallback_on_error e2e test case

* Update step.yml

* Update e2e test bitrise.yml and regenerate README

* Update step.go
  • Loading branch information
godrei authored Jun 1, 2022
1 parent 4820d57 commit 1906fb7
Show file tree
Hide file tree
Showing 64 changed files with 1,467 additions and 548 deletions.
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ To configure the Step:
4. **Device destination specifier**: Destination specifier describes the device to use as a destination. The input value sets xcodebuild's `-destination` option.

Under **xcodebuild configuration**
5. **Build settings (xcconfig)**: Build settings to override the project's build settings. The build settings must be separated by newline character (`\n`). For example:
```
COMPILER_INDEX_STORE_ENABLE = NO
ONLY_ACTIVE_ARCH[config=Debug][sdk=*][arch=*] = YES
```
The input value sets xcodebuild's `-xcconfig` option.
5. **Build settings (xcconfig)**: Build settings to override the project's build settings. Can be the contents, file path or empty.
6. **Additional options for the xcodebuild command**: Additional options to be added to the executed xcodebuild command.

Under **Xcode build log formatting**:
Expand Down Expand Up @@ -71,8 +66,8 @@ You can also run this step directly with [Bitrise CLI](https://github.com/bitris
| `scheme` | Xcode Scheme name. The input value sets xcodebuild's `-scheme` option. | required | `$BITRISE_SCHEME` |
| `configuration` | Xcode Build Configuration. If not specified, the default Build Configuration will be used. The input value sets xcodebuild's `-configuration` option. | required | `Debug` |
| `destination` | Destination specifier describes the device to use as a destination. The input value sets xcodebuild's `-destination` option. | required | `generic/platform=iOS` |
| `xcconfig_content` | Build settings to override the project's build settings. Build settings must be separated by newline character (`\n`). Example: ``` COMPILER_INDEX_STORE_ENABLE = NO ONLY_ACTIVE_ARCH[config=Debug][sdk=*][arch=*] = YES ``` The input value sets xcodebuild's `-xcconfig` option. | | `COMPILER_INDEX_STORE_ENABLE = NO` |
| `xcodebuild_options` | Additional options to be added to the executed xcodebuild command. | | |
| `xcconfig_content` | Build settings to override the project's build settings, using xcodebuild's `-xcconfig` option. You can't define `-xcconfig` option in `Additional options for the xcodebuild command` if this input is set. If empty, no setting is changed. When set it can be either: 1. Existing `.xcconfig` file path. Example: `./ios-sample/ios-sample/Configurations/Dev.xcconfig` 2. The contents of a newly created temporary `.xcconfig` file. (This is the default.) Build settings must be separated by newline character (`\n`). Example: ``` COMPILER_INDEX_STORE_ENABLE = NO ONLY_ACTIVE_ARCH[config=Debug][sdk=*][arch=*] = YES ``` | | `COMPILER_INDEX_STORE_ENABLE = NO` |
| `xcodebuild_options` | Additional options to be added to the executed xcodebuild command. Prefer using `Build settings (xcconfig)` input for specifying `-xcconfig` option. You can't use both. | | |
| `log_formatter` | Defines how xcodebuild command's log is formatted. Available options: - `xcpretty`: The xcodebuild command’s output will be prettified by xcpretty. - `xcodebuild`: Only the last 20 lines of raw xcodebuild output will be visible in the build log. The raw xcodebuild log will be exported in both cases. | required | `xcpretty` |
| `automatic_code_signing` | This input determines which Bitrise Apple service connection should be used for automatic code signing. Available values: - `off`: Do not do any auto code signing. - `api-key`: [Bitrise Apple Service connection with API Key](https://devcenter.bitrise.io/getting-started/connecting-to-services/setting-up-connection-to-an-apple-service-with-api-key/). - `apple-id`: [Bitrise Apple Service connection with Apple ID](https://devcenter.bitrise.io/getting-started/connecting-to-services/connecting-to-an-apple-service-with-apple-id/). | required | `off` |
| `register_test_devices` | If this input is set, the Step will register the known test devices on Bitrise from team members with the Apple Developer Portal. Note that setting this to yes may cause devices to be registered against your limited quantity of test devices in the Apple Developer Portal, which can only be removed once annually during your renewal window. | required | `no` |
Expand Down
20 changes: 12 additions & 8 deletions codesign.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/bitrise-io/go-xcode/v2/autocodesign/codesignasset"
"github.com/bitrise-io/go-xcode/v2/autocodesign/devportalclient"
"github.com/bitrise-io/go-xcode/v2/autocodesign/localcodesignasset"
"github.com/bitrise-io/go-xcode/v2/autocodesign/profiledownloader"
"github.com/bitrise-io/go-xcode/v2/autocodesign/projectmanager"
"github.com/bitrise-io/go-xcode/v2/codesign"
)
Expand Down Expand Up @@ -46,12 +47,13 @@ func createCodesignManager(managerOpts CodesignManagerOpts, xcodeMajorVersion in
}

codesignInputs := codesign.Input{
AuthType: authType,
DistributionMethod: string(autocodesign.Development),
CertificateURLList: managerOpts.CertificateURLList,
CertificatePassphraseList: managerOpts.CertificatePassphraseList,
KeychainPath: managerOpts.KeychainPath,
KeychainPassword: managerOpts.KeychainPassword,
AuthType: authType,
DistributionMethod: string(autocodesign.Development),
CertificateURLList: managerOpts.CertificateURLList,
CertificatePassphraseList: managerOpts.CertificatePassphraseList,
KeychainPath: managerOpts.KeychainPath,
KeychainPassword: managerOpts.KeychainPassword,
FallbackProvisioningProfiles: "",
}

codesignConfig, err := codesign.ParseConfig(codesignInputs, cmdFactory)
Expand Down Expand Up @@ -90,15 +92,17 @@ func createCodesignManager(managerOpts CodesignManagerOpts, xcodeMajorVersion in
ConfigurationName: managerOpts.Configuration,
})
if err != nil {
return codesign.Manager{}, fmt.Errorf("failed to open project: %w", err)
return codesign.Manager{}, err
}

client := retry.NewHTTPClient().StandardClient()
return codesign.NewManagerWithProject(
opts,
appleAuthCredentials,
serviceConnection,
devPortalClientFactory,
certdownloader.NewDownloader(codesignConfig.CertificatesAndPassphrases, retry.NewHTTPClient().StandardClient()),
certdownloader.NewDownloader(codesignConfig.CertificatesAndPassphrases, client),
profiledownloader.New(codesignConfig.FallbackProvisioningProfiles, client),
codesignasset.NewWriter(codesignConfig.Keychain),
localcodesignasset.NewManager(localcodesignasset.NewProvisioningProfileProvider(), localcodesignasset.NewProvisioningProfileConverter()),
project,
Expand Down
53 changes: 29 additions & 24 deletions e2e/bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ workflows:
- BITRISE_SCHEME: sample swiftpm
- CODE_SIGNING_METHOD: apple-id
- TEAM_ID: 72SA8V3WYL
- CERTIFICATE_URL_LIST: $BITFALL_APPLE_APPLE_CERTIFICATE_URL_LIST
- CERTIFICATE_PASSPHRASE_LIST: $BITFALL_APPLE_APPLE_CERTIFICATE_PASSPHRASE_LIST
after_run:
- _run

Expand All @@ -52,6 +54,8 @@ workflows:
- BITRISE_SCHEME: sample-apps-fastlane-test
- BITRISE_CONFIGURATION: Debug
- CODE_SIGNING_METHOD: api-key
- CERTIFICATE_URL_LIST: $BITFALL_APPLE_APPLE_CERTIFICATE_URL_LIST
- CERTIFICATE_PASSPHRASE_LIST: $BITFALL_APPLE_APPLE_CERTIFICATE_PASSPHRASE_LIST
after_run:
- _run
- _run_device_tests
Expand All @@ -63,6 +67,8 @@ workflows:
- BITRISE_PROJECT_PATH: ./ios-simple-objc/ios-simple-objc.xcodeproj
- BITRISE_SCHEME: renamed_scheme
- CODE_SIGNING_METHOD: "off"
- CERTIFICATE_URL_LIST: $BITFALL_APPLE_APPLE_CERTIFICATE_URL_LIST
- CERTIFICATE_PASSPHRASE_LIST: $BITFALL_APPLE_APPLE_CERTIFICATE_PASSPHRASE_LIST
steps:
- certificate-and-profile-installer: { }
after_run:
Expand All @@ -77,6 +83,8 @@ workflows:
- BITRISE_CONFIGURATION: Debug
- CODE_SIGNING_METHOD: apple-id
- TEAM_ID: 72SA8V3WYL
- CERTIFICATE_URL_LIST: $BITFALL_APPLE_APPLE_CERTIFICATE_URL_LIST
- CERTIFICATE_PASSPHRASE_LIST: $BITFALL_APPLE_APPLE_CERTIFICATE_PASSPHRASE_LIST
after_run:
- _run

Expand All @@ -87,6 +95,8 @@ workflows:
- BITRISE_PROJECT_PATH: ./ios-simple-objc/ios-simple-objc.xcodeproj
- BITRISE_SCHEME: renamed_scheme
- CODE_SIGNING_METHOD: api-key
- CERTIFICATE_URL_LIST: $BITFALL_APPLE_APPLE_CERTIFICATE_URL_LIST
- CERTIFICATE_PASSPHRASE_LIST: $BITFALL_APPLE_APPLE_CERTIFICATE_PASSPHRASE_LIST
after_run:
- _run

Expand All @@ -97,6 +107,8 @@ workflows:
- BITRISE_PROJECT_PATH: ./ios-simple-objc/ios-simple-objc.xcodeproj
- BITRISE_SCHEME: Scheme with spaces
- CODE_SIGNING_METHOD: api-key
- CERTIFICATE_URL_LIST: $BITFALL_APPLE_APPLE_CERTIFICATE_URL_LIST
- CERTIFICATE_PASSPHRASE_LIST: $BITFALL_APPLE_APPLE_CERTIFICATE_PASSPHRASE_LIST
after_run:
- _run

Expand All @@ -108,6 +120,8 @@ workflows:
- BITRISE_SCHEME: renamed_scheme
- XCODE_BUILD_OPTIONS: -derivedDataPath $BITRISE_SOURCE_DIR/_tmp/ddata -destination generic/platform=iOS
- CODE_SIGNING_METHOD: api-key
- CERTIFICATE_URL_LIST: $BITFALL_APPLE_APPLE_CERTIFICATE_URL_LIST
- CERTIFICATE_PASSPHRASE_LIST: $BITFALL_APPLE_APPLE_CERTIFICATE_PASSPHRASE_LIST
after_run:
- _run

Expand All @@ -119,32 +133,23 @@ workflows:
- BITRISE_SCHEME: Scheme with spaces
- XCODE_BUILD_OPTIONS: -derivedDataPath $BITRISE_SOURCE_DIR/_tmp/ddata -destination generic/platform=iOS
- CODE_SIGNING_METHOD: api-key
- CERTIFICATE_URL_LIST: $BITFALL_APPLE_APPLE_CERTIFICATE_URL_LIST
- CERTIFICATE_PASSPHRASE_LIST: $BITFALL_APPLE_APPLE_CERTIFICATE_PASSPHRASE_LIST
after_run:
- _run

test_single_certificate_no_passphrase:
steps:
- script:
inputs:
- content: |-
#!/bin/bash
set -ex
rm -rf "./_tmp"
mkdir -p "./_tmp"
- git::https://github.com/bitrise-steplib/bitrise-step-simple-git-clone.git@master:
inputs:
- repository_url: https://github.com/bitrise-io/sample-apps-ios-simple-objc.git
- branch: bundle_id
- clone_into_dir: ./_tmp
- path::./:
title: Step Test
inputs:
- project_path: ./_tmp/ios-simple-objc/ios-simple-objc.xcodeproj
- scheme: ios-simple-objc
- automatic_code_signing: api-key
- certificate_url_list: $BITFALL_APPLE_IOS_CERTIFICATE_NOPASSPHRASE_URL
- passphrase_list: ""
- apple_team_id: 72SA8V3WYL
envs:
- SAMPLE_APP_URL: https://github.com/bitrise-io/sample-apps-ios-simple-objc.git
- SAMPLE_APP_BRANCH: bundle_id
- BITRISE_PROJECT_PATH: ./ios-simple-objc/ios-simple-objc.xcodeproj
- BITRISE_SCHEME: ios-simple-objc
- CODE_SIGNING_METHOD: api-key
- TEAM_ID: 72SA8V3WYL
- CERTIFICATE_URL_LIST: $BITFALL_APPLE_IOS_CERTIFICATE_NOPASSPHRASE_URL
- CERTIFICATE_PASSPHRASE_LIST: ""
after_run:
- _run

_run:
steps:
Expand All @@ -169,8 +174,8 @@ workflows:
- output_tool: xcodebuild
- xcodebuild_options: $XCODE_BUILD_OPTIONS
- automatic_code_signing: $CODE_SIGNING_METHOD
- certificate_url_list: $BITFALL_APPLE_APPLE_CERTIFICATE_URL_LIST
- passphrase_list: $BITFALL_APPLE_APPLE_CERTIFICATE_PASSPHRASE_LIST
- certificate_url_list: $CERTIFICATE_URL_LIST
- passphrase_list: $CERTIFICATE_PASSPHRASE_LIST
- apple_team_id: $TEAM_ID
- git::https://github.com/bitrise-steplib/bitrise-step-check-step-outputs.git@main:
is_always_run: true
Expand Down
24 changes: 12 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,33 @@ module github.com/bitrise-steplib/steps-xcode-build-for-test
go 1.17

require (
github.com/bitrise-io/go-steputils v1.0.1
github.com/bitrise-io/go-utils v1.0.1
github.com/bitrise-io/go-xcode v1.0.2
github.com/bitrise-io/go-steputils v1.0.2
github.com/bitrise-io/go-utils v1.0.2
github.com/bitrise-io/go-xcode v1.0.6
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
golang.org/x/text v0.3.7 // indirect
)

require (
github.com/bitrise-io/go-steputils/v2 v2.0.0-alpha.1
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.2
github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.11
github.com/bitrise-io/go-steputils/v2 v2.0.0-alpha.2
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.7
github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.17
)

require (
github.com/bitrise-io/go-plist v0.0.0-20210301100253-4b1a112ccd10 // indirect
github.com/bitrise-io/pkcs12 v0.0.0-20211108084543-e52728e011c8 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa // indirect
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
github.com/golang-jwt/jwt/v4 v4.4.1 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.0 // indirect
github.com/hashicorp/go-version v1.3.0 // indirect
github.com/hashicorp/go-retryablehttp v0.7.1 // indirect
github.com/hashicorp/go-version v1.5.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/objx v0.3.0 // indirect
github.com/stretchr/testify v1.7.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
github.com/stretchr/objx v0.4.0 // indirect
github.com/stretchr/testify v1.7.1 // indirect
gopkg.in/yaml.v3 v3.0.0 // indirect
howett.net/plist v1.0.0 // indirect
)
Loading

0 comments on commit 1906fb7

Please sign in to comment.