|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 4 | +# or more contributor license agreements. See the NOTICE file |
| 5 | +# distributed with this work for additional information |
| 6 | +# regarding copyright ownership. The ASF licenses this file |
| 7 | +# to you under the Apache License, Version 2.0 (the |
| 8 | +# "License"); you may not use this file except in compliance |
| 9 | +# with the License. You may obtain a copy of the License at |
| 10 | +# |
| 11 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +# |
| 13 | +# Unless required by applicable law or agreed to in writing, software |
| 14 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | +# See the License for the specific language governing permissions and |
| 17 | +# limitations under the License. |
| 18 | + |
| 19 | + |
| 20 | +if [ "${BRANCH}" == "" ] |
| 21 | +then |
| 22 | + BRANCH=master |
| 23 | +fi |
| 24 | + |
| 25 | +if [ "${GIT_URL}" == "" ] |
| 26 | +then |
| 27 | + GIT_URL=https://github.com/apache/ranger.git |
| 28 | +fi |
| 29 | + |
| 30 | +if [ "${PROFILE}" != "" ] |
| 31 | +then |
| 32 | + ARG_PROFILES="-P${PROFILE}" |
| 33 | +fi |
| 34 | + |
| 35 | +if [ "${SKIPTESTS}" == "" ] |
| 36 | +then |
| 37 | + ARG_SKIPTESTS="-DskipTests" |
| 38 | +else |
| 39 | + ARG_SKIPTESTS="-DskipTests=${SKIPTESTS}" |
| 40 | +fi |
| 41 | + |
| 42 | +if [ "${BUILD_HOST_SRC}" == "" ] |
| 43 | +then |
| 44 | + BUILD_HOST_SRC=true |
| 45 | +fi |
| 46 | + |
| 47 | +export MAVEN_OPTS="-Xms2g -Xmx2g" |
| 48 | +export M2=/home/ranger/.m2 |
| 49 | + |
| 50 | + |
| 51 | +if [ "${BUILD_HOST_SRC}" == "true" ] |
| 52 | +then |
| 53 | + if [ ! -f /home/ranger/src/pom.xml ] |
| 54 | + then |
| 55 | + echo "ERROR: BUILD_HOST_SRC=${BUILD_HOST_SRC}, but /home/ranger/src/pom.xml is not found " |
| 56 | + exit 1 |
| 57 | + fi |
| 58 | + |
| 59 | + echo "Building from /home/ranger/src" |
| 60 | + |
| 61 | + cd /home/ranger/src |
| 62 | +else |
| 63 | + echo "Building ${BRANCH} branch from ${GIT_URL}" |
| 64 | + |
| 65 | + cd /home/ranger/git |
| 66 | + |
| 67 | + if [ -d ranger ] |
| 68 | + then |
| 69 | + renamedDir=ranger-`date +"%Y%m%d-%H%M%S"` |
| 70 | + |
| 71 | + echo "Renaming existing directory `pwd`/ranger to ${renamedDir}" |
| 72 | + |
| 73 | + mv ranger $renamedDir |
| 74 | + fi |
| 75 | + |
| 76 | + git clone --single-branch --branch ${BRANCH} ${GIT_URL} |
| 77 | + |
| 78 | + cd /home/ranger/git/ranger |
| 79 | + |
| 80 | + for patch in `ls -1 /home/ranger/patches | sort` |
| 81 | + do |
| 82 | + echo "applying patch /home/ranger/patches/${patch}" |
| 83 | + git apply /home/ranger/patches/${patch} |
| 84 | + done |
| 85 | +fi |
| 86 | + |
| 87 | +mvn ${ARG_PROFILES} ${BUILD_OPTS} ${ARG_SKIPTESTS} -DskipDocs clean package |
| 88 | + |
| 89 | +mv -f target/version /home/ranger/dist/ |
| 90 | +mv -f target/ranger-* /home/ranger/dist/ |
0 commit comments