atlas-build.sh 2.08 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#!/bin/bash

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you 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 [ "${BRANCH}" == "" ]
then
  BRANCH=master
fi

24 25 26 27 28
if [ "${GIT_URL}" == "" ]
then
  GIT_URL=https://github.com/apache/atlas.git
fi

29 30 31 32 33 34 35 36 37 38 39 40
if [ "${PROFILE}" != "" ]
then
  ARG_PROFILES="-P${PROFILE}"
fi

if [ "${SKIPTESTS}" == "" ]
then
  ARG_SKIPTESTS="-DskipTests"
else
  ARG_SKIPTESTS="-DskipTests=${SKIPTESTS}"
fi

41 42 43 44 45
if [ "${BUILD_HOST_SRC}" == "" ]
then
  BUILD_HOST_SRC=true
fi

46 47 48 49
export MAVEN_OPTS="-Xms2g -Xmx2g"
export M2=/home/atlas/.m2


50
if [ "${BUILD_HOST_SRC}" == "true" ]
51
then
52 53 54 55 56 57 58
  if [ ! -f /home/atlas/src/pom.xml ]
  then
    echo "ERROR: BUILD_HOST_SRC=${BUILD_HOST_SRC}, but /home/atlas/src/pom.xml is not found "

	exit 1
  fi

59 60 61 62
  echo "Building from /home/atlas/src"

  cd /home/atlas/src
else
63
  echo "Building ${BRANCH} branch from ${GIT_URL}"
64

65 66 67 68 69
  cd /home/atlas/git

  if [ -d atlas ]
  then
    renamedDir=atlas-`date +"%Y%m%d-%H%M%S"`
70

71 72 73 74 75 76 77 78
    echo "Renaming existing directory `pwd`/atlas to ${renamedDir}"

    mv atlas $renamedDir
  fi

  git clone --single-branch --branch ${BRANCH} ${GIT_URL}

  cd /home/atlas/git/atlas
79 80 81 82 83 84 85 86 87 88 89

  for patch in `ls -1 /home/atlas/patches | sort`
  do
    echo "applying patch /home/atlas/patches/${patch}"
    git apply /home/atlas/patches/${patch}
  done
fi

mvn ${ARG_PROFILES} ${ARG_SKIPTESTS} -DskipDocs clean package

mv -f distro/target/apache-atlas-${ATLAS_VERSION}-bin.tar.gz /home/atlas/dist/