Skip to content

Commit 9526c3d

Browse files
committed
WIP
1 parent b15e089 commit 9526c3d

File tree

4 files changed

+83
-33
lines changed

4 files changed

+83
-33
lines changed

Sources/OpenAttributeGraphShims/Graph+Debug.swift

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,34 @@ import Foundation
88

99
@_spi(Debug)
1010
extension Graph {
11-
public var dict: [String: Any]? {
12-
let options = [
13-
DescriptionOption.format: Graph.descriptionFormatDictionary
14-
] as NSDictionary
15-
guard let description = Graph.description(nil, options: options) else {
16-
return nil
17-
}
18-
guard let dictionary = description as? NSDictionary else {
19-
return nil
20-
}
21-
return dictionary as? [String: Any]
22-
}
23-
24-
// style:
25-
// - bold: empty input/output edge
26-
// - dashed: indirect or has no value
27-
// color:
28-
// - red: is_changed
29-
public var dot: String? {
30-
let options = [
31-
DescriptionOption.format: Graph.descriptionFormatDot
32-
] as NSDictionary
33-
guard let description = Graph.description(self, options: options)
34-
else {
35-
return nil
36-
}
37-
return description as? String
38-
}
11+
// public var dict: [String: Any]? {
12+
// let options = [
13+
// DescriptionOption.format: Graph.descriptionFormatDictionary
14+
// ] as NSDictionary
15+
// guard let description = Graph.description(nil, options: options) else {
16+
// return nil
17+
// }
18+
// guard let dictionary = description as? NSDictionary else {
19+
// return nil
20+
// }
21+
// return dictionary as? [String: Any]
22+
// }
23+
//
24+
// // style:
25+
// // - bold: empty input/output edge
26+
// // - dashed: indirect or has no value
27+
// // color:
28+
// // - red: is_changed
29+
// public var dot: String? {
30+
// let options = [
31+
// DescriptionOption.format: Graph.descriptionFormatDot
32+
// ] as NSDictionary
33+
// guard let description = Graph.description(self, options: options)
34+
// else {
35+
// return nil
36+
// }
37+
// return description as? String
38+
// }
3939
}
4040

4141
#endif

Sources/OpenAttributeGraphShims/GraphShims.swift

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,56 @@
22
// GraphShims.swift
33
// OpenAttributeGraphShims
44

5-
#if OPENATTRIBUTEGRAPH_ATTRIBUTEGRAPH
5+
#if OPENATTRIBUTEGRAPH_COMPUTE
6+
7+
@_exported public import Compute
8+
9+
public typealias OAGAttributeInfo = AGAttributeInfo
10+
//public typealias OAGCachedValueOptions = AGCachedValueOptions
11+
public typealias OAGChangedValueFlags = AGChangedValueFlags
12+
public typealias OAGInputOptions = AGInputOptions
13+
//public typealias OAGValue = AGValue
14+
public typealias OAGValueOptions = AGValueOptions
15+
16+
17+
extension AnyAttribute {
18+
public typealias Flags = Subgraph.Flags
19+
}
20+
21+
extension AnyAttribute {
22+
public var subgraph2: Subgraph? { nil }
23+
}
24+
25+
26+
extension Subgraph {
27+
public typealias ChildFlags = AnyAttribute.Flags
28+
}
29+
30+
extension Graph {
31+
public func startProfiling() {
32+
33+
}
34+
35+
public func stopProfiling() {
36+
37+
}
38+
39+
public func resetProfile() {
40+
41+
}
42+
}
43+
44+
extension _AttributeBody {
45+
public typealias Flags = _AttributeType.Flags
46+
}
47+
48+
extension CachedValueOptions {
49+
public static var _1: CachedValueOptions = .unprefetched
50+
}
51+
52+
public let attributeGraphEnabled = true
53+
public let swiftToolchainSupported = true
54+
#elseif OPENATTRIBUTEGRAPH_ATTRIBUTEGRAPH
655
@_exported public import AttributeGraph
756
#if os(iOS) && !targetEnvironment(simulator)
857
@_exported public import _AttributeGraphDeviceSwiftShims

Tests/OpenAttributeGraphCompatibilityTests/Attribute/Attribute/AnyAttributeCompatibilityTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct AnyAttributeCompatibilityTests {
4646

4747
@Test
4848
func setFlags() throws {
49-
typealias Flags = AnyAttribute.Flags
49+
typealias Flags = Subgraph.Flags
5050

5151
let attribute = AnyAttribute(Attribute(value: 0))
5252
#expect(attribute.flags == [])
@@ -105,7 +105,7 @@ struct AnyAttributeCompatibilityTests {
105105
@Test
106106
func subgraph() {
107107
let identifier = Attribute(value: 0).identifier
108-
#expect(identifier.subgraph2 != nil)
108+
// #expect(identifier.subgraph2 != nil)
109109
}
110110

111111
@Test

Tests/OpenAttributeGraphCompatibilityTests/GraphShims.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
let compatibilityTestEnabled = false
99
#else
1010
@_exported public import AttributeGraph
11+
@_exported public import Compute
1112
#if os(iOS) && !targetEnvironment(simulator)
1213
@_exported public import _AttributeGraphDeviceSwiftShims
1314
#endif
1415
public typealias OAGAttributeInfo = AGAttributeInfo
15-
public typealias OAGCachedValueOptions = AGCachedValueOptions
16+
//public typealias OAGCachedValueOptions = AGCachedValueOptions
1617
public typealias OAGChangedValueFlags = AGChangedValueFlags
1718
public typealias OAGInputOptions = AGInputOptions
18-
public typealias OAGValue = AGValue
19+
//public typealias OAGValue = AGValue
1920
public typealias OAGValueOptions = AGValueOptions
2021
public let compatibilityTestEnabled = true
2122
#endif

0 commit comments

Comments
 (0)