Skip to content

Commit 39208f0

Browse files
Update Package.swift
Improve SPI JAVA_HOME check: don't suppress proper error messaging when the package manifest is used in the context of the SPI's build system. (This won't make a difference once Java is actually installed on our builders but gives a proper error message in the logs until that's the case.)
1 parent a3791cf commit 39208f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ func findJavaHome() -> String {
3232
}
3333

3434

35-
if ProcessInfo.processInfo.environment["SPI_PROCESSING"] == "1" {
36-
// just ignore that we're missing a JAVA_HOME when building in Swift Package Index
35+
if ProcessInfo.processInfo.environment["SPI_PROCESSING"] == "1" && ProcessInfo.processInfo.environment["SPI_BUILD"] == nil {
36+
// Just ignore that we're missing a JAVA_HOME when building in Swift Package Index during general processing where no Java is needed. However, do _not_ suppress the error during SPI's compatibility build stage where Java is required.
3737
return ""
3838
}
3939
fatalError("Please set the JAVA_HOME environment variable to point to where Java is installed.")

0 commit comments

Comments
 (0)