Skip to content

Add support for attachments to the Foundation cross-import overlay. #819

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

Merged
merged 9 commits into from
Nov 13, 2024

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Nov 11, 2024

This PR adds experimental support for attachments to some types in Foundation via the (non-functional) cross-import overlay. @stmontgomery is working on setting up said overlay so that it can actually be used; until then, the changes here are speculative only.

Replaces #799.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

@grynspan grynspan added enhancement New feature or request public-api Affects public API attachments/activities 🖇️ Work related to attachments and/or activities labels Nov 11, 2024
@grynspan grynspan self-assigned this Nov 11, 2024
@grynspan
Copy link
Contributor Author

@swift-ci test

This PR adds experimental support for attachments to some types in Foundation
via the (non-functional) cross-import overlay. @stmontgomery is working on
setting up said overlay so that it can actually be used; until then, the changes
here are speculative only.
@grynspan grynspan force-pushed the jgrynspan/foundation-attachment-overlay branch from e432ce2 to 1421970 Compare November 13, 2024 14:28
@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan
Copy link
Contributor Author

@swift-ci test

return (preferredName as NSString).appendingPathExtension("tgz") ?? preferredName
}()

try await self.init(Data(compressedContentsOfDirectoryAt: url), named: preferredName, sourceLocation: sourceLocation)
Copy link
Contributor

Choose a reason for hiding this comment

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

Am I interpreting correctly that for directories, it unconditionally compresses the directory's contents? Could we make the compression step an optional parameter, but enabled by default? (Thinking of scenarios where you're attaching a directory containing files which are already highly compressed.) Maybe disabling that would use .tar instead of .tgz?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

This can be for a future PR, but I'd like to request we revisit that and consider making it configurable. In general, "XCTest did it this way" isn't the most compelling justification 😛

@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan grynspan merged commit 94f8a22 into main Nov 13, 2024
3 checks passed
@grynspan grynspan deleted the jgrynspan/foundation-attachment-overlay branch November 13, 2024 21:28
@grynspan grynspan modified the milestones: Swift 6.1, Swift 6.x Dec 5, 2024
@grynspan grynspan added the cross-import-overlays 🍰 Cross-import overlays (Foundation, Core Graphics, etc.) label May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attachments/activities 🖇️ Work related to attachments and/or activities cross-import-overlays 🍰 Cross-import overlays (Foundation, Core Graphics, etc.) enhancement New feature or request public-api Affects public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants