Skip to content

Commit c8a8d1c

Browse files
committed
Refactoring to use SCRIPT_PATH and shared configuration
1 parent 118759b commit c8a8d1c

File tree

12 files changed

+90
-32
lines changed

12 files changed

+90
-32
lines changed

all.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Build all containers with one command
5+
#
6+
CONTAINER_LIST="build game dev"
7+
for CONTAINER in $CONTAINER_LIST; do
8+
echo ====== Running all steps for container: $CONTAINER
9+
pushd $CONTAINER
10+
./all.sh
11+
popd
12+
echo ====== Finished all steps for container: $CONTAINER
13+
done
14+
15+
echo COMPLETED build of $CONTAINER_LIST

build/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
api-config.sh

build/api-package.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env bash
2-
VERSION=3.16.1
3-
PACKAGE=s2client-api-${VERSION}.tgz
2+
3+
. api-config.sh
4+
5+
PACKAGE=s2client-api-${GAME_VERSION}.tgz
46

57
echo "===================================="
68
echo "Building package ${PACKAGE}"

build/build-copy.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env bash
22

3-
VERSION=3.16.1
3+
SCRIPT_PATH=${0%/*}
4+
. ${SCRIPT_PATH}/../config.sh
45

56
# Build the API artifacts in the build-mount folder
67
docker run -it -v build-mount:/build-mount --entrypoint="/s2client-api/api-all.sh" s2client-api

build/clone.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
#!/usr/bin/env bash
22

3+
#
34
# This clones a clean copy of the repo
5+
#
46
mkdir -p downloads
7+
58
pushd downloads
6-
rm -rf s2client-api
7-
git clone --recursive https://github.com/Blizzard/s2client-api
9+
10+
if [ -d s2client-api ]; then
11+
cd s2client-api && git pull -r
12+
else
13+
git clone --recursive https://github.com/Blizzard/s2client-api
14+
fi
15+
816
popd

build/make-container.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#!/usr/bin/env bash
22

3-
# This builds the container
4-
IMGNAME=s2client-api
3+
# This builds the container for building the API code
4+
IMAGE_NAME=s2client-api
55
SCRIPT_PATH=${0%/*}
66

7-
echo ${IMGNAME} docker image building using ${SCRIPT_PATH}/Dockerfile
8-
docker build ${SCRIPT_PATH} -t ${IMGNAME}
7+
echo Copying config.sh for current version
8+
cp ${SCRIPT_PATH}/../config.sh ${SCRIPT_PATH}/api-config.sh
9+
10+
echo ${IMAGE_NAME} docker image building using ${SCRIPT_PATH}/Dockerfile
11+
docker build ${SCRIPT_PATH} -t ${IMAGE_NAME}

config.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
#
3+
# Common variables used by scripts for building and controlling
4+
# containers
5+
#
6+
GAME_VERSION=3.16.1
7+
8+
#
9+
# Common command replacements
10+
#
11+
UNZIP_CMD="unzip -Piagreetotheeula"

dev/make-container.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env bash
22

3-
# This builds the container
4-
IMGNAME=s2client-dev
3+
# This builds the container that could be used to clone the API and work on
4+
# local changes
5+
IMAGE_NAME=s2client-dev
56
SCRIPT_PATH=${0%/*}
67

7-
echo ${IMGNAME} docker image building using ${SCRIPT_PATH}/Dockerfile
8-
docker build ${SCRIPT_PATH} -t ${IMGNAME}
8+
echo ${IMAGE_NAME} docker image building using ${SCRIPT_PATH}/Dockerfile
9+
docker build ${SCRIPT_PATH} -t ${IMAGE_NAME}

game/download.sh

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
#!/usr/bin/env bash
22

3-
VERSION=3.16.1
3+
SCRIPT_PATH=${0%/*}
4+
. ${SCRIPT_PATH}/../config.sh
45

6+
WGET_CMD="wget --timestamping --continue"
7+
8+
#
59
# This downloads zip files for current version
10+
#
611
mkdir -p downloads/
12+
713
pushd downloads
8-
wget -c http://blzdistsc2-a.akamaihd.net/Linux/SC2.${VERSION}.zip
9-
wget -c http://blzdistsc2-a.akamaihd.net/MapPacks/Ladder2017Season1.zip
10-
wget -c http://blzdistsc2-a.akamaihd.net/MapPacks/Ladder2017Season2.zip
11-
wget -c http://blzdistsc2-a.akamaihd.net/MapPacks/Ladder2017Season3.zip
12-
wget -c http://blzdistsc2-a.akamaihd.net/MapPacks/Melee.zip
14+
15+
${WGET_CMD} http://blzdistsc2-a.akamaihd.net/Linux/SC2.${GAME_VERSION}.zip
16+
${WGET_CMD} http://blzdistsc2-a.akamaihd.net/MapPacks/Ladder2017Season1.zip
17+
${WGET_CMD} http://blzdistsc2-a.akamaihd.net/MapPacks/Ladder2017Season2.zip
18+
${WGET_CMD} http://blzdistsc2-a.akamaihd.net/MapPacks/Ladder2017Season3.zip
19+
${WGET_CMD} http://blzdistsc2-a.akamaihd.net/MapPacks/Melee.zip
20+
1321
popd

game/make-container.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bash
22

3-
# This builds the container
4-
IMGNAME=s2client-game
3+
# This builds the container for running the game
4+
IMAGE_NAME=s2client-game
55
SCRIPT_PATH=${0%/*}
66

7-
echo ${IMGNAME} docker image building using ${SCRIPT_PATH}/Dockerfile
8-
docker build ${SCRIPT_PATH} -t ${IMGNAME}
7+
echo ${IMAGE_NAME} docker image building using ${SCRIPT_PATH}/Dockerfile
8+
docker build ${SCRIPT_PATH} -t ${IMAGE_NAME}

0 commit comments

Comments
 (0)