forked from palantir/conjure-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdownload-test-server.sh
executable file
·45 lines (35 loc) · 1.46 KB
/
download-test-server.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
#!/usr/bin/env bash
set -euo pipefail
VERSION="$(grep "^com.palantir.conjure.verification:*" < versions.props | tail -1 | sed 's/^com.palantir.conjure.verification:\* = \(.*\)$/\1/')"
TEST_CASES="verification-server-test-cases"
API="verification-server-api"
SERVER="verification-server"
DOWNLOADS_DIR=build/downloads
RESOURCES_DIR=build/resources
mkdir -p "$DOWNLOADS_DIR"/bin
mkdir -p "$RESOURCES_DIR"
function download() {
basename=$(basename "$1")
target="$DOWNLOADS_DIR"/"$basename"
if [[ ! -f "$target" ]]; then
curl -L --fail "$1" -o "$target"
fi
echo "$target"
}
DOWNLOAD_OUTPUT="$RESOURCES_DIR/${API}.conjure.json"
ARTIFACT_NAME="${API}-${VERSION}.conjure.json"
out=$(download "https://repo1.maven.org/maven2/com/palantir/conjure/verification/${API}/${VERSION}/${ARTIFACT_NAME}")
cp -f "$out" "$DOWNLOAD_OUTPUT"
DOWNLOAD_OUTPUT="$RESOURCES_DIR/${TEST_CASES}.json"
ARTIFACT_NAME="${TEST_CASES}-${VERSION}.json"
out=$(download "https://repo1.maven.org/maven2/com/palantir/conjure/verification/${TEST_CASES}/${VERSION}/${ARTIFACT_NAME}")
cp -f "$out" "$DOWNLOAD_OUTPUT"
case $(uname -s) in
Linux*) TARGET=linux ;;
Darwin*) TARGET=osx ;;
*) echo "Unsupported OS" >&2; exit 1;;
esac
ARTIFACT_NAME="${SERVER}-${VERSION}-${TARGET}.tgz"
out=$(download "https://repo1.maven.org/maven2/com/palantir/conjure/verification/${SERVER}/${VERSION}/${ARTIFACT_NAME}")
tar xf "$out" -C "$DOWNLOADS_DIR/bin"
chmod +x "$DOWNLOADS_DIR/bin/conjure-verification-server"