summaryrefslogtreecommitdiff
path: root/script/pack-gae.sh
blob: 9917aef0a0f05703da94c618ac730da3a8def232 (plain)
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
#!/bin/bash
#
# Copyright 2018 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

if [ -d "$ANDROID_BUILD_TOP" ]; then
  TEST_SERVING_DIR="$ANDROID_BUILD_TOP/test/vti/test_serving"
else
  CURRENT_DIR_NAME="${PWD##*/}"
  if [ "${CURRENT_DIR_NAME}" = "test_serving" ]; then
    TEST_SERVING_DIR="${PWD}"
  elif [ "${CURRENT_DIR_NAME}" = "script" ]; then
    TEST_SERVING_DIR="${PWD}/.."
  else
    echo "Missing ANDROID_BUILD_TOP env variable. Run 'lunch' first."
    exit 1
  fi
fi

if [ ! -d "${TEST_SERVING_DIR}/gae" ]; then
  echo "Please run this script in 'test_serving' directory."
  exit 1
fi

pushd $TEST_SERVING_DIR/gae
echo "Removing unnecessary files in ${TEST_SERVING_DIR}/gae directory..."
git clean -f

echo "Updating python libraries..."
rm -rf lib/
./script/install-pip.sh
popd

pushd $TEST_SERVING_DIR/
zip vtslab-scheduler-$(git log -s -n 1 --format="%cd" --date=format:"%Y%m%d_%H%M%S")-$(git rev-parse --short HEAD).zip -r gae -x *.pyc "*/\.*" *.DS_Store* gae/frontend/node_modules**\*
popd