Skip to content

Commit 4abe59b

Browse files
authored
Add gen_ag_interface_template.sh (#116)
1 parent e3aa7aa commit 4abe59b

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Scripts/gen_ag_interface_template.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/zsh
2+
3+
# A `realpath` alternative using the default C implementation.
4+
filepath() {
5+
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
6+
}
7+
8+
OPENGRAPH_ROOT="$(dirname $(dirname $(filepath $0)))"
9+
10+
cd $OPENGRAPH_ROOT
11+
12+
# Build the swiftinterface file
13+
./Scripts/build_swiftinterface.sh
14+
15+
# Copy to template file
16+
cp .build/debug/OpenGraph.build/OpenGraph.swiftinterface ./template.swiftinterface
17+
18+
# Process the template file
19+
# 1. Remove the first 5 lines
20+
# 2. Remove all references of "OpenGraph_SPI."
21+
# 3. Replace all references of "OpenGraph" to "AttributeGraph"
22+
# 4. Replace all references of "OG" to "AG"
23+
sed -i '' '1,5d' ./template.swiftinterface
24+
sed -i '' 's/OpenGraph_SPI\.//g' ./template.swiftinterface
25+
sed -i '' 's/OpenGraph/AttributeGraph/g' ./template.swiftinterface
26+
sed -i '' 's/OG/AG/g' ./template.swiftinterface
27+
28+
echo "Generated template.swiftinterface successfully"
29+

0 commit comments

Comments
 (0)