-
Notifications
You must be signed in to change notification settings - Fork 2
/
run-build
executable file
·65 lines (50 loc) · 1.74 KB
/
run-build
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
#!/usr/bin/env bash
# see https://github.com/OpenAPITools/openapi-generator/tree/v7.8.0/modules/openapi-generator/src/main/resources/Java
set -e
DIR=$(cd `dirname $0` && pwd)
WORKING_DIR="/app/java"
if [[ -n "$GITHUB_ACTIONS" ]]; then
printf "\nLogging in to docker.com ...\n"
echo "${DOCKER_TOKEN}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
fi
# cleanup
rm -f "${DIR}/src/main/java/com/dropbox/sign/api/"*.java
rm -f "${DIR}/src/main/java/com/dropbox/sign/model/"*.java
docker run --rm \
-v "${DIR}/:/local" \
openapitools/openapi-generator-cli:v7.8.0 generate \
-i "/local/openapi-sdk.yaml" \
-c "/local/openapi-config.yaml" \
-t "/local/templates" \
-o "/local/"
printf "\nInstalling composer dependencies ...\n"
mkdir -p "${DIR}/vendor"
bash "${DIR}/bin/php" composer install
printf "\n"
printf "Adding examples to Docs ...\n"
bash "${DIR}/bin/php" ./bin/generate-examples.php
printf "Replacing strings ...\n"
docker run --rm \
-v "${DIR}:${WORKING_DIR}" \
-w "${WORKING_DIR}" \
perl bash ./bin/replace
printf "Generating method overloads ...\n"
bash "${DIR}/bin/php" ./bin/generate-overload-methods.php
printf "Scanning for prohibited keywords ...\n"
docker run --rm \
-v "${DIR}:${WORKING_DIR}" \
-w "${WORKING_DIR}" \
perl bash ./bin/scan_for
# avoid docker messing with permissions
if [[ -z "$GITHUB_ACTIONS" ]]; then
chmod 644 "${DIR}/README.md"
find "${DIR}/docs/" -type f -exec chmod 644 {} \;
find "${DIR}/examples/" -type f -exec chmod 644 {} \;
find "${DIR}/test_fixtures/" -type f -exec chmod 644 {} \;
find "${DIR}/src/" -type f -exec chmod 644 {} \;
fi
# Remove empty directory
rm -rf "${DIR}/api"
printf "Building ...\n"
bash "${DIR}/bin/gradle" ./gradlew clean build
printf "Success!\n"