| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/env bash | |
| 2 | |
| 3 # Note: travis currently does not support testing more than one language so the | |
| 4 # .travis.yml cheats and claims to only be cpp. If they add multiple language | |
| 5 # support, this should probably get updated to install steps and/or | |
| 6 # rvm/gemfile/jdk/etc. entries rather than manually doing the work. | |
| 7 | |
| 8 # .travis.yml uses matrix.exclude to block the cases where app-get can't be | |
| 9 # use to install things. | |
| 10 | |
| 11 # For when some other test needs the C++ main build, including protoc and | |
| 12 # libprotobuf. | |
| 13 internal_build_cpp() { | |
| 14 ./autogen.sh | |
| 15 ./configure | |
| 16 make -j2 | |
| 17 } | |
| 18 | |
| 19 build_cpp() { | |
| 20 internal_build_cpp | |
| 21 make check -j2 | |
| 22 cd conformance && make test_cpp && cd .. | |
| 23 } | |
| 24 | |
| 25 build_cpp_distcheck() { | |
| 26 ./autogen.sh | |
| 27 ./configure | |
| 28 make distcheck -j2 | |
| 29 } | |
| 30 | |
| 31 build_csharp() { | |
| 32 # Just for the conformance tests. We don't currently | |
| 33 # need to really build protoc, but it's simplest to keep with the | |
| 34 # conventions of the other builds. | |
| 35 internal_build_cpp | |
| 36 | |
| 37 # Install latest version of Mono | |
| 38 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6
A14DA29AA6A19B38D3D831EF | |
| 39 echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee
/etc/apt/sources.list.d/mono-xamarin.list | |
| 40 echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat m
ain" | sudo tee -a /etc/apt/sources.list.d/mono-xamarin.list | |
| 41 sudo apt-get update -qq | |
| 42 sudo apt-get install -qq mono-devel referenceassemblies-pcl nunit | |
| 43 wget www.nuget.org/NuGet.exe -O nuget.exe | |
| 44 | |
| 45 (cd csharp/src; mono ../../nuget.exe restore) | |
| 46 csharp/buildall.sh | |
| 47 cd conformance && make test_csharp && cd .. | |
| 48 } | |
| 49 | |
| 50 use_java() { | |
| 51 version=$1 | |
| 52 case "$version" in | |
| 53 jdk6) | |
| 54 sudo apt-get install openjdk-6-jdk | |
| 55 export PATH=/usr/lib/jvm/java-6-openjdk-amd64/bin:$PATH | |
| 56 ;; | |
| 57 jdk7) | |
| 58 sudo apt-get install openjdk-7-jdk | |
| 59 export PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH | |
| 60 ;; | |
| 61 oracle7) | |
| 62 sudo apt-get install python-software-properties # for apt-add-repository | |
| 63 echo "oracle-java7-installer shared/accepted-oracle-license-v1-1 select tr
ue" | \ | |
| 64 sudo debconf-set-selections | |
| 65 yes | sudo apt-add-repository ppa:webupd8team/java | |
| 66 yes | sudo apt-get install oracle-java7-installer | |
| 67 export PATH=/usr/lib/jvm/java-7-oracle/bin:$PATH | |
| 68 ;; | |
| 69 esac | |
| 70 | |
| 71 which java | |
| 72 java -version | |
| 73 } | |
| 74 | |
| 75 build_java() { | |
| 76 # Java build needs `protoc`. | |
| 77 internal_build_cpp | |
| 78 cd java && mvn test && cd .. | |
| 79 cd conformance && make test_java && cd .. | |
| 80 } | |
| 81 | |
| 82 build_javanano() { | |
| 83 # Java build needs `protoc`. | |
| 84 internal_build_cpp | |
| 85 cd javanano && mvn test && cd .. | |
| 86 } | |
| 87 | |
| 88 build_java_jdk6() { | |
| 89 use_java jdk6 | |
| 90 build_java | |
| 91 } | |
| 92 build_java_jdk7() { | |
| 93 use_java jdk7 | |
| 94 build_java | |
| 95 } | |
| 96 build_java_oracle7() { | |
| 97 use_java oracle7 | |
| 98 build_java | |
| 99 } | |
| 100 | |
| 101 build_javanano_jdk6() { | |
| 102 use_java jdk6 | |
| 103 build_javanano | |
| 104 } | |
| 105 build_javanano_jdk7() { | |
| 106 use_java jdk7 | |
| 107 build_javanano | |
| 108 } | |
| 109 build_javanano_oracle7() { | |
| 110 use_java oracle7 | |
| 111 build_javanano | |
| 112 } | |
| 113 | |
| 114 build_python() { | |
| 115 internal_build_cpp | |
| 116 cd python | |
| 117 python setup.py build | |
| 118 python setup.py test | |
| 119 python setup.py sdist | |
| 120 sudo pip install virtualenv && virtualenv /tmp/protoenv && /tmp/protoenv/bin/p
ip install dist/* | |
| 121 cd .. | |
| 122 } | |
| 123 | |
| 124 build_python_cpp() { | |
| 125 internal_build_cpp | |
| 126 export LD_LIBRARY_PATH=../src/.libs # for Linux | |
| 127 export DYLD_LIBRARY_PATH=../src/.libs # for OS X | |
| 128 cd python | |
| 129 python setup.py build --cpp_implementation | |
| 130 python setup.py test --cpp_implementation | |
| 131 python setup.py sdist --cpp_implementation | |
| 132 sudo pip install virtualenv && virtualenv /tmp/protoenv && /tmp/protoenv/bin/p
ip install dist/* | |
| 133 cd .. | |
| 134 } | |
| 135 | |
| 136 build_ruby19() { | |
| 137 internal_build_cpp # For conformance tests. | |
| 138 cd ruby && bash travis-test.sh ruby-1.9 && cd .. | |
| 139 } | |
| 140 build_ruby20() { | |
| 141 internal_build_cpp # For conformance tests. | |
| 142 cd ruby && bash travis-test.sh ruby-2.0 && cd .. | |
| 143 } | |
| 144 build_ruby21() { | |
| 145 internal_build_cpp # For conformance tests. | |
| 146 cd ruby && bash travis-test.sh ruby-2.1 && cd .. | |
| 147 } | |
| 148 build_ruby22() { | |
| 149 internal_build_cpp # For conformance tests. | |
| 150 cd ruby && bash travis-test.sh ruby-2.2 && cd .. | |
| 151 } | |
| 152 build_jruby() { | |
| 153 internal_build_cpp # For conformance tests. | |
| 154 cd ruby && bash travis-test.sh jruby && cd .. | |
| 155 } | |
| 156 | |
| 157 # -------- main -------- | |
| 158 | |
| 159 if [ "$#" -ne 1 ]; then | |
| 160 echo " | |
| 161 Usage: $0 { cpp | | |
| 162 csharp | | |
| 163 java_jdk6 | | |
| 164 java_jdk7 | | |
| 165 java_oracle7 | | |
| 166 javanano_jdk6 | | |
| 167 javanano_jdk7 | | |
| 168 javanano_oracle7 | | |
| 169 python | | |
| 170 python_cpp | | |
| 171 ruby_19 | | |
| 172 ruby_20 | | |
| 173 ruby_21 | | |
| 174 ruby_22 | | |
| 175 jruby } | |
| 176 " | |
| 177 exit 1 | |
| 178 fi | |
| 179 | |
| 180 set -e # exit immediately on error | |
| 181 set -x # display all commands | |
| 182 eval "build_$1" | |
| OLD | NEW |