@@ -146,7 +146,7 @@ let compatibilityTestCondition = envBoolValue("COMPATIBILITY_TEST", default: fal
146146
147147let useLocalDeps = envBoolValue ( " USE_LOCAL_DEPS " )
148148let computeCondition = envBoolValue ( " OPENATTRIBUTESHIMS_COMPUTE " , default: false )
149- let attributeGraphCondition = envBoolValue ( " OPENATTRIBUTESHIMS_ATTRIBUTEGRAPH " , default: buildForDarwinPlatform && !isSPIBuild )
149+ let attributeGraphCondition = envBoolValue ( " OPENATTRIBUTESHIMS_ATTRIBUTEGRAPH " , default: false )
150150
151151// MARK: - Shared Settings
152152
@@ -276,16 +276,14 @@ let swiftClonePlugin = Target.plugin(
276276// MARK: - Targets
277277
278278let platformTarget = Target . target (
279- // Avoid target collision with Compute package
280- name: " OpenAttributeGraphPlatform " ,
279+ name: " Platform " ,
281280 path: " Sources/Platform " ,
282281 cSettings: sharedCSettings + [
283282 . define( " _GNU_SOURCE " , . when( platforms: [ . linux] ) ) ,
284283 ]
285284)
286285let utilitiesTarget = Target . target (
287- // Avoid target collision with Compute package
288- name: " OpenAttributeGraphUtilities " ,
286+ name: " Utilities " ,
289287 dependencies: [
290288 . target( name: platformTarget. name) ,
291289 ] ,
@@ -372,20 +370,13 @@ let openAttributeGraphCompatibilityTestsTarget = Target.testTarget(
372370let package = Package (
373371 name: " OpenAttributeGraph " ,
374372 products: [
375- . library( name: " OpenAttributeGraph " , type: . dynamic, targets: [ openAttributeGraphTarget. name, openAttributeGraphCxxTarget. name] ) ,
376- . library( name: " OpenAttributeGraphShims " , type: . dynamic, targets: [ openAttributeGraphShimsTarget. name] ) ,
377- ] ,
378- dependencies: [
379- . package ( url: " https://github.com/apple/swift-numerics " , from: " 1.0.2 " ) ,
380- ] ,
381- targets: [
382- swiftClonePlugin,
383- platformTarget,
384- utilitiesTarget,
385- openAttributeGraphTarget,
386- openAttributeGraphCxxTarget,
387- openAttributeGraphShimsTarget,
373+ . library(
374+ name: " OpenAttributeGraphShims " ,
375+ type: . dynamic,
376+ targets: [ openAttributeGraphShimsTarget. name]
377+ )
388378 ] ,
379+ targets: [ openAttributeGraphShimsTarget] ,
389380 cxxLanguageStandard: . cxx20
390381)
391382
@@ -413,33 +404,18 @@ func setupDPFDependency() {
413404 }
414405}
415406
416- if compatibilityTestCondition {
417- setupDPFDependency ( )
418- openAttributeGraphCompatibilityTestsTarget. addAGSettings ( )
419- } else {
420- package . targets += [
421- utilitiesTestsTarget,
422- openAttributeGraphCxxTestsTarget,
423- openAttributeGraphShimsTestsTarget,
424- ]
425- }
426-
427- if buildForDarwinPlatform {
428- package . targets. append ( openAttributeGraphCompatibilityTestsTarget)
429- }
430-
431407if computeCondition {
432408 let computeBinary = envBoolValue ( " OPENATTRIBUTESHIMS_COMPUTE_USE_BINARY " , default: false )
433409 if computeBinary {
434- let computeVersion = envStringValue ( " OPENATTRIBUTESHIMS_COMPUTE_USE_BINARY_VERSION " , default: " 0.0.1 " )
410+ let version = envStringValue ( " OPENATTRIBUTESHIMS_COMPUTE_BINARY_VERSION " , default: " 0.0.1 " )
435411 // TODO: Use upstream link when avaiable. Tracked on https://github.com/jcmosc/Compute/issues/20
436- let computeURL = envStringValue ( " OPENATTRIBUTESHIMS_COMPUTE_USE_BINARY_URL " , default: " https://github.com/Kyle-Ye/Compute/releases/download/ \( computeVersion ) /Compute.xcframework.zip " )
437- let computeChecksum = envStringValue ( " OPENATTRIBUTESHIMS_COMPUTE_USE_BINARY_CHECKSUM " , default: " 95a256da2055d7c73184aeb9be088ba7019f7ea79b8a31e2dd930526c5ccbe8f " )
412+ let url = envStringValue ( " OPENATTRIBUTESHIMS_COMPUTE_BINARY_URL " , default: " https://github.com/Kyle-Ye/Compute/releases/download/ \( version ) /Compute.xcframework.zip " )
413+ let checksum = envStringValue ( " OPENATTRIBUTESHIMS_COMPUTE_USE_BINARY_CHECKSUM " , default: " 95a256da2055d7c73184aeb9be088ba7019f7ea79b8a31e2dd930526c5ccbe8f " )
438414 package . targets. append (
439415 . binaryTarget(
440416 name: " Compute " ,
441- url: computeURL ,
442- checksum: computeChecksum
417+ url: url ,
418+ checksum: checksum
443419 )
444420 )
445421 } else {
@@ -454,10 +430,51 @@ if computeCondition {
454430 }
455431 openAttributeGraphShimsTarget. addComputeSettings ( )
456432 package . platforms = [ . iOS( . v18) , . macOS( . v15) , . macCatalyst( . v18) , . tvOS( . v18) , . watchOS( . v10) , . visionOS( . v2) ]
457- } else if attributeGraphCondition {
433+ } else if attributeGraphCondition, buildForDarwinPlatform {
458434 setupDPFDependency ( )
459435 openAttributeGraphShimsTarget. addAGSettings ( )
460436} else {
437+ let oagBinary = envBoolValue ( " OPENATTRIBUTESHIMS_OAG_USE_BINARY " , default: false )
438+ if oagBinary {
439+ let version = envStringValue ( " OPENATTRIBUTESHIMS_OAG_BINARY_VERSION " , default: " 0.4.0 " )
440+ let url = envStringValue ( " OPENATTRIBUTESHIMS_OAG_BINARY_URL " , default: " https://github.com/OpenSwiftUIProject/OpenAttributeGraph/releases/download/ \( version) /OpenAttributeGraph.xcframework.zip " )
441+ let checksum = envStringValue ( " OPENATTRIBUTESHIMS_COMPUTE_USE_BINARY_CHECKSUM " , default: " a539f876625288d4af7c7d1dccc80fd8e936058791b8071e0d534f5ec1a8a068 " )
442+ let target = Target . binaryTarget (
443+ name: openAttributeGraphTarget. name,
444+ url: url,
445+ checksum: checksum
446+ )
447+ package . targets. append ( target)
448+ } else {
449+ package . targets. append ( contentsOf: [
450+ swiftClonePlugin,
451+ platformTarget,
452+ utilitiesTarget,
453+ openAttributeGraphTarget,
454+ openAttributeGraphCxxTarget,
455+ ] )
456+ }
461457 openAttributeGraphShimsTarget. dependencies. append ( . target( name: openAttributeGraphTarget. name) )
462- package . platforms = [ . iOS( . v13) , . macOS( . v10_15) , . macCatalyst( . v13) , . tvOS( . v13) , . watchOS( . v5) ]
458+
459+ if buildForDarwinPlatform {
460+ package . targets. append ( openAttributeGraphCompatibilityTestsTarget)
461+ package . dependencies. append (
462+ . package ( url: " https://github.com/apple/swift-numerics " , from: " 1.1.1 " )
463+ )
464+ }
465+
466+ package . products. append (
467+ . library( name: " OpenAttributeGraph " , type: . dynamic, targets: [ openAttributeGraphTarget. name, openAttributeGraphCxxTarget. name] )
468+ )
469+ if compatibilityTestCondition, buildForDarwinPlatform {
470+ setupDPFDependency ( )
471+ openAttributeGraphCompatibilityTestsTarget. addAGSettings ( )
472+ } else {
473+ package . targets += [
474+ utilitiesTestsTarget,
475+ openAttributeGraphCxxTestsTarget,
476+ openAttributeGraphShimsTestsTarget,
477+ ]
478+ package . platforms = [ . iOS( . v13) , . macOS( . v10_15) , . macCatalyst( . v13) , . tvOS( . v13) , . watchOS( . v5) ]
479+ }
463480}
0 commit comments