-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.sh
More file actions
executable file
·61 lines (51 loc) · 1.99 KB
/
Copy pathupdate.sh
File metadata and controls
executable file
·61 lines (51 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
set -e # Exit on error
# Remove previously generated code
echo "Removing old generated client code..."
rm -rf ./client
# Try to download the OpenAPI spec from the running FastComments server
if wget -q http://localhost:3001/js/swagger.json -O ./openapi.json.tmp; then
mv ./openapi.json.tmp ./openapi.json
echo "✓ Downloaded OpenAPI spec from running server"
else
rm -f ./openapi.json.tmp
echo "⚠ Server not running, using existing OpenAPI spec"
fi
SPEC_FILE="./openapi.json"
# Generate the Swift client using openapi-generator
echo "Generating Swift client..."
GENERATOR_JAR="/home/winrid/dev/fastcomments/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar"
java -jar "$GENERATOR_JAR" generate \
-i "$SPEC_FILE" \
-g swift6 \
-o ./client \
-c config.json
if [ $? -eq 0 ]; then
echo "✓ Generated Swift client in ./client"
else
echo "✗ Client generation failed!"
exit 1
fi
# Re-apply hand-patched infrastructure files that the generator overwrites. The
# `rm -rf ./client` + regen above wipes .openapi-generator-ignore and the files it
# protects, so restore them from git here. This keeps the presence-tracking cookie patch
# in URLSessionImplementations.swift (ephemeral config, cookies disabled) from being
# silently reverted on every regen. See client/.openapi-generator-ignore.
echo "Restoring hand-patched infrastructure files..."
git checkout -- ./client/.openapi-generator-ignore ./client/FastCommentsSwift/Infrastructure/URLSessionImplementations.swift
# Remove files that prevent Swift Package from including client directory
echo "Cleaning up generated files..."
rm -f ./client/.gitignore
rm -f ./client/Package.swift
echo "Building Swift package..."
swift build
if [ $? -eq 0 ]; then
echo "✓ Swift SDK built successfully!"
else
echo "✗ Build failed!"
exit 1
fi
echo ""
echo "======================================"
echo "✓ FastComments Swift SDK is ready!"
echo "======================================"