@@ -17,6 +17,18 @@ func envEnable(_ key: String, default defaultValue: Bool = false) -> Bool {
17
17
}
18
18
}
19
19
20
+ #if os(macOS)
21
+ // 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.
22
+ let buildForDarwinPlatform = envEnable ( " OPENSWIFTUI_BUILD_FOR_DARWIN_PLATFORM " , default: true )
23
+ #else
24
+ let buildForDarwinPlatform = envEnable ( " OPENSWIFTUI_BUILD_FOR_DARWIN_PLATFORM " )
25
+ #endif
26
+
27
+
28
+ // https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server/issues/3061#issuecomment-2118821061
29
+ // By-pass https://github.com/swiftlang/swift-package-manager/issues/7580
30
+ let isSPIDocGenerationBuild = envEnable ( " SPI_GENERATE_DOCS " , default: false )
31
+
20
32
// MARK: - Env and Config
21
33
22
34
let isXcodeEnv = Context . environment [ " __CFBundleIdentifier " ] == " com.apple.dt.Xcode "
@@ -112,11 +124,7 @@ if warningsAsErrorsCondition {
112
124
113
125
// MARK: - [env] OPENGRAPH_LIBRARY_EVOLUTION
114
126
115
- #if os(macOS)
116
- let libraryEvolutionCondition = envEnable ( " OPENGRAPH_LIBRARY_EVOLUTION " , default: true )
117
- #else
118
- let libraryEvolutionCondition = envEnable ( " OPENGRAPH_LIBRARY_EVOLUTION " )
119
- #endif
127
+ let libraryEvolutionCondition = envEnable ( " OPENGRAPH_LIBRARY_EVOLUTION " , default: buildForDarwinPlatform)
120
128
121
129
if libraryEvolutionCondition {
122
130
// NOTE: -enable-library-evolution will cause module verify failure for `swift build`.
@@ -223,16 +231,6 @@ let package = Package(
223
231
cxxLanguageStandard: . cxx20
224
232
)
225
233
226
-
227
- #if os(macOS)
228
- // FIXME: Enable it by default will cause non-iOS/macOS Apple OS build fail currently.
229
- // Add the corresponding tbd file and framework to fix it.
230
- let attributeGraphCondition = envEnable ( " OPENGRAPH_ATTRIBUTEGRAPH " , default: true )
231
- #else
232
- let attributeGraphCondition = envEnable ( " OPENGRAPH_ATTRIBUTEGRAPH " )
233
- #endif
234
- let useLocalDeps = envEnable ( " OPENGRAPH_USE_LOCAL_DEPS " )
235
-
236
234
extension Target {
237
235
func addAGSettings( ) {
238
236
dependencies. append (
@@ -253,6 +251,10 @@ extension Target {
253
251
}
254
252
}
255
253
254
+ let useLocalDeps = envEnable ( " OPENGRAPH_USE_LOCAL_DEPS " )
255
+
256
+ let attributeGraphCondition = envEnable ( " OPENGRAPH_ATTRIBUTEGRAPH " , default: buildForDarwinPlatform && !isSPIDocGenerationBuild)
257
+
256
258
if attributeGraphCondition {
257
259
let privateFrameworkRepo : Package . Dependency
258
260
if useLocalDeps {
0 commit comments