Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Karim/fix xcode previews #3124

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

karim-alweheshy
Copy link
Contributor

@karim-alweheshy karim-alweheshy commented Dec 27, 2024

I used this technique to point swiftc to rules_xcodeproj swiftc stub. This is now done manually to unblock the main part of the project but would need to be incorporated somehow eventually

WIP

Two things, pointing xcode to the custom toolchain and pointing the custom toolchain swiftc to rules_xcodeproj swiftc stub
I guess the next change would be for swiftc stub to diff between xcode commands (ignore except swiftui previews) and bazel commands (pass through)

@@ -20,6 +20,12 @@ do
developer_dir="${1/\/Platforms\/*/}"
;;

*.debug.dylib)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to verify this on an App previews

@@ -146,6 +150,20 @@ func handleXcodePreviewThunk(args: [String], paths: [PathKey: URL]) throws -> Ne
exit(1)
}

if let outputFileMapURL = paths[.supplementaryOutputFileMap] {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without that i got an error

Showing All Messages
Error opening '/Users/karim.alweheshy/Library/Developer/Xcode/DerivedData/TestModule_Feature-dtbqdukuomtoamfwbeaihszmgzda/Build/Intermediates.noindex/TestModule_Feature.build/bazel-out/ios_sim_arm64-dbg-ios-sim_arm64-min15.0-applebin_ios-ST-4f30668f84b0/bin/Modules/TestModule/TestModule/Objects-normal/arm64/TestModule.swiftconstvalues' for output: /Users/karim.alweheshy/Library/Developer/Xcode/DerivedData/TestModule_Feature-dtbqdukuomtoamfwbeaihszmgzda/Build/Intermediates.noindex/TestModule_Feature.build/bazel-out/ios_sim_arm64-dbg-ios-sim_arm64-min15.0-applebin_ios-ST-4f30668f84b0/bin/Modules/TestModule/TestModule/Objects-normal/arm64/TestModule.swiftconstvalues: Operation not permitted

@@ -28,7 +28,7 @@ if [[ "$ACTION" != indexbuild ]]; then
if [[ -f "$BAZEL_OUTPUTS_PRODUCT_BASENAME" ]]; then
# Product is a binary, so symlink instead of rsync, to allow for Bazel-set
# rpaths to work
ln -sfh "$PWD/$BAZEL_OUTPUTS_PRODUCT_BASENAME" "$TARGET_BUILD_DIR/$PRODUCT_NAME"
ln -sfh "$PWD/$BAZEL_OUTPUTS_PRODUCT_BASENAME" "$TARGET_BUILD_DIR/lib$PRODUCT_NAME.a"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SwiftUIP Previews run

libtool called with arguments: -static -arch_only arm64 -D -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator18.1.sdk -L/Users/karim.alweheshy/Library/Developer/Xcode/DerivedData/TestProject-cnscizqkxdbvwacrakshbzzkcnub/Build/Products/Debug-iphonesimulator -filelist /Users/karim.alweheshy/Library/Developer/Xcode/DerivedData/TestProject-cnscizqkxdbvwacrakshbzzkcnub/Build/Intermediates.noindex/Impl.build/Debug-iphonesimulator/Impl.build/Objects-normal/arm64/Impl.LinkFileList -dependency_info /Users/karim.alweheshy/Library/Developer/Xcode/DerivedData/TestProject-cnscizqkxdbvwacrakshbzzkcnub/Build/Intermediates.noindex/Impl.build/Debug-iphonesimulator/Impl.build/Objects-normal/arm64/Impl_libtool_dependency_info.dat -o /Users/karim.alweheshy/Library/Developer/Xcode/DerivedData/TestProject-cnscizqkxdbvwacrakshbzzkcnub/Build/Products/Debug-iphonesimulator/libImpl.a

.init(key: "SWIFT_OBJC_INTERFACE_HEADER_NAME", value: #""""#),
.init(key: "SWIFT_OPTIMIZATION_LEVEL", value: #""-Onone""#),
.init(key: "SWIFT_USE_INTEGRATED_DRIVER", value: "NO"),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2024-12-26 at 15 45 00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant