bitrise-steplib / steps-xcode-archive

Xcode Archive for iOS step
MIT License
65 stars 55 forks source link

Pass additional options to showBuildSettings #357

Closed lpusok closed 2 days ago

lpusok commented 3 weeks ago

Checklist

Version

Requires a MINOR version update

Context

Pass xcodebuild additional flags (for example -skipPackagePluginValidation -skipMacroValidation -skipPackageUpdates) to -resolvePackageDependencies command, so it behaves the same way as the archive command.

Changes

Investigation details

Decisions

godrei commented 2 days ago

I was curious if xcodebuild fails if unexpected options are passed to the given command, it seems those options are simply ignored, so I'm OK with this change.

x0000ff commented 1 day ago

Hey, folks, @godrei and @lpusok 👋🏼 It looks like Xcode doesn't ignore it. My Archive Step started to fail. I didn't change the Step config.


+------------------------------------------------------------------------------+

| (1) Xcode Archive & Export for iOS                                           |
+------------------------------------------------------------------------------+
| id: xcode-archive                                                            |
| version: 5.2.0                                                               |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: go                                                                  |
| time: 2024-09-17T07:57:43Z                                                   |
+------------------------------------------------------------------------------+
|                                                                              |
Inputs:
- distribution_method: ad-hoc
- upload_bitcode: false
- compile_bitcode: false
- icloud_container_environment: <unset>
- export_development_team: <unset>
- export_options_plist_content: <unset>
- log_formatter: xcpretty
- project_path: *****.xcworkspace
- scheme: *****
- configuration: AdHoc
- output_dir: /Users/[REDACTED]/deploy
- perform_clean_action: false
- xcodebuild_options: -derivedDataPath "/tmp/"
- xcconfig_content: COMPILER_INDEX_STORE_ENABLE = NO
- export_all_dsyms: true
- artifact_name: <unset>
- verbose_log: false
- cache_level: none
- automatic_code_signing: off
- certificate_url_list: [REDACTED]
- passphrase_list: *****
- keychain_path: /Users/[REDACTED]/Library/Keychains/login.keychain
- keychain_password: *****
- register_test_devices: false
- test_device_list_path: <unset>
- min_profile_validity: 0
- fallback_provisioning_profile_url_list: <unset>
- api_key_path: <unset>
- api_key_id: <unset>
- api_key_issuer_id: <unset>
- BITRISE_BUILD_URL: https://app.bitrise.io/build/*****
- BITRISE_BUILD_API_TOKEN: *****
Xcode version:
Xcode 15.4 (Build version 15F31d)
Checking if log formatter (xcpretty) is installed
- xcprettyVersion: 0.3.0
Running resolve Swift package dependencies
[07:57:45] Resolving package dependencies...
[07:57:45] $ xcodebuild "-workspace" "/Users/[REDACTED]/git/*****.xcworkspace" "-scheme" "*****" "-configuration" "AdHoc" "-resolvePackageDependencies" "-derivedDataPath" "/tmp/"
Command line invocation:
    /Applications/Xcode-15.4.0.app/Contents/Developer/usr/bin/xcodebuild -workspace /Users/[REDACTED]/git/*****.xcworkspace -scheme ***** -configuration AdHoc -resolvePackageDependencies -derivedDataPath /tmp/
User defaults from command line:
    IDEDerivedDataPathOverride = /tmp
    IDEPackageSupportUseBuiltinSCM = YES
resolved source packages: 
[07:57:50] Resolved package dependencies.
Looking for artifact name as field is empty
[07:57:50] Reading build settings...
[07:57:50] $ xcodebuild "-workspace" "/Users/[REDACTED]/git/*****.xcworkspace" "-scheme" "*****" "-configuration" "AdHoc" "-showBuildSettings"
[07:57:56] Read target settings.
Automatic code signing is disabled, skipped downloading code sign assets
[07:57:56] Opening xcode project at path: /Users/[REDACTED]/git/*****.xcworkspace for scheme: *****
Read NotificationService scheme in 0s.
...
Read Users scheme in 0s.
[07:57:57] Reading xcode project
Finding platform type
[07:57:57] Reading build settings...
[07:57:57] $ xcodebuild "-project" "/Users/[REDACTED]/git/*****.xcodeproj" "-target" "*****" "-configuration" "AdHoc" "-showBuildSettings" "-derivedDataPath" "/tmp/"
Failed to execute Step main logic:
  failed to read project platform: /Users/[REDACTED]/git/*****.xcworkspace: failed to get target (*****) build settings: xcodebuild "-project" "/Users/[REDACTED]/git/*****.xcodeproj" "-target" "*****" "-configuration" "AdHoc" "-showBuildSettings" "-derivedDataPath" "/tmp/" command failed, output: 2024-09-17 07:57:57.368 xcodebuild[66877:98644] Writing error result bundle to /var/folders/7l/rszmbrmd6tv4pg52z6ql_5rc0000gn/T/ResultBundle_2024-17-09_07-57-0057.xcresult
  xcodebuild: error: The flag -scheme, -testProductsPath, or -xctestrun is required when specifying -derivedDataPath.
Exporting outputs...
Failed to execute Step main logic:
  failed to read project platform: /Users/[REDACTED]/git/*****.xcworkspace: failed to get target (*****) build settings: xcodebuild "-project" "/Users/[REDACTED]/git/*****.xcodeproj" "-target" "*****" "-configuration" "AdHoc" "-showBuildSettings" "-derivedDataPath" "/tmp/" command failed, output: 2024-09-17 07:57:57.368 xcodebuild[66877:98644] Writing error result bundle to /var/folders/7l/rszmbrmd6tv4pg52z6ql_5rc0000gn/T/ResultBundle_2024-17-09_07-57-0057.xcresult
  xcodebuild: error: The flag -scheme, -testProductsPath, or -xctestrun is required when specifying -derivedDataPath.
|                                                                              |
+---+---------------------------------------------------------------+----------+
| x | Xcode Archive & Export for iOS (Failed)                       | 15.13 sec |
+---+---------------------------------------------------------------+----------+
| Issue tracker: https://github.com/bitrise-steplib/steps-xcode-archive/issues |
| Source: https://github.com/bitrise-steplib/steps-xcode-archive               |
+---+---------------------------------------------------------------+----------+

I checked the log of the prev. success build and they are differ:

As you can see the argument -derivedDataPath appeared.


My step config in the .yml:

            - xcode-archive@5:
                inputs:
                    - project_path: $BITRISE_PROJECT_PATH
                    - scheme: $BITRISE_SCHEME
                    - upload_bitcode: "no"
                    - compile_bitcode: "no"
                    - configuration: AdHoc
                    - xcodebuild_options: -derivedDataPath "/tmp/"
                    - distribution_method: ad-hoc
                    - cache_level: none
                    - export_method: $BITRISE_EXPORT_METHOD
lpusok commented 1 day ago

Hello @x0000ff , Thanks for the report and sorry for the inconvenience. As a workaround please use 5.1.0 or remove the additional flags -derivedDataPath "/tmp/", while we fix this. Just curious, why do you need a custom derivedDataPath set?

x0000ff commented 1 day ago

Thanks a lot for so fast reaction, @lpusok! 👏🏼 Correct, I've removed the -derivedDataPath flag and the step succeeded.

Just curious, why do you need a custom derivedDataPath set?

I don't know when and why it was added. I will remove it.