diff --git a/pulsar-client-cpp/travis-build.sh b/pulsar-client-cpp/travis-build.sh index 898620664460baef71251e46b3ff79dc2fc48f03..7f4dab065934aeeb58f866f6b67b9617bbb5f322 100755 --- a/pulsar-client-cpp/travis-build.sh +++ b/pulsar-client-cpp/travis-build.sh @@ -56,12 +56,22 @@ exec_cmd() { if [ "$3" = "all" -o "$3" = "dep" ]; then # Install dependant packages exec_cmd "apt-get update && apt-get install -y cmake gcc-4.4 cpp-4.4 gcc-4.4-base libssl-dev libcurl4-openssl-dev liblog4cxx10-dev libprotobuf-dev libboost1.55-all-dev libgtest-dev libxml2-utils g++-4.4"; - exec_cmd "pushd $1/ && wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz && popd"; - exec_cmd "pushd /usr/src/gtest && CC=gcc-4.4 CXX=g++-4.4 cmake . && make && cp *.a /usr/lib && popd"; - exec_cmd "pushd $1/ && tar xvfz $1/protobuf-2.6.1.tar.gz && pushd $1/protobuf-2.6.1 && ./configure && make && make install && popd && popd"; + if [ ! -f "$1/libgtest.a" ]; then + echo "Not Found: $1/libgtest.a" + exec_cmd "pushd /usr/src/gtest && CC=gcc-4.4 CXX=g++-4.4 cmake . && make && cp libgtest.a $1/ && popd"; + fi + if [ ! -d "$1/protobuf-2.6.1/" ]; then + echo "Not Found: $1/protobuf-2.6.1/" + exec_cmd "pushd $1/ && wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz && popd"; + exec_cmd "pushd $1/ && tar xvfz $1/protobuf-2.6.1.tar.gz && pushd $1/protobuf-2.6.1 && ./configure && make && make install && popd && popd"; + else + echo "Found: $1/protobuf-2.6.1/" + exec_cmd "pushd $1/protobuf-2.6.1 && make install && popd" + fi fi if [ "$3" = "all" -o "$3" = "compile" ]; then + export PATH=$PATH:$1/ # Compile and run unit tests exec_cmd "pushd $2/pulsar-client-cpp && CC=gcc-4.4 CXX=g++-4.4 cmake . && make && popd"; PULSAR_STANDALONE_CONF=$2/pulsar-client-cpp/tests/standalone.conf $2/bin/pulsar standalone &