Commit ebb4cc1
authored
Remove @_implementationOnly imports guarded by 'SWT_BUILDING_WITH_CMAKE' (#554)
This removes the `SWT_BUILDING_WITH_CMAKE` compilation condition, and
the `@_implementationOnly import _TestingInternals` declarations it
guards.
### Motivation:
When support for building via CMake was first added (in #387), many
source files in the `Testing` target were modified to avoid using
`private`- or `internal`-level imports of the `_TestingInternals` module
and instead use the older `@_implementationOnly import` style when
building via CMake. As a result, many files have:
```swift
#if SWT_BUILDING_WITH_CMAKE
@_implementationOnly import _TestingInternals
#else
private import _TestingInternals
#endif
```
This has proven to be a maintenance problem for us, because as new files
are added over time, it's not immediately obvious that they need to use
this pattern for importing this module—leading to warnings when building
with CMake such as the one fixed by #553.
I wasn't aware of the reasoning behind the above change at the time, but
I investigated it recently and here's what I concluded: Early on, the
changes in #387 did _not_ enable Library Evolution (LE) for the
`Testing` module, meaning it was still a non-resilient module.
[SE-0409](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0409-access-level-on-imports.md)
states that all dependencies of non-resilient modules must be loaded by
clients, so it would make sense that under those conditions, the build
of a client who imports `Testing` would fail because clients do not have
visibility to the `_TestingInternals` module. However, in a later PR
commit LE was enabled, but nobody realized that those `import` code
changes were no longer necessary and could be reverted.
I was able to reproduce this and confirm the theory: I added an example
client target in the CMake build, then disabled LE in the `Testing`
module, and attempted to build the client. It failed with the expected
missing module error. Then, re-enabling LE and rebuilding everything,
the error went away. Hopefully this is sufficient proof that reverting
this is safe, but I'll check with the main contributor of that PR to
check and see if there were any other issues before landing.
But overall, the goal here is to simplify these imports to reduce
maintenance burden and fully embrace SE-0409.
### Checklist:
- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.1 parent f0730c4 commit ebb4cc1
File tree
31 files changed
+0
-123
lines changed- Sources/Testing
- ABI/EntryPoints
- Events
- ExitTests
- SourceAttribution
- Support
- Additions
- Traits/Tags
- Tests/TestingTests
- Support
- Traits
31 files changed
+0
-123
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | 11 | | |
15 | | - | |
16 | 12 | | |
17 | 13 | | |
18 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | 11 | | |
15 | | - | |
16 | 12 | | |
17 | 13 | | |
18 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | 11 | | |
15 | | - | |
16 | 12 | | |
17 | 13 | | |
18 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | 13 | | |
17 | | - | |
18 | 14 | | |
19 | 15 | | |
20 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | 11 | | |
15 | | - | |
16 | 12 | | |
17 | 13 | | |
18 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | 11 | | |
15 | | - | |
16 | 12 | | |
17 | 13 | | |
18 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | 13 | | |
17 | | - | |
18 | 14 | | |
19 | 15 | | |
20 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | 11 | | |
15 | | - | |
16 | 12 | | |
17 | 13 | | |
18 | 14 | | |
| |||
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | 11 | | |
15 | | - | |
16 | 12 | | |
17 | 13 | | |
18 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | 11 | | |
15 | | - | |
16 | 12 | | |
17 | 13 | | |
18 | 14 | | |
| |||
0 commit comments