Skip to content

Commit 350a695

Browse files
committed
Add gen_ag_template script
1 parent 7231b47 commit 350a695

File tree

3 files changed

+35
-24
lines changed

3 files changed

+35
-24
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ DerivedData/
88
.netrc
99
coverage.txt
1010
TODO.md
11-
template.swiftinterface
11+
.ag_template/

Scripts/gen_ag_interface_template.sh

Lines changed: 0 additions & 23 deletions
This file was deleted.

Scripts/gen_ag_template.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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+
gen_interface() {
9+
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
10+
11+
mkdir -p .ag_template
12+
cp .build/release/Modules/OpenGraph.swiftinterface .ag_template/template.swiftinterface
13+
14+
sed -i '' '1,4d' .ag_template/template.swiftinterface
15+
sed -i '' 's/@_exported public import OpenGraphCxx/@_exported public import AttributeGraph/g' .ag_template/template.swiftinterface
16+
sed -i '' 's/OpenGraphCxx\.//g' .ag_template/template.swiftinterface
17+
sed -i '' 's/OpenGraph/AttributeGraph/g' .ag_template/template.swiftinterface
18+
sed -i '' 's/OPENGRAPH/ATTRIBUTEGRAPH/g' .ag_template/template.swiftinterface
19+
sed -i '' 's/OG/AG/g' .ag_template/template.swiftinterface
20+
21+
echo "Generated template.swiftinterface successfully"
22+
}
23+
24+
gen_header() {
25+
# TODO: Implement header generation
26+
echo "Generated template header successfully"
27+
}
28+
29+
OPENGRAPH_ROOT="$(dirname $(dirname $(filepath $0)))"
30+
31+
cd $OPENGRAPH_ROOT
32+
33+
gen_interface
34+
gen_header

0 commit comments

Comments
 (0)