@@ -133,6 +133,14 @@ if libraryEvolutionCondition {
133133 sharedSwiftSettings. append ( . unsafeFlags( [ " -enable-library-evolution " , " -no-verify-emitted-module-interface " ] ) )
134134}
135135
136+ // MARK: - [env] OPENATTRIBUTEGRAPH_COMPATIBILITY_TEST
137+
138+ let compatibilityTestCondition = envEnable ( " OPENATTRIBUTEGRAPH_COMPATIBILITY_TEST " , default: false )
139+ sharedCSettings. append ( . define( " OPENATTRIBUTEGRAPH " , to: compatibilityTestCondition ? " 1 " : " 0 " ) )
140+ if !compatibilityTestCondition {
141+ sharedSwiftSettings. append ( . define( " OPENATTRIBUTEGRAPH " ) )
142+ }
143+
136144// MARK: - Targets
137145
138146let openAttributeGraphTarget = Target . target (
@@ -192,7 +200,7 @@ let openAttributeGraphCompatibilityTestsTarget = Target.testTarget(
192200 name: " OpenAttributeGraphCompatibilityTests " ,
193201 dependencies: [
194202 . product( name: " Numerics " , package : " swift-numerics " ) ,
195- ] ,
203+ ] + ( compatibilityTestCondition ? [ ] : [ " OpenAttributeGraph " ] ) ,
196204 exclude: [ " README.md " ] ,
197205 cSettings: sharedCSettings,
198206 swiftSettings: sharedSwiftSettings
@@ -213,11 +221,6 @@ let package = Package(
213221 openAttributeGraphTarget,
214222 openAttributeGraphSPITarget,
215223 openAttributeGraphShimsTarget,
216-
217- openAttributeGraphTestsTarget,
218- openAttributeGraphCxxTestsTarget,
219- openAttributeGraphShimsTestsTarget,
220- openAttributeGraphCompatibilityTestsTarget,
221224 ] ,
222225 cxxLanguageStandard: . cxx20
223226)
@@ -231,15 +234,20 @@ extension Target {
231234 swiftSettings. append ( . define( " OPENATTRIBUTEGRAPH_ATTRIBUTEGRAPH " ) )
232235 self . swiftSettings = swiftSettings
233236 }
234-
235- func addCompatibilitySettings( ) {
236- dependencies. append (
237- . product( name: " AttributeGraph " , package : " DarwinPrivateFrameworks " )
238- )
239- var swiftSettings = swiftSettings ?? [ ]
240- swiftSettings. append ( . define( " OPENATTRIBUTEGRAPH_COMPATIBILITY_TEST " ) )
241- self . swiftSettings = swiftSettings
242- }
237+ }
238+
239+ if !compatibilityTestCondition {
240+ package . targets += [
241+ openAttributeGraphTestsTarget,
242+ openAttributeGraphCxxTestsTarget,
243+ openAttributeGraphShimsTestsTarget,
244+ ]
245+ } else {
246+ openAttributeGraphCompatibilityTestsTarget. addAGSettings ( )
247+ }
248+
249+ if buildForDarwinPlatform {
250+ package . targets. append ( openAttributeGraphCompatibilityTestsTarget)
243251}
244252
245253let useLocalDeps = envEnable ( " OPENATTRIBUTEGRAPH_USE_LOCAL_DEPS " )
@@ -267,12 +275,6 @@ if attributeGraphCondition {
267275 package . platforms = [ . iOS( . v13) , . macOS( . v10_15) , . macCatalyst( . v13) , . tvOS( . v13) , . watchOS( . v5) ]
268276}
269277
270- let compatibilityTestCondition = envEnable ( " OPENATTRIBUTEGRAPH_COMPATIBILITY_TEST " )
271- if compatibilityTestCondition && attributeGraphCondition {
272- openAttributeGraphCompatibilityTestsTarget. addCompatibilitySettings ( )
273- } else {
274- openAttributeGraphCompatibilityTestsTarget. dependencies. append ( " OpenAttributeGraph " )
275- }
276278
277279extension [ Platform ] {
278280 static var nonDarwinPlatforms : [ Platform ] {
0 commit comments