Skip to content

Commit 808ef19

Browse files
authored
perf: disable private imports by default (#1255)
1 parent 2b549f3 commit 808ef19

7 files changed

Lines changed: 14 additions & 3 deletions

File tree

‎.github/workflows/ios.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ jobs:
5959
OPENSWIFTUI_SUPPORT_MULTI_PRODUCTS: 0
6060
OPENSWIFTUI_USE_LOCAL_DEPS: 1
6161
OPENSWIFTUI_LINK_TESTING: 1
62+
OPENSWIFTUI_ENABLE_PRIVATE_IMPORTS: 1
6263
# Match Xcode's test launcher so OSLogStore can read current-process debug messages.
6364
OS_ACTIVITY_DT_MODE: "YES"
6465
GH_TOKEN: ${{ github.token }}

‎.github/workflows/macos.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ jobs:
5252
OPENSWIFTUI_TARGET_RELEASE: ${{ matrix.release }}
5353
OPENSWIFTUI_USE_LOCAL_DEPS: 1
5454
OPENSWIFTUI_LINK_TESTING: 1
55+
OPENSWIFTUI_ENABLE_PRIVATE_IMPORTS: 1
5556
# Match Xcode's test launcher so OSLogStore can read current-process debug messages.
5657
OS_ACTIVITY_DT_MODE: "YES"
5758
GH_TOKEN: ${{ github.token }}

‎.github/workflows/ubuntu.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
OPENSWIFTUI_SWIFT_LOG: 1
4848
OPENSWIFTUI_SWIFT_CRYPTO: 1
4949
OPENSWIFTUI_LINK_TESTING: 1
50+
OPENSWIFTUI_ENABLE_PRIVATE_IMPORTS: 1
5051
container: swift:${{ matrix.swift_version }}-jammy
5152
steps:
5253
- uses: actions/checkout@v4

‎CONTRIBUTING.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ Run the full SwiftPM test suite when the scope of the change warrants it:
6262
./Scripts/test.sh
6363
```
6464

65+
Private imports are disabled by default. The full-suite script and unit-test CI
66+
enable them for tests that use `@_private` imports. To run such tests directly,
67+
enable them for that invocation:
68+
69+
```shell
70+
OPENSWIFTUI_ENABLE_PRIVATE_IMPORTS=1 swift test --filter LocationTests
71+
```
72+
6573
Some integration and compatibility tests require a specific host platform,
6674
SDK, environment configuration, or local dependency checkout. If a test cannot
6775
run in your environment, explain that limitation in the pull request.

‎Package.resolved‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Package.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ let ignoreAvailability = envBoolValue("IGNORE_AVAILABILITY", default: !isVDCDocG
180180
// different overlay file.
181181
let xrOverlayPath = envStringValue("XR_OVERLAY").flatMap { $0.isEmpty ? nil : $0 }
182182
?? "\(NSHomeDirectory())/Library/Developer/OpenSwiftUI/XR/overlay.yaml"
183-
let enablePrivateImports = envBoolValue("ENABLE_PRIVATE_IMPORTS", default: true)
183+
let enablePrivateImports = envBoolValue("ENABLE_PRIVATE_IMPORTS", default: false)
184184
let enableRuntimeConcurrencyCheck = envBoolValue("ENABLE_RUNTIME_CONCURRENCY_CHECK")
185185

186186
let bridgeFramework = envStringValue("OPENSWIFTUI_BRIDGE_FRAMEWORK", default: "SwiftUI")

‎Scripts/test.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ if [[ "$(uname)" == "Linux" ]] && command -v swiftly &> /dev/null && [[ -z "$OPE
1515
echo "Set OPENSWIFTUI_LIB_SWIFT_PATH=$OPENSWIFTUI_LIB_SWIFT_PATH"
1616
fi
1717

18-
swift test
18+
OPENSWIFTUI_ENABLE_PRIVATE_IMPORTS="${OPENSWIFTUI_ENABLE_PRIVATE_IMPORTS:-1}" swift test

0 commit comments

Comments
 (0)