Skip to content

[5.8] Disable implementationOnly Foundation import for resource accessor #6055

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 1 commit into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
Note: This is in reverse chronological order, so newer entries are added to the top.

Swift Next
-----------

* [#5728]

In packages that specify resources using a future tools version, the generated resource bundle accessor will import `Foundation.Bundle` for its own implementation only. _Clients_ of such packages therefore no longer silently import `Foundation`, preventing inadvertent use of Foundation extensions to standard library APIs, which helps to avoid unexpected code size increases.


Swift 5.8
-----------

Expand All @@ -14,10 +22,6 @@ Swift 5.8

In packages using tools version 5.8 or later, Foundation is no longer implicitly imported into package manifests. If Foundation APIs are used, the module needs to be imported explicitly.

* [#5728]

In packages that specify resources using tools version 5.8 or later, the generated resource bundle accessor will import `Foundation.Bundle` for its own implementation only. _Clients_ of such packages therefore no longer silently import `Foundation`, preventing inadvertent use of Foundation extensions to standard library APIs, which helps to avoid unexpected code size increases.

Swift 5.7
-----------

Expand Down
4 changes: 0 additions & 4 deletions Documentation/ReleaseNotes/5.8.md
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
# SwiftPM 5.8 Release Notes

* [#5728]

In packages that specify resources using tools version 5.8 or later, the generated resource bundle accessor will import `Foundation.Bundle` for its own implementation only. _Clients_ of such packages therefore no longer silently import `Foundation`, preventing inadvertent use of Foundation extensions to standard library APIs, which helps to avoid unexpected code size increases.
2 changes: 1 addition & 1 deletion Sources/Build/BuildPlan.swift
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ public final class SwiftTargetBuildDescription {

let stream = BufferedOutputByteStream()
stream <<< """
\(toolsVersion < .v5_8 ? "import" : "@_implementationOnly import") class Foundation.Bundle
\(toolsVersion < .vNext ? "import" : "@_implementationOnly import") class Foundation.Bundle

extension Foundation.Bundle {
static let module: Bundle = {
Expand Down