-
Notifications
You must be signed in to change notification settings - Fork 129
171 lines (138 loc) · 5.58 KB
/
regenerate-docs.yml
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#!/bin/bash
set -e
# Since Docc doesn't support generating a single set of documentation
# for multiple modules, we create a temporary Swift package project.
# Swift package manager turns the different modules into a single module, which
# can then be processed by Docc.
TEMP_PROJECT_FOLDER=TempProject
TEMP_PROJECT_PATH=$TEMP_PROJECT_FOLDER/Adyen
FRAMEWORK_NAME=Adyen
DOCS_ROOT=docs
FINAL_DOCC_ARCHIVE_PATH=$DOCS_ROOT/docc_archive
rm -rf $TEMP_PROJECT_FOLDER
rm -rf $DOCS_ROOT
mkdir -p $DOCS_ROOT
mkdir -p $TEMP_PROJECT_FOLDER $TEMP_PROJECT_PATH $FINAL_DOCC_ARCHIVE_PATH
cd $TEMP_PROJECT_PATH
# Create a new Swift Package.
swift package init
cd ../../
rsync -r Adyen $TEMP_PROJECT_PATH/Sources/$FRAMEWORK_NAME
rsync -r AdyenActions $TEMP_PROJECT_PATH/Sources/$FRAMEWORK_NAME
rsync -r AdyenComponents $TEMP_PROJECT_PATH/Sources/$FRAMEWORK_NAME
rsync -r AdyenEncryption $TEMP_PROJECT_PATH/Sources/$FRAMEWORK_NAME
rsync -r AdyenCard $TEMP_PROJECT_PATH/Sources/$FRAMEWORK_NAME
rsync -r AdyenDropIn $TEMP_PROJECT_PATH/Sources/$FRAMEWORK_NAME
rsync -r AdyenSession $TEMP_PROJECT_PATH/Sources/$FRAMEWORK_NAME
rsync -r AdyenWeChatPay $TEMP_PROJECT_PATH/Sources/$FRAMEWORK_NAME
rsync -r AdyenSwiftUI $TEMP_PROJECT_PATH/Sources/$FRAMEWORK_NAME
rsync -r AdyenCashAppPay $TEMP_PROJECT_PATH/Sources/$FRAMEWORK_NAME
# Copy the Adyen.docc folder to the temp package source folder
cp -a $FRAMEWORK_NAME.docc $TEMP_PROJECT_PATH/Sources/$FRAMEWORK_NAME/$FRAMEWORK_NAME.docc
# Rename AdyenActions/Utilities/BundleSPMExtension.swift to AdyenActions/Utilities/ActionsBundleSPMExtension.swift
mv $TEMP_PROJECT_PATH/Sources/$FRAMEWORK_NAME/AdyenActions/Utilities/BundleSPMExtension.swift \
$TEMP_PROJECT_PATH/Sources/$FRAMEWORK_NAME/AdyenActions/Utilities/ActionsBundleSPMExtension.swift
# Rename Adyen/Utilities/BundleSPMExtension.swift to Adyen/Utilities/CoreBundleSPMExtension.swift
mv $TEMP_PROJECT_PATH/Sources/$FRAMEWORK_NAME/Adyen/Utilities/BundleSPMExtension.swift \
$TEMP_PROJECT_PATH/Sources/$FRAMEWORK_NAME/Adyen/Utilities/CoreBundleSPMExtension.swift
# Go back to Temp project root
cd $TEMP_PROJECT_PATH
echo "// swift-tools-version: 5.8
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: \"Adyen\",
defaultLocalization: \"en-us\",
platforms: [
.iOS(.v11)
],
products: [
.library(
name: \"Adyen\",
targets: [\"Adyen\"]
)
],
dependencies: [
.package(
name: \"Adyen3DS2\",
url: \"https://github.com/Adyen/adyen-3ds2-ios\",
.exact(Version(2, 4, 1))
),
.package(
name: \"AdyenNetworking\",
url: \"https://github.com/Adyen/adyen-networking-ios\",
.exact(Version(2, 0, 0))
),
.package(
name: \"AdyenWeChatPayInternal\",
url: \"https://github.com/Adyen/adyen-wechatpay-ios\",
.exact(Version(2, 1, 0))
),
.package(
name: \"PayKit\",
url: \"https://github.com/cashapp/cash-app-pay-ios-sdk\",
.exact(Version(0, 5, 1))
)
],
targets: [
.target(
name: \"Adyen\",
dependencies: [
.product(name: \"AdyenNetworking\", package: \"AdyenNetworking\"),
.product(name: \"Adyen3DS2\", package: \"Adyen3DS2\"),
.product(name: \"AdyenWeChatPayInternal\", package: \"AdyenWeChatPayInternal\"),
.product(name: \"PayKit\", package: \"PayKit\"),
.product(name: \"PayKitUI\", package: \"PayKit\")
],
exclude: [
\"Adyen/Info.plist\",
\"AdyenActions/Info.plist\",
\"AdyenComponents/Info.plist\",
\"AdyenDropIn/Info.plist\",
\"AdyenEncryption/Info.plist\",
\"AdyenSwiftUI/Info.plist\",
\"AdyenWeChatPay/Info.plist\",
\"AdyenCashAppPay/AdyenCashAppPay.docc\",
\"AdyenCard/Info.plist\",
\"AdyenCard/Utilities/Non SPM Bundle Extension\",
\"AdyenActions/Utilities/Non SPM Bundle Extension\",
\"Adyen/Utilities/Non SPM Bundle Extension\"
]
),
]
)
" > Package.swift
rm -rf Tests
swift package update
DERIVED_DATA_PATH=.build
PROJECT_NAME='Adyen'
DESTINATION='generic/platform=iOS'
# PIF SMP fix
swift package dump-pif > /dev/null || true
xcodebuild clean -scheme "$PROJECT_NAME" -destination "$DESTINATION" -skipPackagePluginValidation > /dev/null || true
# Generate the docc archive.
xcodebuild docbuild \
-scheme $PROJECT_NAME \
-destination $DESTINATION \
-configuration Release \
-derivedDataPath $DERIVED_DATA_PATH \
-skipPackagePluginValidation
# Go back to original project root
cd ../../
# Delete old DocC archive
rm -rf $FINAL_DOCC_ARCHIVE_PATH/$FRAMEWORK_NAME.doccarchive
# Move the new DocC archive to the its final place
mv $TEMP_PROJECT_PATH/$DERIVED_DATA_PATH/Build/Products/Release-iphoneos/$FRAMEWORK_NAME.doccarchive $FINAL_DOCC_ARCHIVE_PATH/$FRAMEWORK_NAME.doccarchive
# Generate the DocC html pages
$(xcrun --find docc) process-archive \
transform-for-static-hosting $FINAL_DOCC_ARCHIVE_PATH/$FRAMEWORK_NAME.doccarchive \
--output-path $DOCS_ROOT/html \
--hosting-base-path /adyen-ios/$LATEST_VERSION
# Clean up.
rm -rf $TEMP_PROJECT_FOLDER
REDIRECT_FOLDER=$DOCS_ROOT/redirect
mkdir -p $REDIRECT_FOLDER
cd $REDIRECT_FOLDER
echo "<head>
<meta http-equiv=\"Refresh\" content=\"0; url='/adyen-ios/$LATEST_VERSION/documentation/adyen'\" />
</head>" > index.html