Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ DerivedData/
.netrc
coverage.txt
TODO.md
template.swiftinterface
.ag_template/
4 changes: 2 additions & 2 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ if swiftToolchainSupported {
// MARK: - [env] OPENGRAPH_TARGET_RELEASE

let releaseVersion = Context.environment["OPENGRAPH_TARGET_RELEASE"].flatMap { Int($0) } ?? 2024
sharedCSettings.append(.define("OPENGRAPH_RELEASE", to: "\(releaseVersion)"))
//sharedCSettings.append(.define("OPENGRAPH_RELEASE", to: "\(releaseVersion)"))
sharedSwiftSettings.append(.define("OPENGRAPH_RELEASE_\(releaseVersion)"))
if releaseVersion >= 2021 {
for year in 2021 ... releaseVersion {
Expand Down
23 changes: 0 additions & 23 deletions Scripts/gen_ag_interface_template.sh

This file was deleted.

56 changes: 56 additions & 0 deletions Scripts/gen_ag_template.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/zsh

# A `realpath` alternative using the default C implementation.
filepath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}

gen_interface() {
swift build -c release -Xswiftc -emit-module-interface -Xswiftc -enable-library-evolution -Xswiftc -no-verify-emitted-module-interface -Xswiftc -package-name -Xswiftc OpenGraph -Xswiftc -Osize

mkdir -p .ag_template
cp .build/release/Modules/OpenGraph.swiftinterface .ag_template/template.swiftinterface

sed -i '' '1,4d' .ag_template/template.swiftinterface
sed -i '' 's/@_exported public import OpenGraphCxx/@_exported public import AttributeGraph/g' .ag_template/template.swiftinterface
sed -i '' 's/OpenGraphCxx\.//g' .ag_template/template.swiftinterface
sed -i '' 's/OpenGraph/AttributeGraph/g' .ag_template/template.swiftinterface
sed -i '' 's/OPENGRAPH/ATTRIBUTEGRAPH/g' .ag_template/template.swiftinterface
sed -i '' 's/OG/AG/g' .ag_template/template.swiftinterface

echo "Generated template.swiftinterface successfully"
}

gen_header() {
mkdir -p .ag_template/Headers

cp -r Sources/OpenGraphCxx/include/OpenGraph/* .ag_template/Headers/

# Rename files from OGxx to AGxx and OpenGraphxx to AttributeGraphxx
find .ag_template/Headers -name "OG*" -type f | while read file; do
new_name=$(echo "$file" | sed 's/OG/AG/g')
mv "$file" "$new_name"
done

find .ag_template/Headers -name "OpenGraph*" -type f | while read file; do
new_name=$(echo "$file" | sed 's/OpenGraph/AttributeGraph/g')
mv "$file" "$new_name"
done

# Update content in all header files
find .ag_template/Headers -name "*.h" -type f | while read file; do
sed -i '' 's/OpenGraphCxx/AttributeGraph/g' "$file"
sed -i '' 's/OpenGraph/AttributeGraph/g' "$file"
sed -i '' 's/OPENGRAPH/ATTRIBUTEGRAPH/g' "$file"
sed -i '' 's/OG/AG/g' "$file"
done

echo "Generated template headers successfully"
}

OPENGRAPH_ROOT="$(dirname $(dirname $(filepath $0)))"

cd $OPENGRAPH_ROOT

gen_interface
gen_header
11 changes: 4 additions & 7 deletions Sources/OpenGraph/Export.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
@_exported public import OpenGraphCxx
//
// Export.swift
// OpenGraph

// Align the constant define behavior
#if OPENGRAPH_RELEASE_2024
public let OPENGRAPH_RELEASE: Int32 = 2024
#elseif OPENGRAPH_RELEASE_2021
public let OPENGRAPH_RELEASE: Int32 = 2021
#endif
@_exported public import OpenGraphCxx
5 changes: 1 addition & 4 deletions Sources/OpenGraphCxx/Attribute/AttributeType.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
//
// OGAttributeType.cpp
//
//
// Created by Kyle on 2024/2/17.
//
// OpenGraphCxx

#include <OpenGraph/OGAttributeType.h>
5 changes: 1 addition & 4 deletions Sources/OpenGraphCxx/Attribute/OGAttribute.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//
// OGAttribute.cpp
//
//
// Created by Kyle on 2024/2/16.
//
// OpenGraphCxx

#include <OpenGraph/OGAttribute.h>
#include <OpenGraphCxx/Attribute/AttributeID.hpp>
Expand Down
5 changes: 1 addition & 4 deletions Sources/OpenGraphCxx/Attribute/OGWeakAttribute.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//
// OGWeakAttribute.cpp
//
//
// Created by Kyle on 2024/2/27.
//
// OpenGraphCxx

#include <OpenGraph/OGWeakAttribute.h>

Expand Down
5 changes: 1 addition & 4 deletions Sources/OpenGraphCxx/Data/ClosureFunction.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
//
// ClosureFunction.cpp
//
//
// Created by Kyle on 2024/3/6.
//
// OpenGraphCxx

#include <OpenGraphCxx/Data/ClosureFunction.hpp>
5 changes: 1 addition & 4 deletions Sources/OpenGraphCxx/DebugServer/OGDebugServer.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//
// OGDebugServer.cpp
//
//
// Created by Kyle on 2024/2/17.
//
// OpenGraphCxx

#include <OpenGraph/OGDebugServer.h>
#include <OpenGraphCxx/DebugServer/og-debug-server.hpp>
Expand Down
3 changes: 1 addition & 2 deletions Sources/OpenGraphCxx/DebugServer/og-debug-server.mm
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
//
// og-debug-server.mm
// OpenGraph
// OpenGraphCxx
//
// Created by Kyle on 2024/1/11.
// Audited for 2021 Release

#include <OpenGraphCxx/DebugServer/og-debug-server.hpp>
Expand Down
5 changes: 1 addition & 4 deletions Sources/OpenGraphCxx/Graph/GraphContext.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//
// GraphContext.cpp
//
//
// Created by Kyle on 2024/2/16.
//
// OpenGraphCxx

#include <OpenGraphCxx/Graph/Graph.hpp>
#include <OpenGraph/OGGraph.h>
Expand Down
5 changes: 1 addition & 4 deletions Sources/OpenGraphCxx/Graph/OGGraph.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//
// OGGraph.cpp
//
//
// Created by Kyle on 2024/2/15.
//
// OpenGraphCxx

#include <OpenGraph/OGGraph.h>
#include <OpenGraphCxx/Graph/Graph.hpp>
Expand Down
5 changes: 1 addition & 4 deletions Sources/OpenGraphCxx/Graph/OGGraphContext.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//
// OGGraphContext.cpp
//
//
// Created by Kyle on 2024/2/16.
//
// OpenGraphCxx

#include <OpenGraph/OGGraphContext.h>
#include <OpenGraph/Private/CFRuntime.h>
Expand Down
5 changes: 1 addition & 4 deletions Sources/OpenGraphCxx/Graph/OGSubgraph.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//
// OGSubgraph.cpp
//
//
// Created by Kyle on 2024/2/15.
//
// OpenGraphCxx

#include <OpenGraph/OGSubgraph.h>
#include <OpenGraph/OGGraph.h>
Expand Down
5 changes: 1 addition & 4 deletions Sources/OpenGraphCxx/Graph/Subgraph.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//
// Subgraph.cpp
//
//
// Created by Kyle on 2024/2/15.
//
// OpenGraphCxx

#include <OpenGraphCxx/Graph/Subgraph.hpp>
#include <OpenGraph/OGSubgraph.h>
Expand Down
5 changes: 1 addition & 4 deletions Sources/OpenGraphCxx/Graph/Subgraph.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//
// Subgraph.hpp
//
//
// Created by Kyle on 2024/2/15.
//
// OpenGraphCxx

#ifndef Subgraph_hpp
#define Subgraph_hpp
Expand Down
5 changes: 1 addition & 4 deletions Sources/OpenGraphCxx/Util/assert.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//
// assert.cpp
//
//
// Created by Kyle on 2024/1/21.
//
// OpenGraphCxx

#include <OpenGraphCxx/Util/assert.hpp>
#include <OpenGraphCxx/Util/log.hpp>
Expand Down
3 changes: 1 addition & 2 deletions Sources/OpenGraphCxx/Util/log.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
//
// OGLog.cpp
// OpenGraph
// OpenGraphCxx
//
// Created by Kyle on 2024/1/12.
// Audited for 2021 Release

#include <OpenGraphCxx/Util/log.hpp>
Expand Down
5 changes: 1 addition & 4 deletions Sources/OpenGraphCxx/Util/realloc_vector.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//
// realloc_vector.cpp
//
//
// Created by Kyle on 2024/1/17.
//
// OpenGraphCxx

#include <OpenGraphCxx/Util/realloc_vector.hpp>
#include <OpenGraphCxx/Util/assert.hpp>
Expand Down
5 changes: 1 addition & 4 deletions Sources/OpenGraphCxx/include/OpenGraph/OGAttributeInfo.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//
// OGAttributeInfo.h
//
//
// Created by Kyle on 2024/2/17.
//
// OpenGraphCxx

#ifndef OGAttributeInfo_h
#define OGAttributeInfo_h
Expand Down
8 changes: 4 additions & 4 deletions Sources/OpenGraphCxx/include/OpenGraph/OGUniqueID.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//
// OGMakeUniqueID.h
// OGUniqueID.h
// OpenGraphCxx
//
// Audited for iOS 18.0
// Status: Complete

#ifndef OGMakeUniqueID_h
#define OGMakeUniqueID_h
#ifndef OGUniqueID_h
#define OGUniqueID_h

#include <OpenGraph/OGBase.h>
typedef long OGUniqueID;
Expand All @@ -17,4 +17,4 @@ OG_REFINED_FOR_SWIFT
OGUniqueID OGMakeUniqueID(void) OG_SWIFT_NAME(makeUniqueID());
OG_EXTERN_C_END

#endif /* OGMakeUniqueID_h */
#endif /* OGUniqueID_h */
2 changes: 2 additions & 0 deletions Sources/OpenGraphCxx/include/OpenGraph/OGVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#include <OpenGraph/OGBase.h>

#define OPENGRAPH_RELEASE 2024

#define OPENGRAPH_RELEASE_2021 2021
#define OPENGRAPH_RELEASE_2024 2024

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//
// AttributeID.hpp
//
//
// Created by Kyle on 2024/2/16.
//
// OpenGraphCxx

#ifndef AttributeID_hpp
#define AttributeID_hpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//
// ClosureFunction.hpp
//
//
// Created by Kyle on 2024/3/6.
//
// OpenGraphCxx

#ifndef ClosureFunction_hpp
#define ClosureFunction_hpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
//
// og-debug-server.hpp
// OpenGraphCxx
//
//
// Created by Kyle on 2024/1/11.
// Audited for 2021 Release

#ifndef og_debug_server_hpp
Expand Down
5 changes: 1 addition & 4 deletions Sources/OpenGraphCxx/include/OpenGraphCxx/Graph/Subgraph.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//
// Subgraph.hpp
//
//
// Created by Kyle on 2024/2/15.
//
// OpenGraphCxx

#ifndef Subgraph_hpp
#define Subgraph_hpp
Expand Down
5 changes: 1 addition & 4 deletions Sources/OpenGraphCxx/include/OpenGraphCxx/Util/env.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//
// env.hpp
//
//
// Created by Kyle on 2024/4/4.
//
// OpenGraphCxx

#ifndef env_hpp
#define env_hpp
Expand Down
3 changes: 1 addition & 2 deletions Sources/OpenGraphCxx/include/OpenGraphCxx/Util/log.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
//
// log.hpp
// OpenGraphCxx
//
//
// Created by Kyle on 2024/1/12.
// Audited for 2021 Release

#ifndef log_hpp
Expand Down
Loading