Skip to content

Commit 805864c

Browse files
committed
Added documentation for SPI_PROCESSING.
1 parent 73a5ada commit 805864c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Sources/SPIManifest/Documentation.docc/CommonUseCases.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ builder:
8383

8484
There is also a `target:` key in order to configure a specific target instead of a scheme, where applicable.
8585

86+
### Implementing custom package logic with SPI_PROCESSING
87+
88+
When the Swift Package Index processes your package, you’ll find the `SPI_PROCESSING` environment variable set during two key processes:
89+
90+
- **Analysis**: Swift Package Index extracts package metadata by running `swift package dump-package`. Packages _must_ pass analysis to be included in the index.
91+
- **Compatibility builds**: Swift Package Index runs either `swift build` or `xcodebuild` to determine Swift version and platform compatibility.
92+
93+
See the [swift-java](https://swiftpackageindex.com/swiftlang/swift-java) package for an example of a package using this feature, where the authors [bypass JDK requirement](https://github.com/swiftlang/swift-java/blob/a3791cf7c94146a34f96fd9ad53efef9d58c2a1b/Package.swift#L35) during analysis. Without this exception, the Swift Package Index analysis machines couldn’t successfully run `swift package dump-package`.
8694

8795
## Images for Linux
8896

0 commit comments

Comments
 (0)