[scan] default_derived_data supports build for running off#22231
Conversation
|
@iBotPeaches this is a very little change, and CI looks happy. Would you mind taking a look, is there anything needed to get it merged? |
|
thanks. So best I understand if we can't programmatically determine the derived data path - we previously just threw some directory traversal on top of a blank path - making something invalid. This now catches the missing value - throws an error and returns nil - which downstream code handles? or errors out? |
Thanks for taking a look. ../../.., and imho better than erroring out because of this (debatable).
|
There was a problem hiding this comment.
Hey @jmihaliczas3d 👋
Thank you for your contribution to fastlane and congrats on getting this pull request merged 🎉
The code change now lives in the master branch, however it wasn't released to RubyGems yet.
We usually ship about once a month, and your PR will be included in the next one.
Please let us know if this change requires an immediate release by adding a comment here 👍
We'll notify you once we shipped a new release with your changes 🚀"
…h if BUILT_PRODUCTS_DIR missing (fastlane#22231) * Scan: default_derived_data supports build for running off * Fix default_path nil check * Empty commit to trigger CI validation
There was a problem hiding this comment.
Congratulations! 🎉 This was released as part of fastlane 2.234.0 🚀
The previous commit added the test bundle to the scheme's <BuildAction>
to fix `xcodebuild -showBuildSettings` returning empty settings. That
worked in theory, but in practice CI showed that once xcodebuild has a
buildable in the scheme it enforces scheme-level destination validation
against the test target's effective platforms, and rejects iOS Simulator
destinations:
xcodebuild: error: Unable to find a destination matching the
provided destination specifier:
{ platform:iOS Simulator, id:... }
Available destinations for the "SPMIntegration" scheme:
{ platform:visionOS Simulator, ...Designed for [iPad,iPhone]... }
The empty <BuildAction> in the original scheme was effectively the
escape hatch that let fastlane pass an iOS Simulator destination and
have it accepted. Removing that escape hatch broke the build.
Revert the scheme and project.pbxproj changes back to main and instead
fix the real symptom: tell `fastlane scan` where to put / find derived
data. Once `derived_data_path` is set, `Scan::DetectValues
.default_derived_data` short-circuits before the
`BUILT_PRODUCTS_DIR is nil` early-return introduced in
fastlane/fastlane#22231 (fastlane 2.234.0), and the `.xcresult` lookup
works the same way it did under 2.233.1.
Use the same value (`scan_derived_data`) that the BackendIntegrationTests
and v3/v4 LoadShedderIntegration lanes already use in `fastlane/Fastfile`.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Fix Custom Entitlement Computation SPM installation test scheme
The `SPMIntegration` scheme in `SPMCustomEntitlementComputationInstallation` had
an empty `<BuildAction>` and a dangling `<LaunchAction>` reference to a
non-existent `SPMInstallation.app` target. That meant
`xcodebuild -showBuildSettings -scheme SPMIntegration` returned no settings
at all (no `BUILT_PRODUCTS_DIR`, no `SUPPORTED_PLATFORMS`).
Until fastlane 2.233.1 this was masked: scan silently fell back to
`File.expand_path("../../..", nil)` as `derived_data_path`, which happened
to be a writable path on CI, so the test ran and scan found the
`.xcresult`. fastlane 2.234.0 (PR fastlane/fastlane#22231) added an
explicit nil-guard in `Scan::DetectValues.default_derived_data`, so
`derived_data_path` is now left unset. `xcodebuild test` then uses its
default `~/Library/Developer/Xcode/DerivedData/...`, scan can't find the
result bundle there, and the installation test fails with
"Cannot find .xcresult in derived data which is needed to determine test
results" even though the test itself passes.
Fix the scheme to match the pattern already used by other test-only
schemes in the repo (e.g. `BackendIntegrationTests.xcscheme`):
- Add a `<BuildActionEntry buildForTesting="YES" .../>` for the
`SPMInstallationTests.xctest` target so the scheme has a real buildable.
- Replace the dangling `SPMInstallation.app` reference in
`<LaunchAction><MacroExpansion>` with the test bundle (the app target
doesn't exist in this project).
- Declare `SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"` on the test
target so `xcodebuild -showBuildSettings -scheme` resolves cleanly
regardless of Xcode version.
- Drop the now-unnecessary Scanfile workaround
(`skip_build(true)` + accompanying comment) — the scheme is no longer
"only setup for testing, not building".
Co-authored-by: Cursor <cursoragent@cursor.com>
* Revert scheme edit and set derived_data_path explicitly instead
The previous commit added the test bundle to the scheme's <BuildAction>
to fix `xcodebuild -showBuildSettings` returning empty settings. That
worked in theory, but in practice CI showed that once xcodebuild has a
buildable in the scheme it enforces scheme-level destination validation
against the test target's effective platforms, and rejects iOS Simulator
destinations:
xcodebuild: error: Unable to find a destination matching the
provided destination specifier:
{ platform:iOS Simulator, id:... }
Available destinations for the "SPMIntegration" scheme:
{ platform:visionOS Simulator, ...Designed for [iPad,iPhone]... }
The empty <BuildAction> in the original scheme was effectively the
escape hatch that let fastlane pass an iOS Simulator destination and
have it accepted. Removing that escape hatch broke the build.
Revert the scheme and project.pbxproj changes back to main and instead
fix the real symptom: tell `fastlane scan` where to put / find derived
data. Once `derived_data_path` is set, `Scan::DetectValues
.default_derived_data` short-circuits before the
`BUILT_PRODUCTS_DIR is nil` early-return introduced in
fastlane/fastlane#22231 (fastlane 2.234.0), and the `.xcresult` lookup
works the same way it did under 2.233.1.
Use the same value (`scan_derived_data`) that the BackendIntegrationTests
and v3/v4 LoadShedderIntegration lanes already use in `fastlane/Fastfile`.
Co-authored-by: Cursor <cursoragent@cursor.com>
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
Checklist
bundle exec rspecfrom the root directory to see all new and existing tests passbundle exec rubocop -ato ensure the code style is validci/circlecibuilds in the "All checks have passed" section of my PR (connect CircleCI to GitHub if not)Motivation and Context
Resolves #22230
Description
In cases when
build_settingsdoes not work for the project with the given scheme, because build for running is OFF,detect_derived_datawill just keepderived_data_pathunset instead of using an invalid path.Error message is displayed to guide the user for fixing the issue, but chances that leaving derived data to
xcodebuildwill also work, so we do not stop execution.Testing Steps
I tested this change in my setup, and it worked nicely. Presented the error, but
scandid not override derived data in thexcodebuildcommand, so it just used the right one.