-
Notifications
You must be signed in to change notification settings - Fork 6
/
update_version.sh
executable file
·117 lines (104 loc) · 5.93 KB
/
update_version.sh
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
#!/bin/zsh
VERSION="24.4.7"
# Update ROOT_URL
ROOT_URL=""
if [[ "$VERSION" == 7* ]]; then
ROOT_URL="https://rbsc.repositories.cloud.sap/nexus3/repository/maven73555000100900005862/com/sap/mobile/platform/client/hcp/sdk/ios"
sed "s#let root.*#let root = \"$ROOT_URL\"#" Package.swift > tmp.swift
mv tmp.swift Package.swift
elif [[ "$VERSION" == 6* ]]; then
ROOT_URL="https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900005307/com/sap/mobile/platform/client/hcp/sdk/ios"
sed "s#let root.*#let root = \"$ROOT_URL\"#" Package.swift > tmp.swift
mv tmp.swift Package.swift
elif [[ "$VERSION" == 8* ]]; then
ROOT_URL="https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900006843/com/sap/mobile/platform/client/hcp/sdk/ios"
sed "s#let root.*#let root = \"$ROOT_URL\"#" Package.swift > tmp.swift
mv tmp.swift Package.swift
elif [[ "$VERSION" == 9* ]]; then
ROOT_URL="https://rbsc.repositories.cloud.sap/nexus3/repository/maven73555000100900006345/ios"
#ROOT_URL="https://rbsc.repositories.cloud.sap/nexus3/repository/maven73555000100900006345/com/sap/mobile/platform/client/hcp/sdk/ios"
sed "s#let root.*#let root = \"$ROOT_URL\"#" Package.swift > tmp.swift
mv tmp.swift Package.swift
elif [[ "$VERSION" == 10* ]]; then
ROOT_URL="https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008062/ios"
sed "s#let root.*#let root = \"$ROOT_URL\"#" Package.swift > tmp.swift
mv tmp.swift Package.swift
elif [[ "$VERSION" == 24.4* ]]; then
ROOT_URL="https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios"
sed "s#let root.*#let root = \"$ROOT_URL\"#" Package.swift > tmp.swift
mv tmp.swift Package.swift
elif [[ "$VERSION" == 24.8* ]]; then
ROOT_URL="https://rbsc.repositories.cloud.sap/nexus3/repository/maven73555000100900007915/ios"
sed "s#let root.*#let root = \"$ROOT_URL\"#" Package.swift > tmp.swift
mv tmp.swift Package.swift
else
echo "ERROR !!!!"
fi
# Update swift-tools-version
if [[ "$VERSION" == 9* ]]; then
sed "s/.*swift-tools-version.*/\/\/ swift-tools-version:5.5/" Package.swift > tmp.swift
mv tmp.swift Package.swift
elif [[ "$VERSION" == 10* || "$VERSION" == 24.4* || "$VERSION" == 24.8* ]]; then
sed "s/.*swift-tools-version.*/\/\/ swift-tools-version:5.9/" Package.swift > tmp.swift
mv tmp.swift Package.swift
else
sed "s/.*swift-tools-version.*/\/\/ swift-tools-version:5.3/" Package.swift > tmp.swift
mv tmp.swift Package.swift
fi
# Update version
sed "s#let version.*#let version = \"$VERSION\"#" Package.swift > tmp.swift
mv tmp.swift Package.swift
# Update platforms
if [[ "$VERSION" == 7* || "$VERSION" == 8* ]]; then
sed "s/.*platforms.*/ platforms: [.iOS(.v14)],/" Package.swift > tmp.swift
mv tmp.swift Package.swift
elif [[ "$VERSION" == 9* ]]; then
sed "s/.*platforms.*/ platforms: [.iOS(.v15)],/" Package.swift > tmp.swift
mv tmp.swift Package.swift
elif [[ "$VERSION" == 10* || "$VERSION" == 24.4* || "$VERSION" == 24.8* ]]; then
sed "s/.*platforms.*/ platforms: [.iOS(.v16)],/" Package.swift > tmp.swift
mv tmp.swift Package.swift
elif [[ "$VERSION" == 6* ]]; then
sed "s/.*platforms.*/ platforms: [.iOS(.v13)],/" Package.swift > tmp.swift
mv tmp.swift Package.swift
else
echo "ERROR !!!!"
fi
# Compute checksums
echo "Downloading: $ROOT_URL/SAPCommon/$VERSION/SAPCommon-$VERSION-Release.xcframework.zip"
curl -n -L -f $ROOT_URL/SAPCommon/$VERSION/SAPCommon-$VERSION-Release.xcframework.zip --output SAPCommon.zip
CHECKSUM=$(swift package compute-checksum SAPCommon.zip)
sed "s#let sapCommonChecksum.*#let sapCommonChecksum = \"$CHECKSUM\"#" Package.swift > tmp.swift
mv tmp.swift Package.swift
echo "Downloading: $ROOT_URL/SAPFiori/$VERSION/SAPFiori-$VERSION-Release.xcframework.zip"
curl -n -L -f $ROOT_URL/SAPFiori/$VERSION/SAPFiori-$VERSION-Release.xcframework.zip --output SAPFiori.zip
CHECKSUM=$(swift package compute-checksum SAPFiori.zip)
sed "s#let sapFioriChecksum.*#let sapFioriChecksum = \"$CHECKSUM\"#" Package.swift > tmp.swift
mv tmp.swift Package.swift
echo "Downloading: $ROOT_URL/SAPFioriFlows/$VERSION/SAPFioriFlows-$VERSION-Release.xcframework.zip"
curl -n -L -f $ROOT_URL/SAPFioriFlows/$VERSION/SAPFioriFlows-$VERSION-Release.xcframework.zip --output SAPFioriFlows.zip
CHECKSUM=$(swift package compute-checksum SAPFioriFlows.zip)
sed "s#let sapFioriFlowsChecksum.*#let sapFioriFlowsChecksum = \"$CHECKSUM\"#" Package.swift > tmp.swift
mv tmp.swift Package.swift
echo "Downloading: $ROOT_URL/SAPFoundation/$VERSION/SAPFoundation-$VERSION-Release.xcframework.zip"
curl -n -L -f $ROOT_URL/SAPFoundation/$VERSION/SAPFoundation-$VERSION-Release.xcframework.zip --output SAPFoundation.zip
CHECKSUM=$(swift package compute-checksum SAPFoundation.zip)
sed "s#let sapFoundationChecksum.*#let sapFoundationChecksum = \"$CHECKSUM\"#" Package.swift > tmp.swift
mv tmp.swift Package.swift
echo "Downloading: $ROOT_URL/SAPOData/$VERSION/SAPOData-$VERSION-Release.xcframework.zip"
curl -n -L -f $ROOT_URL/SAPOData/$VERSION/SAPOData-$VERSION-Release.xcframework.zip --output SAPOData.zip
CHECKSUM=$(swift package compute-checksum SAPOData.zip)
sed "s#let sapODataChecksum.*#let sapODataChecksum = \"$CHECKSUM\"#" Package.swift > tmp.swift
mv tmp.swift Package.swift
echo "Downloading: $ROOT_URL/SAPOfflineOData/$VERSION/SAPOfflineOData-$VERSION-Release.xcframework.zip"
curl -n -L -f $ROOT_URL/SAPOfflineOData/$VERSION/SAPOfflineOData-$VERSION-Release.xcframework.zip --output SAPOfflineOData.zip
CHECKSUM=$(swift package compute-checksum SAPOfflineOData.zip)
sed "s#let sapOfflineODataChecksum.*#let sapOfflineODataChecksum = \"$CHECKSUM\"#" Package.swift > tmp.swift
mv tmp.swift Package.swift
echo "Downloading: $ROOT_URL/SAPML/$VERSION/SAPML-$VERSION-Release.xcframework.zip"
curl -n -L -f $ROOT_URL/SAPML/$VERSION/SAPML-$VERSION-Release.xcframework.zip --output SAPML.zip
CHECKSUM=$(swift package compute-checksum SAPML.zip)
sed "s#let sapMLChecksum.*#let sapMLChecksum = \"$CHECKSUM\"#" Package.swift > tmp.swift
mv tmp.swift Package.swift
# Clean up
rm *.zip