From acbee3c7c30cac49d64a8f619f3e3856a4e943f8 Mon Sep 17 00:00:00 2001 From: Kyle Date: Mon, 22 Apr 2024 01:16:37 +0800 Subject: [PATCH] Add OGGraph.descriptionFormat API (#69) * Add OGGraph.descriptionFormat API * Fix Linux build issue --- .../Headers/AGGraphDescription.h | 24 +++++++++++++++++++ .../Headers/AttributeGraph-umbrella.h | 1 + .../Headers/AGGraphDescription.h | 24 +++++++++++++++++++ .../Headers/AttributeGraph-umbrella.h | 1 + .../Headers/AGGraphDescription.h | 24 +++++++++++++++++++ .../Headers/AttributeGraph-umbrella.h | 1 + AG/Sources/Headers/AGGraphDescription.h | 24 +++++++++++++++++++ AG/Sources/Headers/AttributeGraph-umbrella.h | 1 + Sources/_OpenGraph/Debug/og-debug-server.mm | 2 +- Sources/_OpenGraph/Graph/GraphDescription.hpp | 20 ---------------- Sources/_OpenGraph/Graph/GraphDescription.mm | 2 +- Sources/_OpenGraph/Graph/OGGraphDescription.h | 24 +++++++++++++++++++ Sources/_OpenGraph/OGBase.h | 5 ++-- .../_OpenGraph/include/OGGraphDescription.h | 1 + .../Graph/GraphDescriptionTests.swift | 14 +++++++++++ 15 files changed, 143 insertions(+), 25 deletions(-) create mode 100644 AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGGraphDescription.h create mode 100644 AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGGraphDescription.h create mode 100644 AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGGraphDescription.h create mode 100644 AG/Sources/Headers/AGGraphDescription.h delete mode 100644 Sources/_OpenGraph/Graph/GraphDescription.hpp create mode 100644 Sources/_OpenGraph/Graph/OGGraphDescription.h create mode 120000 Sources/_OpenGraph/include/OGGraphDescription.h create mode 100644 Tests/OpenGraphCompatibilityTests/Graph/GraphDescriptionTests.swift diff --git a/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGGraphDescription.h b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGGraphDescription.h new file mode 100644 index 0000000..587f8b6 --- /dev/null +++ b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGGraphDescription.h @@ -0,0 +1,24 @@ +// +// AGGraphDescription.h +// +// +// Created by Kyle on 2024/1/21. +// + +#ifndef AGGraphDescription_h +#define AGGraphDescription_h + +#include "AGBase.h" + +AG_ASSUME_NONNULL_BEGIN + +#if AG_OBJC_FOUNDATION +AG_EXTERN_C_BEGIN +AG_EXPORT +CFStringRef AGDescriptionFormat AG_SWIFT_NAME(AGGraphRef.descriptionFormat); +AG_EXTERN_C_END +#endif + +AG_ASSUME_NONNULL_END + +#endif /* AGGraphDescription_h */ diff --git a/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h index 5c6eeeb..518abe6 100644 --- a/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h +++ b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h @@ -20,6 +20,7 @@ #include "AGDebugServer.h" #include "AGGraph.h" #include "AGGraphContext.h" +#include "AGGraphDescription.h" #include "AGInputOptions.h" #include "AGSearchOptions.h" #include "AGSubgraph.h" diff --git a/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGGraphDescription.h b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGGraphDescription.h new file mode 100644 index 0000000..587f8b6 --- /dev/null +++ b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGGraphDescription.h @@ -0,0 +1,24 @@ +// +// AGGraphDescription.h +// +// +// Created by Kyle on 2024/1/21. +// + +#ifndef AGGraphDescription_h +#define AGGraphDescription_h + +#include "AGBase.h" + +AG_ASSUME_NONNULL_BEGIN + +#if AG_OBJC_FOUNDATION +AG_EXTERN_C_BEGIN +AG_EXPORT +CFStringRef AGDescriptionFormat AG_SWIFT_NAME(AGGraphRef.descriptionFormat); +AG_EXTERN_C_END +#endif + +AG_ASSUME_NONNULL_END + +#endif /* AGGraphDescription_h */ diff --git a/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h index 5c6eeeb..518abe6 100644 --- a/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h +++ b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h @@ -20,6 +20,7 @@ #include "AGDebugServer.h" #include "AGGraph.h" #include "AGGraphContext.h" +#include "AGGraphDescription.h" #include "AGInputOptions.h" #include "AGSearchOptions.h" #include "AGSubgraph.h" diff --git a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGGraphDescription.h b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGGraphDescription.h new file mode 100644 index 0000000..587f8b6 --- /dev/null +++ b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGGraphDescription.h @@ -0,0 +1,24 @@ +// +// AGGraphDescription.h +// +// +// Created by Kyle on 2024/1/21. +// + +#ifndef AGGraphDescription_h +#define AGGraphDescription_h + +#include "AGBase.h" + +AG_ASSUME_NONNULL_BEGIN + +#if AG_OBJC_FOUNDATION +AG_EXTERN_C_BEGIN +AG_EXPORT +CFStringRef AGDescriptionFormat AG_SWIFT_NAME(AGGraphRef.descriptionFormat); +AG_EXTERN_C_END +#endif + +AG_ASSUME_NONNULL_END + +#endif /* AGGraphDescription_h */ diff --git a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h index 5c6eeeb..518abe6 100644 --- a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h +++ b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AttributeGraph-umbrella.h @@ -20,6 +20,7 @@ #include "AGDebugServer.h" #include "AGGraph.h" #include "AGGraphContext.h" +#include "AGGraphDescription.h" #include "AGInputOptions.h" #include "AGSearchOptions.h" #include "AGSubgraph.h" diff --git a/AG/Sources/Headers/AGGraphDescription.h b/AG/Sources/Headers/AGGraphDescription.h new file mode 100644 index 0000000..587f8b6 --- /dev/null +++ b/AG/Sources/Headers/AGGraphDescription.h @@ -0,0 +1,24 @@ +// +// AGGraphDescription.h +// +// +// Created by Kyle on 2024/1/21. +// + +#ifndef AGGraphDescription_h +#define AGGraphDescription_h + +#include "AGBase.h" + +AG_ASSUME_NONNULL_BEGIN + +#if AG_OBJC_FOUNDATION +AG_EXTERN_C_BEGIN +AG_EXPORT +CFStringRef AGDescriptionFormat AG_SWIFT_NAME(AGGraphRef.descriptionFormat); +AG_EXTERN_C_END +#endif + +AG_ASSUME_NONNULL_END + +#endif /* AGGraphDescription_h */ diff --git a/AG/Sources/Headers/AttributeGraph-umbrella.h b/AG/Sources/Headers/AttributeGraph-umbrella.h index 5c6eeeb..518abe6 100644 --- a/AG/Sources/Headers/AttributeGraph-umbrella.h +++ b/AG/Sources/Headers/AttributeGraph-umbrella.h @@ -20,6 +20,7 @@ #include "AGDebugServer.h" #include "AGGraph.h" #include "AGGraphContext.h" +#include "AGGraphDescription.h" #include "AGInputOptions.h" #include "AGSearchOptions.h" #include "AGSubgraph.h" diff --git a/Sources/_OpenGraph/Debug/og-debug-server.mm b/Sources/_OpenGraph/Debug/og-debug-server.mm index a34b5c9..ef61f96 100644 --- a/Sources/_OpenGraph/Debug/og-debug-server.mm +++ b/Sources/_OpenGraph/Debug/og-debug-server.mm @@ -10,7 +10,7 @@ #include "../Util/log.hpp" #include "../Util/assert.hpp" -#include "../Graph/GraphDescription.hpp" +#include "../Graph/OGGraphDescription.h" #include "../Graph/Graph.hpp" #include diff --git a/Sources/_OpenGraph/Graph/GraphDescription.hpp b/Sources/_OpenGraph/Graph/GraphDescription.hpp deleted file mode 100644 index 303c5d1..0000000 --- a/Sources/_OpenGraph/Graph/GraphDescription.hpp +++ /dev/null @@ -1,20 +0,0 @@ -// -// GraphDescription.hpp -// -// -// Created by Kyle on 2024/1/21. -// - -#ifndef GraphDescription_hpp -#define GraphDescription_hpp - -#include "OGBase.h" - -#if OG_OBJC_FOUNDATION -OG_EXTERN_C_BEGIN -OG_EXPORT -CFStringRef OGDescriptionFormat; -OG_EXTERN_C_END -#endif - -#endif /* GraphDescription_hpp */ diff --git a/Sources/_OpenGraph/Graph/GraphDescription.mm b/Sources/_OpenGraph/Graph/GraphDescription.mm index 4c55c99..e578e2a 100644 --- a/Sources/_OpenGraph/Graph/GraphDescription.mm +++ b/Sources/_OpenGraph/Graph/GraphDescription.mm @@ -5,7 +5,7 @@ // Created by Kyle on 2024/1/21. // -#include "GraphDescription.hpp" +#include "OGGraphDescription.h" #include "OGGraph.h" #include "Graph.hpp" #include "../Util/assert.hpp" diff --git a/Sources/_OpenGraph/Graph/OGGraphDescription.h b/Sources/_OpenGraph/Graph/OGGraphDescription.h new file mode 100644 index 0000000..4e12a2a --- /dev/null +++ b/Sources/_OpenGraph/Graph/OGGraphDescription.h @@ -0,0 +1,24 @@ +// +// OGGraphDescription.h +// +// +// Created by Kyle on 2024/1/21. +// + +#ifndef OGGraphDescription_h +#define OGGraphDescription_h + +#include "OGBase.h" + +OG_ASSUME_NONNULL_BEGIN + +#if OG_OBJC_FOUNDATION +OG_EXTERN_C_BEGIN +OG_EXPORT +CFStringRef OGDescriptionFormat OG_SWIFT_NAME(OGGraphRef.descriptionFormat); +OG_EXTERN_C_END +#endif + +OG_ASSUME_NONNULL_END + +#endif /* OGGraphDescription_h */ diff --git a/Sources/_OpenGraph/OGBase.h b/Sources/_OpenGraph/OGBase.h index 40553c4..aa03849 100644 --- a/Sources/_OpenGraph/OGBase.h +++ b/Sources/_OpenGraph/OGBase.h @@ -60,9 +60,8 @@ #define OG_EXTERN_C_END CF_EXTERN_C_END #define OG_ASSUME_NONNULL_BEGIN CF_ASSUME_NONNULL_BEGIN #define OG_ASSUME_NONNULL_END CF_ASSUME_NONNULL_END -// TODO -//#define OG_IMPLICIT_BRIDGING_ENABLED CF_IMPLICIT_BRIDGING_ENABLED -//#define OG_IMPLICIT_BRIDGING_DISABLED CF_IMPLICIT_BRIDGING_DISABLED +#define OG_IMPLICIT_BRIDGING_ENABLED CF_IMPLICIT_BRIDGING_ENABLED +#define OG_IMPLICIT_BRIDGING_DISABLED CF_IMPLICIT_BRIDGING_DISABLED #define OG_EXPORT CF_EXPORT #define OG_BRIDGED_TYPE CF_BRIDGED_TYPE diff --git a/Sources/_OpenGraph/include/OGGraphDescription.h b/Sources/_OpenGraph/include/OGGraphDescription.h new file mode 120000 index 0000000..3f8b9a3 --- /dev/null +++ b/Sources/_OpenGraph/include/OGGraphDescription.h @@ -0,0 +1 @@ +../Graph/OGGraphDescription.h \ No newline at end of file diff --git a/Tests/OpenGraphCompatibilityTests/Graph/GraphDescriptionTests.swift b/Tests/OpenGraphCompatibilityTests/Graph/GraphDescriptionTests.swift new file mode 100644 index 0000000..1d50868 --- /dev/null +++ b/Tests/OpenGraphCompatibilityTests/Graph/GraphDescriptionTests.swift @@ -0,0 +1,14 @@ +// +// GraphDescriptionTests.swift +// OpenGraphCompatibilityTests + +import Testing + +#if canImport(Darwin) +struct GraphDescriptionTests { + @Test + func format() { + #expect(OGGraph.descriptionFormat.takeUnretainedValue() as String == "format") + } +} +#endif