@@ -145,7 +145,8 @@ let libraryEvolutionCondition = envBoolValue("LIBRARY_EVOLUTION", default: build
145145let compatibilityTestCondition = envBoolValue ( " COMPATIBILITY_TEST " , default: false )
146146
147147let useLocalDeps = envBoolValue ( " USE_LOCAL_DEPS " )
148- let attributeGraphCondition = envBoolValue ( " ATTRIBUTEGRAPH " , default: buildForDarwinPlatform && !isSPIBuild)
148+ let computeCondition = envBoolValue ( " OPENATTRIBUTESHIMS_COMPUTE " , default: false )
149+ let attributeGraphCondition = envBoolValue ( " OPENATTRIBUTESHIMS_ATTRIBUTEGRAPH " , default: buildForDarwinPlatform && !isSPIBuild)
149150
150151// MARK: - Shared Settings
151152
@@ -228,6 +229,15 @@ extension Target {
228229 swiftSettings. append ( . define( " OPENATTRIBUTEGRAPH_ATTRIBUTEGRAPH " ) )
229230 self . swiftSettings = swiftSettings
230231 }
232+
233+ func addComputeBinarySettings( ) {
234+ dependencies. append (
235+ " Compute " ,
236+ )
237+ var swiftSettings = swiftSettings ?? [ ]
238+ swiftSettings. append ( . define( " OPENATTRIBUTEGRAPH_COMPUTE " ) )
239+ self . swiftSettings = swiftSettings
240+ }
231241}
232242
233243extension [ Platform ] {
@@ -371,29 +381,19 @@ let package = Package(
371381 cxxLanguageStandard: . cxx20
372382)
373383
374- if compatibilityTestCondition {
375- openAttributeGraphCompatibilityTestsTarget. addAGSettings ( )
376- } else {
377- package . targets += [
378- utilitiesTestsTarget,
379- openAttributeGraphCxxTestsTarget,
380- openAttributeGraphShimsTestsTarget,
381- ]
382- }
383-
384- if buildForDarwinPlatform {
385- package . targets. append ( openAttributeGraphCompatibilityTestsTarget)
386- }
384+ private var hasSetupDPFDependency = false
387385
388- if attributeGraphCondition {
386+ @MainActor
387+ func setupDPFDependency( ) {
388+ guard !hasSetupDPFDependency else { return }
389+ hasSetupDPFDependency = true
389390 let privateFrameworkRepo : Package . Dependency
390391 if useLocalDeps {
391392 privateFrameworkRepo = Package . Dependency. package ( path: " ../DarwinPrivateFrameworks " )
392393 } else {
393394 privateFrameworkRepo = Package . Dependency. package ( url: " https://github.com/OpenSwiftUIProject/DarwinPrivateFrameworks.git " , branch: " main " )
394395 }
395396 package . dependencies. append ( privateFrameworkRepo)
396- openAttributeGraphShimsTarget. addAGSettings ( )
397397
398398 let agVersion = EnvManager . shared. withDomain ( " DarwinPrivateFrameworks " ) {
399399 envIntValue ( " TARGET_RELEASE " , default: 2024 )
@@ -403,6 +403,44 @@ if attributeGraphCondition {
403403 case 2021 : [ . iOS( . v15) , . macOS( . v12) , . macCatalyst( . v15) , . tvOS( . v15) , . watchOS( . v7) ]
404404 default : nil
405405 }
406+ }
407+
408+ if compatibilityTestCondition {
409+ setupDPFDependency ( )
410+ openAttributeGraphCompatibilityTestsTarget. addAGSettings ( )
411+ } else {
412+ package . targets += [
413+ utilitiesTestsTarget,
414+ openAttributeGraphCxxTestsTarget,
415+ openAttributeGraphShimsTestsTarget,
416+ ]
417+ }
418+
419+ if buildForDarwinPlatform {
420+ package . targets. append ( openAttributeGraphCompatibilityTestsTarget)
421+ }
422+
423+ if computeCondition {
424+ let computeBinary = envBoolValue ( " OPENATTRIBUTESHIMS_COMPUTE_BINARY " , default: true )
425+ if computeBinary {
426+ let computeVersion = envStringValue ( " OPENATTRIBUTESHIMS_COMPUTE_BINARY_VERSION " , default: " 0.0.1 " )
427+ let computeURL = envStringValue ( " OPENATTRIBUTESHIMS_COMPUTE_BINARY_URL " , default: " https://github.com/Kyle-Ye/Compute/releases/download/ \( computeVersion) /Compute.xcframework.zip " )
428+ let computeChecksum = envStringValue ( " OPENATTRIBUTESHIMS_COMPUTE_BINARY_CHECKSUM " , default: " 95a256da2055d7c73184aeb9be088ba7019f7ea79b8a31e2dd930526c5ccbe8f " )
429+ package . targets. append (
430+ . binaryTarget(
431+ name: " Compute " ,
432+ url: computeURL,
433+ checksum: computeChecksum
434+ ) ,
435+ )
436+ openAttributeGraphShimsTarget. addComputeBinarySettings ( )
437+ } else {
438+ // TODO
439+ }
440+ package . platforms = [ . iOS( . v18) , . macOS( . v15) , . macCatalyst( . v18) , . tvOS( . v18) , . watchOS( . v10) , . visionOS( . v2) ]
441+ } else if attributeGraphCondition {
442+ setupDPFDependency ( )
443+ openAttributeGraphShimsTarget. addAGSettings ( )
406444} else {
407445 openAttributeGraphShimsTarget. dependencies. append ( . target( name: openAttributeGraphTarget. name) )
408446 package . platforms = [ . iOS( . v13) , . macOS( . v10_15) , . macCatalyst( . v13) , . tvOS( . v13) , . watchOS( . v5) ]
0 commit comments