-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate_package.sh
executable file
·60 lines (52 loc) · 1.19 KB
/
generate_package.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
#!/bin/bash
CHECKSUM=''
VERSION=''
while getopts v:c:p:r: flag
do
case "${flag}" in
p) PRODUCT=${OPTARG};;
r) REPO=${OPTARG};;
v) VERSION=${OPTARG};;
c) CHECKSUM=${OPTARG};;
*) error "Unexpected option ${flag}";;
esac
done
if [ -z $PRODUCT ]; then
echo "Product name is required"
exit 1
fi
if [ -z $REPO ]; then
echo "Repository name is required"
exit 1
fi
if [ -z $CHECKSUM ]; then
echo "Checksum is required"
exit 1
fi
if [ -z $VERSION ]; then
echo "Version is required"
exit 1
fi
TEMPLATE="
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: \"$PRODUCT\",
platforms: [.iOS(.v10)],
products: [
.library(
name: \"$PRODUCT\",
targets: [\"$PRODUCT\"]
),
],
dependencies: [],
targets: [
.binaryTarget(
name: \"$PRODUCT\",
url: \"https://github.com/sendbird/$REPO/releases/download/$VERSION/$PRODUCT.xcframework.zip\",
checksum: \"$CHECKSUM\"
),
]
)"
echo -e "$TEMPLATE" > Package.swift