Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 1 | #!/bin/bash |
Josh Haberman | 67c727c | 2016-03-04 14:21:18 -0800 | [diff] [blame] | 2 | # |
| 3 | # Build and runs tests for the protobuf project. The tests as written here are |
| 4 | # used by both Jenkins and Travis, though some specialized logic is required to |
| 5 | # handle the differences between them. |
Thomas Van Lenten | c4d3638 | 2015-06-09 13:35:41 -0400 | [diff] [blame] | 6 | |
Josh Haberman | 0f8c25d | 2016-02-19 09:11:38 -0800 | [diff] [blame] | 7 | on_travis() { |
| 8 | if [ "$TRAVIS" == "true" ]; then |
| 9 | "$@" |
| 10 | fi |
| 11 | } |
| 12 | |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 13 | # For when some other test needs the C++ main build, including protoc and |
| 14 | # libprotobuf. |
| 15 | internal_build_cpp() { |
Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 16 | if [ -f src/protoc ]; then |
| 17 | # Already built. |
| 18 | return |
| 19 | fi |
| 20 | |
Josh Haberman | d33e93b | 2016-02-18 19:13:07 -0800 | [diff] [blame] | 21 | if [[ $(uname -s) == "Linux" && "$TRAVIS" == "true" ]]; then |
Feng Xiao | 9125863 | 2015-12-21 03:34:28 -0800 | [diff] [blame] | 22 | # Install GCC 4.8 to replace the default GCC 4.6. We need 4.8 for more |
| 23 | # decent C++ 11 support in order to compile conformance tests. |
| 24 | sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y |
| 25 | sudo apt-get update -qq |
| 26 | sudo apt-get install -qq g++-4.8 |
| 27 | export CXX="g++-4.8" CC="gcc-4.8" |
| 28 | fi |
Feng Xiao | 1e2fece | 2015-12-18 15:16:07 -0800 | [diff] [blame] | 29 | |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 30 | ./autogen.sh |
| 31 | ./configure |
Josh Haberman | 67c727c | 2016-03-04 14:21:18 -0800 | [diff] [blame] | 32 | make -j2 |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | build_cpp() { |
| 36 | internal_build_cpp |
Josh Haberman | 67c727c | 2016-03-04 14:21:18 -0800 | [diff] [blame] | 37 | make check -j2 |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 38 | cd conformance && make test_cpp && cd .. |
| 39 | } |
| 40 | |
| 41 | build_cpp_distcheck() { |
| 42 | ./autogen.sh |
| 43 | ./configure |
Josh Haberman | 67c727c | 2016-03-04 14:21:18 -0800 | [diff] [blame] | 44 | make distcheck -j2 |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 45 | } |
| 46 | |
Jan Tattermusch | ddb36ef | 2015-05-18 17:34:02 -0700 | [diff] [blame] | 47 | build_csharp() { |
Jon Skeet | b6defa7 | 2015-08-04 10:01:40 +0100 | [diff] [blame] | 48 | # Just for the conformance tests. We don't currently |
| 49 | # need to really build protoc, but it's simplest to keep with the |
| 50 | # conventions of the other builds. |
| 51 | internal_build_cpp |
Josh Haberman | ffc8118 | 2016-02-22 15:39:29 -0800 | [diff] [blame] | 52 | NUGET=/usr/local/bin/nuget.exe |
Jon Skeet | b6defa7 | 2015-08-04 10:01:40 +0100 | [diff] [blame] | 53 | |
Josh Haberman | ffc8118 | 2016-02-22 15:39:29 -0800 | [diff] [blame] | 54 | if [ "$TRAVIS" == "true" ]; then |
| 55 | # Install latest version of Mono |
| 56 | sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF |
| 57 | echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list |
| 58 | echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main" | sudo tee -a /etc/apt/sources.list.d/mono-xamarin.list |
| 59 | sudo apt-get update -qq |
| 60 | sudo apt-get install -qq mono-devel referenceassemblies-pcl nunit |
| 61 | wget www.nuget.org/NuGet.exe -O nuget.exe |
| 62 | NUGET=../../nuget.exe |
| 63 | fi |
Jan Tattermusch | ddb36ef | 2015-05-18 17:34:02 -0700 | [diff] [blame] | 64 | |
Josh Haberman | ffc8118 | 2016-02-22 15:39:29 -0800 | [diff] [blame] | 65 | (cd csharp/src; mono $NUGET restore) |
Jan Tattermusch | ddb36ef | 2015-05-18 17:34:02 -0700 | [diff] [blame] | 66 | csharp/buildall.sh |
Josh Haberman | e891c29 | 2015-12-30 16:03:49 -0800 | [diff] [blame] | 67 | cd conformance && make test_csharp && cd .. |
Jan Tattermusch | ddb36ef | 2015-05-18 17:34:02 -0700 | [diff] [blame] | 68 | } |
| 69 | |
Tim Swast | 7e31c4d | 2015-11-20 15:32:53 -0800 | [diff] [blame] | 70 | build_golang() { |
| 71 | # Go build needs `protoc`. |
| 72 | internal_build_cpp |
| 73 | # Add protoc to the path so that the examples build finds it. |
| 74 | export PATH="`pwd`/src:$PATH" |
| 75 | |
| 76 | # Install Go and the Go protobuf compiler plugin. |
| 77 | sudo apt-get update -qq |
| 78 | sudo apt-get install -qq golang |
| 79 | export GOPATH="$HOME/gocode" |
| 80 | mkdir -p "$GOPATH/src/github.com/google" |
| 81 | ln -s "`pwd`" "$GOPATH/src/github.com/google/protobuf" |
| 82 | export PATH="$GOPATH/bin:$PATH" |
| 83 | go get github.com/golang/protobuf/protoc-gen-go |
| 84 | |
| 85 | cd examples && make gotest && cd .. |
| 86 | } |
| 87 | |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 88 | use_java() { |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 89 | version=$1 |
| 90 | case "$version" in |
| 91 | jdk6) |
Josh Haberman | 0f8c25d | 2016-02-19 09:11:38 -0800 | [diff] [blame] | 92 | on_travis sudo apt-get install openjdk-6-jdk |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 93 | export PATH=/usr/lib/jvm/java-6-openjdk-amd64/bin:$PATH |
| 94 | ;; |
| 95 | jdk7) |
Josh Haberman | 0f8c25d | 2016-02-19 09:11:38 -0800 | [diff] [blame] | 96 | on_travis sudo apt-get install openjdk-7-jdk |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 97 | export PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH |
| 98 | ;; |
| 99 | oracle7) |
Josh Haberman | ffc8118 | 2016-02-22 15:39:29 -0800 | [diff] [blame] | 100 | if [ "$TRAVIS" == "true" ]; then |
| 101 | sudo apt-get install python-software-properties # for apt-add-repository |
| 102 | echo "oracle-java7-installer shared/accepted-oracle-license-v1-1 select true" | \ |
| 103 | sudo debconf-set-selections |
| 104 | yes | sudo apt-add-repository ppa:webupd8team/java |
| 105 | yes | sudo apt-get install oracle-java7-installer |
| 106 | fi; |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 107 | export PATH=/usr/lib/jvm/java-7-oracle/bin:$PATH |
| 108 | ;; |
| 109 | esac |
| 110 | |
Josh Haberman | 1ee0fda | 2016-03-03 16:02:55 -0800 | [diff] [blame] | 111 | if [ "$TRAVIS" != "true" ]; then |
| 112 | MAVEN_LOCAL_REPOSITORY=/var/maven_local_repository |
| 113 | MVN="$MVN -e -X --offline -Dmaven.repo.local=$MAVEN_LOCAL_REPOSITORY" |
| 114 | fi; |
| 115 | |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 116 | which java |
| 117 | java -version |
| 118 | } |
| 119 | |
Josh Haberman | d08c39c | 2016-02-20 12:03:39 -0800 | [diff] [blame] | 120 | # --batch-mode supresses download progress output that spams the logs. |
Josh Haberman | b28b3f6 | 2016-02-20 12:17:10 -0800 | [diff] [blame] | 121 | MVN="mvn --batch-mode" |
Josh Haberman | d08c39c | 2016-02-20 12:03:39 -0800 | [diff] [blame] | 122 | |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 123 | build_java() { |
Josh Haberman | 2f3f1de | 2016-03-01 15:37:17 -0800 | [diff] [blame] | 124 | version=$1 |
| 125 | dir=java_$version |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 126 | # Java build needs `protoc`. |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 127 | internal_build_cpp |
Josh Haberman | 2f3f1de | 2016-03-01 15:37:17 -0800 | [diff] [blame] | 128 | cp -r java $dir |
| 129 | cd $dir && $MVN clean && $MVN test |
Feng Xiao | 9e5fb55 | 2015-12-21 11:08:18 -0800 | [diff] [blame] | 130 | cd ../.. |
| 131 | } |
| 132 | |
Josh Haberman | 2f3f1de | 2016-03-01 15:37:17 -0800 | [diff] [blame] | 133 | # The conformance tests are hard-coded to work with the $ROOT/java directory. |
| 134 | # So this can't run in parallel with two different sets of tests. |
Feng Xiao | 9e5fb55 | 2015-12-21 11:08:18 -0800 | [diff] [blame] | 135 | build_java_with_conformance_tests() { |
| 136 | # Java build needs `protoc`. |
| 137 | internal_build_cpp |
Josh Haberman | d08c39c | 2016-02-20 12:03:39 -0800 | [diff] [blame] | 138 | cd java && $MVN test && $MVN install |
Josh Haberman | 2f3f1de | 2016-03-01 15:37:17 -0800 | [diff] [blame] | 139 | cd util && $MVN package assembly:single |
Feng Xiao | af81dcf | 2015-12-21 03:25:59 -0800 | [diff] [blame] | 140 | cd ../.. |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 141 | cd conformance && make test_java && cd .. |
| 142 | } |
| 143 | |
| 144 | build_javanano() { |
| 145 | # Java build needs `protoc`. |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 146 | internal_build_cpp |
Josh Haberman | b28b3f6 | 2016-02-20 12:17:10 -0800 | [diff] [blame] | 147 | cd javanano && $MVN test && cd .. |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 148 | } |
| 149 | |
| 150 | build_java_jdk6() { |
| 151 | use_java jdk6 |
Josh Haberman | 2f3f1de | 2016-03-01 15:37:17 -0800 | [diff] [blame] | 152 | build_java jdk6 |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 153 | } |
| 154 | build_java_jdk7() { |
| 155 | use_java jdk7 |
Feng Xiao | 9e5fb55 | 2015-12-21 11:08:18 -0800 | [diff] [blame] | 156 | build_java_with_conformance_tests |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 157 | } |
| 158 | build_java_oracle7() { |
| 159 | use_java oracle7 |
Josh Haberman | 2f3f1de | 2016-03-01 15:37:17 -0800 | [diff] [blame] | 160 | build_java oracle7 |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | build_javanano_jdk6() { |
| 164 | use_java jdk6 |
| 165 | build_javanano |
| 166 | } |
| 167 | build_javanano_jdk7() { |
| 168 | use_java jdk7 |
| 169 | build_javanano |
| 170 | } |
| 171 | build_javanano_oracle7() { |
| 172 | use_java oracle7 |
| 173 | build_javanano |
| 174 | } |
| 175 | |
Dan O'Reilly | 5de2a81 | 2015-08-20 18:19:56 -0400 | [diff] [blame] | 176 | internal_install_python_deps() { |
Josh Haberman | 483533d | 2016-02-19 12:48:33 -0800 | [diff] [blame] | 177 | if [ "$TRAVIS" != "true" ]; then |
| 178 | return; |
| 179 | fi |
Thomas Van Lenten | 9642b82 | 2015-06-10 17:21:23 -0400 | [diff] [blame] | 180 | # Install tox (OS X doesn't have pip). |
| 181 | if [ $(uname -s) == "Darwin" ]; then |
| 182 | sudo easy_install tox |
| 183 | else |
| 184 | sudo pip install tox |
| 185 | fi |
Dan O'Reilly | d9598ca | 2015-08-26 20:30:41 -0400 | [diff] [blame] | 186 | # Only install Python2.6/3.x on Linux. |
Dan O'Reilly | 76f8a3f | 2015-08-21 18:51:47 -0400 | [diff] [blame] | 187 | if [ $(uname -s) == "Linux" ]; then |
| 188 | sudo apt-get install -y python-software-properties # for apt-add-repository |
| 189 | sudo apt-add-repository -y ppa:fkrull/deadsnakes |
| 190 | sudo apt-get update -qq |
| 191 | sudo apt-get install -y python2.6 python2.6-dev |
Dan O'Reilly | d9598ca | 2015-08-26 20:30:41 -0400 | [diff] [blame] | 192 | sudo apt-get install -y python3.3 python3.3-dev |
| 193 | sudo apt-get install -y python3.4 python3.4-dev |
Dan O'Reilly | 76f8a3f | 2015-08-21 18:51:47 -0400 | [diff] [blame] | 194 | fi |
Dan O'Reilly | 5de2a81 | 2015-08-20 18:19:56 -0400 | [diff] [blame] | 195 | } |
| 196 | |
Thomas Van Lenten | 76b6138 | 2015-11-09 14:21:51 -0500 | [diff] [blame] | 197 | internal_objectivec_common () { |
| 198 | # Make sure xctool is up to date. Adapted from |
| 199 | # http://docs.travis-ci.com/user/osx-ci-environment/ |
| 200 | # We don't use a before_install because we test multiple OSes. |
| 201 | brew update |
Thomas Van Lenten | 8d47d78 | 2016-03-29 09:21:50 -0400 | [diff] [blame] | 202 | brew outdated xctool || brew upgrade xctool |
Thomas Van Lenten | 76b6138 | 2015-11-09 14:21:51 -0500 | [diff] [blame] | 203 | # Reused the build script that takes care of configuring and ensuring things |
Thomas Van Lenten | 1745f7e | 2015-11-17 10:18:49 -0500 | [diff] [blame] | 204 | # are up to date. Xcode and conformance tests will be directly invoked. |
| 205 | objectivec/DevTools/full_mac_build.sh \ |
| 206 | --core-only --skip-xcode --skip-objc-conformance |
Thomas Van Lenten | 76b6138 | 2015-11-09 14:21:51 -0500 | [diff] [blame] | 207 | } |
| 208 | |
| 209 | internal_xctool_debug_and_release() { |
Thomas Van Lenten | efca368 | 2016-02-16 15:10:14 -0500 | [diff] [blame] | 210 | # Always use -reporter plain to avoid escape codes in output (makes travis |
| 211 | # logs easier to read). |
| 212 | xctool -reporter plain -configuration Debug "$@" |
| 213 | xctool -reporter plain -configuration Release "$@" |
Thomas Van Lenten | 9642b82 | 2015-06-10 17:21:23 -0400 | [diff] [blame] | 214 | } |
| 215 | |
| 216 | build_objectivec_ios() { |
Thomas Van Lenten | 76b6138 | 2015-11-09 14:21:51 -0500 | [diff] [blame] | 217 | internal_objectivec_common |
| 218 | # https://github.com/facebook/xctool/issues/509 - unlike xcodebuild, xctool |
| 219 | # doesn't support >1 destination, so we have to build first and then run the |
| 220 | # tests one destination at a time. |
| 221 | internal_xctool_debug_and_release \ |
| 222 | -project objectivec/ProtocolBuffers_iOS.xcodeproj \ |
| 223 | -scheme ProtocolBuffers \ |
| 224 | -sdk iphonesimulator \ |
| 225 | build-tests |
| 226 | IOS_DESTINATIONS=( |
| 227 | "platform=iOS Simulator,name=iPhone 4s,OS=8.1" # 32bit |
Thomas Van Lenten | 1324119 | 2016-02-16 09:19:50 -0500 | [diff] [blame] | 228 | "platform=iOS Simulator,name=iPhone 6,OS=9.2" # 64bit |
Thomas Van Lenten | 76b6138 | 2015-11-09 14:21:51 -0500 | [diff] [blame] | 229 | "platform=iOS Simulator,name=iPad 2,OS=8.1" # 32bit |
Thomas Van Lenten | 1324119 | 2016-02-16 09:19:50 -0500 | [diff] [blame] | 230 | "platform=iOS Simulator,name=iPad Air,OS=9.2" # 64bit |
Thomas Van Lenten | 76b6138 | 2015-11-09 14:21:51 -0500 | [diff] [blame] | 231 | ) |
| 232 | for i in "${IOS_DESTINATIONS[@]}" ; do |
| 233 | internal_xctool_debug_and_release \ |
| 234 | -project objectivec/ProtocolBuffers_iOS.xcodeproj \ |
| 235 | -scheme ProtocolBuffers \ |
| 236 | -sdk iphonesimulator \ |
| 237 | -destination "${i}" \ |
Thomas Van Lenten | 8c78450 | 2016-02-18 11:08:30 -0500 | [diff] [blame] | 238 | run-tests |
Thomas Van Lenten | 76b6138 | 2015-11-09 14:21:51 -0500 | [diff] [blame] | 239 | done |
Thomas Van Lenten | 9642b82 | 2015-06-10 17:21:23 -0400 | [diff] [blame] | 240 | } |
| 241 | |
| 242 | build_objectivec_osx() { |
Thomas Van Lenten | 76b6138 | 2015-11-09 14:21:51 -0500 | [diff] [blame] | 243 | internal_objectivec_common |
| 244 | internal_xctool_debug_and_release \ |
| 245 | -project objectivec/ProtocolBuffers_OSX.xcodeproj \ |
| 246 | -scheme ProtocolBuffers \ |
| 247 | -destination "platform=OS X,arch=x86_64" \ |
| 248 | test |
Thomas Van Lenten | 1745f7e | 2015-11-17 10:18:49 -0500 | [diff] [blame] | 249 | cd conformance && make test_objc && cd .. |
Thomas Van Lenten | 9642b82 | 2015-06-10 17:21:23 -0400 | [diff] [blame] | 250 | } |
Dan O'Reilly | 5de2a81 | 2015-08-20 18:19:56 -0400 | [diff] [blame] | 251 | |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 252 | build_python() { |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 253 | internal_build_cpp |
Dan O'Reilly | 5de2a81 | 2015-08-20 18:19:56 -0400 | [diff] [blame] | 254 | internal_install_python_deps |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 255 | cd python |
Dan O'Reilly | d9598ca | 2015-08-26 20:30:41 -0400 | [diff] [blame] | 256 | # Only test Python 2.6/3.x on Linux |
Dan O'Reilly | 76f8a3f | 2015-08-21 18:51:47 -0400 | [diff] [blame] | 257 | if [ $(uname -s) == "Linux" ]; then |
Jie Luo | 2850a98 | 2015-10-09 17:07:03 -0700 | [diff] [blame] | 258 | envlist=py\{26,27,33,34\}-python |
Dan O'Reilly | 76f8a3f | 2015-08-21 18:51:47 -0400 | [diff] [blame] | 259 | else |
| 260 | envlist=py27-python |
| 261 | fi |
| 262 | tox -e $envlist |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 263 | cd .. |
| 264 | } |
| 265 | |
| 266 | build_python_cpp() { |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 267 | internal_build_cpp |
Dan O'Reilly | 5de2a81 | 2015-08-20 18:19:56 -0400 | [diff] [blame] | 268 | internal_install_python_deps |
| 269 | export LD_LIBRARY_PATH=../src/.libs # for Linux |
Tamir Duberstein | c91d9ab | 2015-05-14 21:32:39 -0400 | [diff] [blame] | 270 | export DYLD_LIBRARY_PATH=../src/.libs # for OS X |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 271 | cd python |
Dan O'Reilly | d9598ca | 2015-08-26 20:30:41 -0400 | [diff] [blame] | 272 | # Only test Python 2.6/3.x on Linux |
Dan O'Reilly | 76f8a3f | 2015-08-21 18:51:47 -0400 | [diff] [blame] | 273 | if [ $(uname -s) == "Linux" ]; then |
Jisi Liu | 72bd9c9 | 2015-10-06 10:48:57 -0700 | [diff] [blame] | 274 | # py26 is currently disabled due to json_format |
| 275 | envlist=py\{27,33,34\}-cpp |
Dan O'Reilly | 76f8a3f | 2015-08-21 18:51:47 -0400 | [diff] [blame] | 276 | else |
| 277 | envlist=py27-cpp |
| 278 | fi |
| 279 | tox -e $envlist |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 280 | cd .. |
| 281 | } |
| 282 | |
| 283 | build_ruby19() { |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 284 | internal_build_cpp # For conformance tests. |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 285 | cd ruby && bash travis-test.sh ruby-1.9 && cd .. |
| 286 | } |
| 287 | build_ruby20() { |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 288 | internal_build_cpp # For conformance tests. |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 289 | cd ruby && bash travis-test.sh ruby-2.0 && cd .. |
| 290 | } |
| 291 | build_ruby21() { |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 292 | internal_build_cpp # For conformance tests. |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 293 | cd ruby && bash travis-test.sh ruby-2.1 && cd .. |
| 294 | } |
| 295 | build_ruby22() { |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 296 | internal_build_cpp # For conformance tests. |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 297 | cd ruby && bash travis-test.sh ruby-2.2 && cd .. |
| 298 | } |
| 299 | build_jruby() { |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 300 | internal_build_cpp # For conformance tests. |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 301 | cd ruby && bash travis-test.sh jruby && cd .. |
| 302 | } |
| 303 | |
Josh Haberman | e9cf31e | 2015-12-21 15:18:17 -0800 | [diff] [blame] | 304 | build_javascript() { |
| 305 | internal_build_cpp |
Josh Haberman | 0d2d8bc | 2015-12-28 06:43:42 -0800 | [diff] [blame] | 306 | cd js && npm install && npm test && cd .. |
Josh Haberman | e9cf31e | 2015-12-21 15:18:17 -0800 | [diff] [blame] | 307 | } |
| 308 | |
Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 309 | # Note: travis currently does not support testing more than one language so the |
| 310 | # .travis.yml cheats and claims to only be cpp. If they add multiple language |
| 311 | # support, this should probably get updated to install steps and/or |
| 312 | # rvm/gemfile/jdk/etc. entries rather than manually doing the work. |
| 313 | |
| 314 | # .travis.yml uses matrix.exclude to block the cases where app-get can't be |
| 315 | # use to install things. |
| 316 | |
| 317 | # -------- main -------- |
| 318 | |
Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 319 | if [ "$#" -ne 1 ]; then |
| 320 | echo " |
| 321 | Usage: $0 { cpp | |
| 322 | csharp | |
| 323 | java_jdk6 | |
| 324 | java_jdk7 | |
| 325 | java_oracle7 | |
| 326 | javanano_jdk6 | |
| 327 | javanano_jdk7 | |
| 328 | javanano_oracle7 | |
| 329 | objectivec_ios | |
| 330 | objectivec_osx | |
| 331 | python | |
| 332 | python_cpp | |
Josh Haberman | ffc8118 | 2016-02-22 15:39:29 -0800 | [diff] [blame] | 333 | ruby19 | |
| 334 | ruby20 | |
| 335 | ruby21 | |
| 336 | ruby22 | |
Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 337 | jruby } |
| 338 | " |
| 339 | exit 1 |
| 340 | fi |
| 341 | |
| 342 | set -e # exit immediately on error |
| 343 | set -x # display all commands |
| 344 | eval "build_$1" |