-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathci
More file actions
executable file
·121 lines (98 loc) · 3.77 KB
/
Copy pathci
File metadata and controls
executable file
·121 lines (98 loc) · 3.77 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/usr/bin/env bash
command_name="$1"
case $command_name in
generate_docs)
# Optional parameter for hosting base path (used by CI)
HOSTING_BASE_PATH="${2:-}"
echo "Generating combined DocC documentation for PayPal iOS SDK..."
# Create output directory
mkdir -p docs archives
rm -rf ./DerivedData
# Modules to generate documentation for
MODULES=("CorePayments" "CardPayments" "PaymentButtons" "PayPalWebPayments" "FraudProtection")
# Build documentation archives for each module
echo ""
echo "Building documentation archives for each module..."
echo ""
for module in "${MODULES[@]}"; do
echo "================================================"
echo "Building documentation archive for $module..."
echo "================================================"
# Build documentation for this module
xcodebuild docbuild \
-scheme "$module" \
-destination 'generic/platform=iOS Simulator' \
-derivedDataPath ./DerivedData
# Find the .doccarchive for this module
ARCHIVE=$(find ./DerivedData -name "*.doccarchive" -type d | head -n 1)
if [ -z "$ARCHIVE" ]; then
echo "❌ Error: No .doccarchive found for $module"
rm -rf ./DerivedData archives
exit 1
fi
# Save the archive
cp -R "$ARCHIVE" "archives/$module.doccarchive"
echo "✅ $module archive saved"
# Clean up DerivedData for next module
rm -rf ./DerivedData
echo ""
done
# Merge all archives into a combined archive
echo "================================================"
echo "Merging all documentation archives..."
echo "================================================"
xcrun docc merge \
archives/CorePayments.doccarchive \
archives/CardPayments.doccarchive \
archives/PaymentButtons.doccarchive \
archives/PayPalWebPayments.doccarchive \
archives/FraudProtection.doccarchive \
--output-path archives/PayPal.doccarchive \
--synthesized-landing-page-name "PayPal iOS SDK"
if [ ! -d "archives/PayPal.doccarchive" ]; then
echo "❌ Error: Failed to merge documentation archives"
rm -rf archives
exit 1
fi
echo "✅ Documentation archives merged successfully"
echo ""
# Convert merged archive to static HTML
echo "================================================"
echo "Converting to static HTML..."
echo "================================================"
# Build transform command with optional hosting base path
TRANSFORM_CMD="xcrun docc process-archive transform-for-static-hosting archives/PayPal.doccarchive --output-path docs"
if [ -n "$HOSTING_BASE_PATH" ]; then
TRANSFORM_CMD="$TRANSFORM_CMD --hosting-base-path $HOSTING_BASE_PATH"
fi
eval $TRANSFORM_CMD
# Clean up archives
rm -rf archives
echo "================================================"
echo "✅ Documentation generated successfully!"
echo "================================================"
echo ""
echo "Documentation landing page: ./docs/documentation/index.html"
echo ""
echo "To view documentation:"
echo " 1. Run: ./ci serve_docs"
echo " 2. Open: http://localhost:8000/documentation/"
;;
serve_docs)
echo "Starting local web server to view documentation..."
echo ""
echo "Documentation will be available at:"
echo " http://localhost:8000/index.html"
echo ""
echo "Press Ctrl+C to stop the server"
echo ""
cd docs && python3 -m http.server 8000
;;
*)
echo "Usage: ./ci <command>"
echo ""
echo "Available commands:"
echo " generate_docs Generate DocC reference documentation locally"
echo " serve_docs Start a local web server to view the documentation"
;;
esac