Skip to content

Commit 61edb3d

Browse files
authored
Fix SPI doc build issue (#3)
1 parent 7b519ec commit 61edb3d

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

Package.swift

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ func envEnable(_ key: String, default defaultValue: Bool = false) -> Bool {
1616
}
1717
}
1818

19+
#if os(macOS)
20+
// NOTE: #if os(macOS) check is not accurate if we are cross compiling for Linux platform. So we add an env key to specify it.
21+
let buildForDarwinPlatform = envEnable("OPENSWIFTUI_BUILD_FOR_DARWIN_PLATFORM", default: true)
22+
#else
23+
let buildForDarwinPlatform = envEnable("OPENSWIFTUI_BUILD_FOR_DARWIN_PLATFORM")
24+
#endif
25+
26+
27+
// https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server/issues/3061#issuecomment-2118821061
28+
// By-pass https://github.com/swiftlang/swift-package-manager/issues/7580
29+
let isSPIDocGenerationBuild = envEnable("SPI_GENERATE_DOCS", default: false)
30+
1931
// MARK: - Env and Config
2032

2133
let isXcodeEnv = Context.environment["__CFBundleIdentifier"] == "com.apple.dt.Xcode"
@@ -44,11 +56,7 @@ var sharedSwiftSettings: [SwiftSetting] = [
4456

4557
// MARK: - [env] OPENBOX_LIBRARY_EVOLUTION
4658

47-
#if os(macOS)
48-
let libraryEvolutionCondition = envEnable("OPENBOX_LIBRARY_EVOLUTION", default: true)
49-
#else
50-
let libraryEvolutionCondition = envEnable("OPENBOX_LIBRARY_EVOLUTION")
51-
#endif
59+
let libraryEvolutionCondition = envEnable("OPENBOX_LIBRARY_EVOLUTION", default: buildForDarwinPlatform)
5260

5361
if libraryEvolutionCondition {
5462
// NOTE: -enable-library-evolution will cause module verify failure for `swift build`.
@@ -115,14 +123,10 @@ let package = Package(
115123
cxxLanguageStandard: .cxx20
116124
)
117125

118-
119-
#if os(macOS)
120-
let renderBoxCondtion = envEnable("OPENBOX_RENDERBOX", default: true)
121-
#else
122-
let renderBoxCondtion = envEnable("OPENBOX_RENDERBOX")
123-
#endif
124126
let useLocalDeps = envEnable("OPENBOX_USE_LOCAL_DEPS")
125127

128+
let renderBoxCondtion = envEnable("OPENBOX_RENDERBOX", default: buildForDarwinPlatform && !isSPIDocGenerationBuild )
129+
126130
if renderBoxCondtion {
127131
let privateFrameworkRepo: Package.Dependency
128132
if useLocalDeps {

0 commit comments

Comments
 (0)