Skip to content

Commit 4201825

Browse files
committed
Document SPI_BUILD env variable
1 parent 3b8655c commit 4201825

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Sources/SPIManifest/Documentation.docc/CommonUseCases.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,15 @@ There is also a `target:` key in order to configure a specific target instead of
8585

8686
### Implementing custom package logic with SPI_PROCESSING
8787

88-
When the Swift Package Index processes your package, you’ll find the `SPI_PROCESSING` environment variable set during two key processes:
88+
When the Swift Package Index processes your package, you’ll find the `SPI_PROCESSING` environment variable set during all processessing, in particular the following:
8989

9090
- **Analysis**: Swift Package Index extracts package metadata by running `swift package dump-package`. Packages _must_ pass analysis to be included in the index.
9191
- **Compatibility builds**: Swift Package Index runs either `swift build` or `xcodebuild` to determine Swift version and platform compatibility.
9292

9393
See the [swift-java](https://swiftpackageindex.com/swiftlang/swift-java) package for an example of a package using this feature, where the authors [bypass a 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`.
9494

95+
In addition, the variable `SPI_BUILD` is set exclusively during the compatibility build phase. This allows package authors to include specific package manifest configurations for builds in the context of the Swift Package Index. Again, the [swift-java](https://swiftpackageindex.com/swiftlang/swift-java) package is an example of a package making use of this capability.
96+
9597
## Images for Linux
9698

9799
Package authors can also use the `.spi.yml` file to configure custom docker base images for our Linux builds.

0 commit comments

Comments
 (0)