Skip to content

Commit 4f2a2eb

Browse files
authored
Disable implementationOnly Foundation import for resource accessor (#5997) (#6055)
This was a change that landed in #5728 but it has the unintended consequence of generating unfixable warnings for packages which do import Foundation. We can probably solve that with import scanning to decide between the two import types, but given where we are in the 5.8 schedule, this seems to be something better done for a future manifest version. (cherry picked from commit cb9d03b)
1 parent 069ee97 commit 4f2a2eb

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

CHANGELOG.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
Note: This is in reverse chronological order, so newer entries are added to the top.
22

3+
Swift Next
4+
-----------
5+
6+
* [#5728]
7+
8+
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.
9+
10+
311
Swift 5.8
412
-----------
513

@@ -14,10 +22,6 @@ Swift 5.8
1422

1523
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.
1624

17-
* [#5728]
18-
19-
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.
20-
2125
Swift 5.7
2226
-----------
2327

Documentation/ReleaseNotes/5.8.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
11
# SwiftPM 5.8 Release Notes
2-
3-
* [#5728]
4-
5-
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.

Sources/Build/BuildPlan.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ public final class SwiftTargetBuildDescription {
834834

835835
let stream = BufferedOutputByteStream()
836836
stream <<< """
837-
\(toolsVersion < .v5_8 ? "import" : "@_implementationOnly import") class Foundation.Bundle
837+
\(toolsVersion < .vNext ? "import" : "@_implementationOnly import") class Foundation.Bundle
838838
839839
extension Foundation.Bundle {
840840
static let module: Bundle = {

0 commit comments

Comments
 (0)