basic repo setup
[dcaegen2/services/son-handler.git] / mvn-phase-script.sh
1 #!/bin/bash
2
3 # ================================================================================
4 # Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
5 # ================================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 # ============LICENSE_END=========================================================
18 #
19
20
21 set -ex
22
23
24 echo "running script: [$0] for module [$1] at stage [$2]"
25
26 MVN_PROJECT_MODULEID="$1"
27 MVN_PHASE="$2"
28 PROJECT_ROOT=$(dirname $0)
29
30 # expected environment variables
31 if [ -z "${MVN_NEXUSPROXY}" ]; then
32     echo "MVN_NEXUSPROXY environment variable not set.  Cannot proceed"
33     exit 1
34 fi
35 if [ -z "$SETTINGS_FILE" ]; then
36     echo "SETTINGS_FILE environment variable not set.  Cannot proceed"
37     exit 2
38 fi
39
40
41 source "${PROJECT_ROOT}"/mvn-phase-lib.sh
42
43
44 # This is the base for where "deploy" will upload
45 # MVN_NEXUSPROXY is set in the pom.xml
46 REPO=$MVN_NEXUSPROXY/content/sites/raw/$MVN_PROJECT_GROUPID
47
48 TIMESTAMP=$(date +%C%y%m%dT%H%M%S)
49 export BUILD_NUMBER="${TIMESTAMP}"
50
51
52 shift 2
53
54 case $MVN_PHASE in
55 clean)
56   echo "==> clean phase script"
57   clean_templated_files
58   clean_tox_files
59   rm -rf ./venv-* ./*.wgn ./site ./coverage.xml ./xunit-results.xml
60   ;;
61 generate-sources)
62   echo "==> generate-sources phase script"
63   expand_templates
64   ;;
65 compile)
66   echo "==> compile phase script"
67   ;;
68 test)
69   echo "==> test phase script"
70   set +e
71   run_tox_test
72   set -e
73   ;;
74 package)
75   echo "==> package phase script"
76   ;;
77 install)
78   echo "==> install phase script"
79   ;;
80 deploy)
81   echo "==> deploy phase script"
82   case $MVN_PROJECT_MODULEID in
83   *)
84     #generate_pypirc_then_publish
85     ;;
86   esac
87   ;;
88 *)
89   echo "==> unprocessed phase"
90   ;;
91 esac
92