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 .. |
Josh Haberman | cb36bde | 2016-04-29 09:52:20 -0700 | [diff] [blame] | 39 | |
| 40 | # Verify benchmarking code can build successfully. |
Josh Haberman | 49a8918 | 2016-04-29 10:19:03 -0700 | [diff] [blame] | 41 | cd benchmarks && make && ./generate-datasets && cd .. |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | build_cpp_distcheck() { |
| 45 | ./autogen.sh |
| 46 | ./configure |
Feng Xiao | a4f68b1 | 2016-07-19 17:20:31 -0700 | [diff] [blame] | 47 | make dist |
| 48 | |
| 49 | # List all files that should be included in the distribution package. |
| 50 | git ls-files | grep "^\(java\|python\|objectivec\|csharp\|js\|ruby\|cmake\|examples\)" |\ |
| 51 | grep -v ".gitignore" | grep -v "java/compatibility_tests" > dist.lst |
| 52 | # Unzip the dist tar file. |
| 53 | DIST=`ls *.tar.gz` |
| 54 | tar -xf $DIST |
| 55 | cd ${DIST//.tar.gz} |
| 56 | # Check if every file exists in the dist tar file. |
| 57 | FILES_MISSING="" |
| 58 | for FILE in $(<../dist.lst); do |
| 59 | if ! file $FILE &>/dev/null; then |
| 60 | echo "$FILE is not found!" |
| 61 | FILES_MISSING="$FILE $FILES_MISSING" |
| 62 | fi |
| 63 | done |
| 64 | cd .. |
| 65 | if [ ! -z "$FILES_MISSING" ]; then |
| 66 | echo "Missing files in EXTRA_DIST: $FILES_MISSING" |
| 67 | exit 1 |
| 68 | fi |
| 69 | |
| 70 | # Do the regular dist-check for C++. |
Josh Haberman | 67c727c | 2016-03-04 14:21:18 -0800 | [diff] [blame] | 71 | make distcheck -j2 |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 72 | } |
| 73 | |
Jan Tattermusch | ddb36ef | 2015-05-18 17:34:02 -0700 | [diff] [blame] | 74 | build_csharp() { |
Jon Skeet | b6defa7 | 2015-08-04 10:01:40 +0100 | [diff] [blame] | 75 | # Just for the conformance tests. We don't currently |
| 76 | # need to really build protoc, but it's simplest to keep with the |
| 77 | # conventions of the other builds. |
| 78 | internal_build_cpp |
Josh Haberman | ffc8118 | 2016-02-22 15:39:29 -0800 | [diff] [blame] | 79 | NUGET=/usr/local/bin/nuget.exe |
Jon Skeet | b6defa7 | 2015-08-04 10:01:40 +0100 | [diff] [blame] | 80 | |
Josh Haberman | ffc8118 | 2016-02-22 15:39:29 -0800 | [diff] [blame] | 81 | if [ "$TRAVIS" == "true" ]; then |
| 82 | # Install latest version of Mono |
| 83 | sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF |
Jon Skeet | 10a8fb4 | 2016-07-14 22:01:47 +0100 | [diff] [blame] | 84 | sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1397BC53640DB551 |
Josh Haberman | ffc8118 | 2016-02-22 15:39:29 -0800 | [diff] [blame] | 85 | echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list |
Josh Haberman | ffc8118 | 2016-02-22 15:39:29 -0800 | [diff] [blame] | 86 | sudo apt-get update -qq |
| 87 | sudo apt-get install -qq mono-devel referenceassemblies-pcl nunit |
Jon Skeet | 10a8fb4 | 2016-07-14 22:01:47 +0100 | [diff] [blame] | 88 | |
| 89 | # Then install the dotnet SDK as per Ubuntu 14.04 instructions on dot.net. |
Jon Skeet | deaea21 | 2016-07-19 17:57:46 -0700 | [diff] [blame] | 90 | sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list' |
Jon Skeet | 10a8fb4 | 2016-07-14 22:01:47 +0100 | [diff] [blame] | 91 | sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893 |
| 92 | sudo apt-get update -qq |
| 93 | sudo apt-get install -qq dotnet-dev-1.0.0-preview2-003121 |
Josh Haberman | ffc8118 | 2016-02-22 15:39:29 -0800 | [diff] [blame] | 94 | fi |
Jan Tattermusch | ddb36ef | 2015-05-18 17:34:02 -0700 | [diff] [blame] | 95 | |
Jon Skeet | 10a8fb4 | 2016-07-14 22:01:47 +0100 | [diff] [blame] | 96 | # Perform "dotnet new" once to get the setup preprocessing out of the |
| 97 | # way. That spews a lot of output (including backspaces) into logs |
| 98 | # otherwise, and can cause problems. It doesn't matter if this step |
| 99 | # is performed multiple times; it's cheap after the first time anyway. |
| 100 | mkdir dotnettmp |
| 101 | (cd dotnettmp; dotnet new > /dev/null) |
| 102 | rm -rf dotnettmp |
| 103 | |
| 104 | (cd csharp/src; dotnet restore) |
Jan Tattermusch | ddb36ef | 2015-05-18 17:34:02 -0700 | [diff] [blame] | 105 | csharp/buildall.sh |
Josh Haberman | e891c29 | 2015-12-30 16:03:49 -0800 | [diff] [blame] | 106 | cd conformance && make test_csharp && cd .. |
Jan Tattermusch | ddb36ef | 2015-05-18 17:34:02 -0700 | [diff] [blame] | 107 | } |
| 108 | |
Tim Swast | 7e31c4d | 2015-11-20 15:32:53 -0800 | [diff] [blame] | 109 | build_golang() { |
| 110 | # Go build needs `protoc`. |
| 111 | internal_build_cpp |
| 112 | # Add protoc to the path so that the examples build finds it. |
| 113 | export PATH="`pwd`/src:$PATH" |
| 114 | |
| 115 | # Install Go and the Go protobuf compiler plugin. |
| 116 | sudo apt-get update -qq |
| 117 | sudo apt-get install -qq golang |
| 118 | export GOPATH="$HOME/gocode" |
| 119 | mkdir -p "$GOPATH/src/github.com/google" |
| 120 | ln -s "`pwd`" "$GOPATH/src/github.com/google/protobuf" |
| 121 | export PATH="$GOPATH/bin:$PATH" |
| 122 | go get github.com/golang/protobuf/protoc-gen-go |
| 123 | |
| 124 | cd examples && make gotest && cd .. |
| 125 | } |
| 126 | |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 127 | use_java() { |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 128 | version=$1 |
| 129 | case "$version" in |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 130 | jdk7) |
Josh Haberman | 0f8c25d | 2016-02-19 09:11:38 -0800 | [diff] [blame] | 131 | on_travis sudo apt-get install openjdk-7-jdk |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 132 | export PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH |
Feng Xiao | ad49ed7 | 2016-07-21 11:37:46 -0700 | [diff] [blame^] | 133 | export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 134 | ;; |
| 135 | oracle7) |
Josh Haberman | ffc8118 | 2016-02-22 15:39:29 -0800 | [diff] [blame] | 136 | if [ "$TRAVIS" == "true" ]; then |
| 137 | sudo apt-get install python-software-properties # for apt-add-repository |
| 138 | echo "oracle-java7-installer shared/accepted-oracle-license-v1-1 select true" | \ |
| 139 | sudo debconf-set-selections |
| 140 | yes | sudo apt-add-repository ppa:webupd8team/java |
| 141 | yes | sudo apt-get install oracle-java7-installer |
| 142 | fi; |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 143 | export PATH=/usr/lib/jvm/java-7-oracle/bin:$PATH |
Feng Xiao | ad49ed7 | 2016-07-21 11:37:46 -0700 | [diff] [blame^] | 144 | export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 145 | ;; |
| 146 | esac |
| 147 | |
Josh Haberman | 1ee0fda | 2016-03-03 16:02:55 -0800 | [diff] [blame] | 148 | if [ "$TRAVIS" != "true" ]; then |
| 149 | MAVEN_LOCAL_REPOSITORY=/var/maven_local_repository |
| 150 | MVN="$MVN -e -X --offline -Dmaven.repo.local=$MAVEN_LOCAL_REPOSITORY" |
| 151 | fi; |
| 152 | |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 153 | which java |
| 154 | java -version |
Feng Xiao | ad49ed7 | 2016-07-21 11:37:46 -0700 | [diff] [blame^] | 155 | $MVN -version |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 156 | } |
| 157 | |
Josh Haberman | d08c39c | 2016-02-20 12:03:39 -0800 | [diff] [blame] | 158 | # --batch-mode supresses download progress output that spams the logs. |
Josh Haberman | b28b3f6 | 2016-02-20 12:17:10 -0800 | [diff] [blame] | 159 | MVN="mvn --batch-mode" |
Josh Haberman | d08c39c | 2016-02-20 12:03:39 -0800 | [diff] [blame] | 160 | |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 161 | build_java() { |
Josh Haberman | 2f3f1de | 2016-03-01 15:37:17 -0800 | [diff] [blame] | 162 | version=$1 |
| 163 | dir=java_$version |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 164 | # Java build needs `protoc`. |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 165 | internal_build_cpp |
Josh Haberman | 2f3f1de | 2016-03-01 15:37:17 -0800 | [diff] [blame] | 166 | cp -r java $dir |
| 167 | cd $dir && $MVN clean && $MVN test |
Feng Xiao | 9e5fb55 | 2015-12-21 11:08:18 -0800 | [diff] [blame] | 168 | cd ../.. |
| 169 | } |
| 170 | |
Josh Haberman | 2f3f1de | 2016-03-01 15:37:17 -0800 | [diff] [blame] | 171 | # The conformance tests are hard-coded to work with the $ROOT/java directory. |
| 172 | # 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] | 173 | build_java_with_conformance_tests() { |
| 174 | # Java build needs `protoc`. |
| 175 | internal_build_cpp |
Josh Haberman | d08c39c | 2016-02-20 12:03:39 -0800 | [diff] [blame] | 176 | cd java && $MVN test && $MVN install |
Josh Haberman | 2f3f1de | 2016-03-01 15:37:17 -0800 | [diff] [blame] | 177 | cd util && $MVN package assembly:single |
Feng Xiao | af81dcf | 2015-12-21 03:25:59 -0800 | [diff] [blame] | 178 | cd ../.. |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 179 | cd conformance && make test_java && cd .. |
| 180 | } |
| 181 | |
| 182 | build_javanano() { |
| 183 | # Java build needs `protoc`. |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 184 | internal_build_cpp |
Josh Haberman | b28b3f6 | 2016-02-20 12:17:10 -0800 | [diff] [blame] | 185 | cd javanano && $MVN test && cd .. |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 186 | } |
| 187 | |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 188 | build_java_jdk7() { |
| 189 | use_java jdk7 |
Feng Xiao | 9e5fb55 | 2015-12-21 11:08:18 -0800 | [diff] [blame] | 190 | build_java_with_conformance_tests |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 191 | } |
| 192 | build_java_oracle7() { |
| 193 | use_java oracle7 |
Josh Haberman | 2f3f1de | 2016-03-01 15:37:17 -0800 | [diff] [blame] | 194 | build_java oracle7 |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 195 | } |
| 196 | |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 197 | build_javanano_jdk7() { |
| 198 | use_java jdk7 |
| 199 | build_javanano |
| 200 | } |
| 201 | build_javanano_oracle7() { |
| 202 | use_java oracle7 |
| 203 | build_javanano |
| 204 | } |
| 205 | |
Dan O'Reilly | 5de2a81 | 2015-08-20 18:19:56 -0400 | [diff] [blame] | 206 | internal_install_python_deps() { |
Josh Haberman | 483533d | 2016-02-19 12:48:33 -0800 | [diff] [blame] | 207 | if [ "$TRAVIS" != "true" ]; then |
| 208 | return; |
| 209 | fi |
Thomas Van Lenten | 9642b82 | 2015-06-10 17:21:23 -0400 | [diff] [blame] | 210 | # Install tox (OS X doesn't have pip). |
| 211 | if [ $(uname -s) == "Darwin" ]; then |
| 212 | sudo easy_install tox |
| 213 | else |
| 214 | sudo pip install tox |
| 215 | fi |
Dan O'Reilly | d9598ca | 2015-08-26 20:30:41 -0400 | [diff] [blame] | 216 | # Only install Python2.6/3.x on Linux. |
Dan O'Reilly | 76f8a3f | 2015-08-21 18:51:47 -0400 | [diff] [blame] | 217 | if [ $(uname -s) == "Linux" ]; then |
| 218 | sudo apt-get install -y python-software-properties # for apt-add-repository |
| 219 | sudo apt-add-repository -y ppa:fkrull/deadsnakes |
| 220 | sudo apt-get update -qq |
| 221 | sudo apt-get install -y python2.6 python2.6-dev |
Dan O'Reilly | d9598ca | 2015-08-26 20:30:41 -0400 | [diff] [blame] | 222 | sudo apt-get install -y python3.3 python3.3-dev |
| 223 | sudo apt-get install -y python3.4 python3.4-dev |
Dan O'Reilly | 76f8a3f | 2015-08-21 18:51:47 -0400 | [diff] [blame] | 224 | fi |
Dan O'Reilly | 5de2a81 | 2015-08-20 18:19:56 -0400 | [diff] [blame] | 225 | } |
| 226 | |
Thomas Van Lenten | 9642b82 | 2015-06-10 17:21:23 -0400 | [diff] [blame] | 227 | build_objectivec_ios() { |
Thomas Van Lenten | 368a2f4 | 2016-05-24 11:27:33 -0400 | [diff] [blame] | 228 | # Reused the build script that takes care of configuring and ensuring things |
| 229 | # are up to date. The OS X test runs the objc conformance test, so skip it |
| 230 | # here. |
| 231 | # Note: travis has xctool installed, and we've looked at using it in the past |
| 232 | # but it has ended up proving unreliable (bugs), an they are removing build |
| 233 | # support in favor of xcbuild (or just xcodebuild). |
| 234 | objectivec/DevTools/full_mac_build.sh \ |
| 235 | --core-only --skip-xcode-osx --skip-objc-conformance "$@" |
| 236 | } |
| 237 | |
| 238 | build_objectivec_ios_debug() { |
| 239 | build_objectivec_ios --skip-xcode-release |
| 240 | } |
| 241 | |
| 242 | build_objectivec_ios_release() { |
| 243 | build_objectivec_ios --skip-xcode-debug |
Thomas Van Lenten | 9642b82 | 2015-06-10 17:21:23 -0400 | [diff] [blame] | 244 | } |
| 245 | |
| 246 | build_objectivec_osx() { |
Thomas Van Lenten | 368a2f4 | 2016-05-24 11:27:33 -0400 | [diff] [blame] | 247 | # Reused the build script that takes care of configuring and ensuring things |
| 248 | # are up to date. |
| 249 | objectivec/DevTools/full_mac_build.sh \ |
| 250 | --core-only --skip-xcode-ios |
Thomas Van Lenten | 9642b82 | 2015-06-10 17:21:23 -0400 | [diff] [blame] | 251 | } |
Dan O'Reilly | 5de2a81 | 2015-08-20 18:19:56 -0400 | [diff] [blame] | 252 | |
Sergio Campamá | f0c1492 | 2016-06-14 11:26:01 -0700 | [diff] [blame] | 253 | build_objectivec_cocoapods_integration() { |
| 254 | # First, load the RVM environment in bash, needed to update ruby. |
| 255 | source ~/.rvm/scripts/rvm |
Sergio Campamá | f6d1d1a | 2016-07-15 13:59:09 -0700 | [diff] [blame] | 256 | # Update rvm to the latest version. This is needed to solve |
| 257 | # https://github.com/google/protobuf/issues/1786 and may not be needed in the |
| 258 | # future when Travis updates the default version of rvm. |
| 259 | rvm get head |
Sergio Campamá | f0c1492 | 2016-06-14 11:26:01 -0700 | [diff] [blame] | 260 | # Update ruby to 2.2.3 as the default one crashes with segmentation faults |
| 261 | # when using pod. |
| 262 | rvm use 2.2.3 --install --binary --fuzzy |
| 263 | # Update pod to the latest version. |
| 264 | gem install cocoapods --no-ri --no-rdoc |
| 265 | objectivec/Tests/CocoaPods/run_tests.sh |
| 266 | } |
| 267 | |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 268 | build_python() { |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 269 | internal_build_cpp |
Dan O'Reilly | 5de2a81 | 2015-08-20 18:19:56 -0400 | [diff] [blame] | 270 | internal_install_python_deps |
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 |
Jie Luo | 2850a98 | 2015-10-09 17:07:03 -0700 | [diff] [blame] | 274 | envlist=py\{26,27,33,34\}-python |
Dan O'Reilly | 76f8a3f | 2015-08-21 18:51:47 -0400 | [diff] [blame] | 275 | else |
| 276 | envlist=py27-python |
| 277 | fi |
| 278 | tox -e $envlist |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 279 | cd .. |
| 280 | } |
| 281 | |
| 282 | build_python_cpp() { |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 283 | internal_build_cpp |
Dan O'Reilly | 5de2a81 | 2015-08-20 18:19:56 -0400 | [diff] [blame] | 284 | internal_install_python_deps |
| 285 | export LD_LIBRARY_PATH=../src/.libs # for Linux |
Tamir Duberstein | c91d9ab | 2015-05-14 21:32:39 -0400 | [diff] [blame] | 286 | export DYLD_LIBRARY_PATH=../src/.libs # for OS X |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 287 | cd python |
Dan O'Reilly | d9598ca | 2015-08-26 20:30:41 -0400 | [diff] [blame] | 288 | # Only test Python 2.6/3.x on Linux |
Dan O'Reilly | 76f8a3f | 2015-08-21 18:51:47 -0400 | [diff] [blame] | 289 | if [ $(uname -s) == "Linux" ]; then |
Jisi Liu | 72bd9c9 | 2015-10-06 10:48:57 -0700 | [diff] [blame] | 290 | # py26 is currently disabled due to json_format |
| 291 | envlist=py\{27,33,34\}-cpp |
Dan O'Reilly | 76f8a3f | 2015-08-21 18:51:47 -0400 | [diff] [blame] | 292 | else |
| 293 | envlist=py27-cpp |
| 294 | fi |
| 295 | tox -e $envlist |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 296 | cd .. |
| 297 | } |
| 298 | |
| 299 | build_ruby19() { |
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 ruby-1.9 && cd .. |
| 302 | } |
| 303 | build_ruby20() { |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 304 | internal_build_cpp # For conformance tests. |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 305 | cd ruby && bash travis-test.sh ruby-2.0 && cd .. |
| 306 | } |
| 307 | build_ruby21() { |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 308 | internal_build_cpp # For conformance tests. |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 309 | cd ruby && bash travis-test.sh ruby-2.1 && cd .. |
| 310 | } |
| 311 | build_ruby22() { |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 312 | internal_build_cpp # For conformance tests. |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 313 | cd ruby && bash travis-test.sh ruby-2.2 && cd .. |
| 314 | } |
| 315 | build_jruby() { |
Josh Haberman | 181c7f2 | 2015-07-15 11:05:10 -0700 | [diff] [blame] | 316 | internal_build_cpp # For conformance tests. |
Chris Fallin | 20e94b2 | 2015-05-13 16:43:48 -0700 | [diff] [blame] | 317 | cd ruby && bash travis-test.sh jruby && cd .. |
| 318 | } |
| 319 | |
Josh Haberman | e9cf31e | 2015-12-21 15:18:17 -0800 | [diff] [blame] | 320 | build_javascript() { |
| 321 | internal_build_cpp |
Josh Haberman | 0d2d8bc | 2015-12-28 06:43:42 -0800 | [diff] [blame] | 322 | cd js && npm install && npm test && cd .. |
Josh Haberman | e9cf31e | 2015-12-21 15:18:17 -0800 | [diff] [blame] | 323 | } |
| 324 | |
Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 325 | # Note: travis currently does not support testing more than one language so the |
| 326 | # .travis.yml cheats and claims to only be cpp. If they add multiple language |
| 327 | # support, this should probably get updated to install steps and/or |
| 328 | # rvm/gemfile/jdk/etc. entries rather than manually doing the work. |
| 329 | |
| 330 | # .travis.yml uses matrix.exclude to block the cases where app-get can't be |
| 331 | # use to install things. |
| 332 | |
| 333 | # -------- main -------- |
| 334 | |
Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 335 | if [ "$#" -ne 1 ]; then |
| 336 | echo " |
| 337 | Usage: $0 { cpp | |
Feng Xiao | a4f68b1 | 2016-07-19 17:20:31 -0700 | [diff] [blame] | 338 | cpp_distcheck | |
Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 339 | csharp | |
Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 340 | java_jdk7 | |
| 341 | java_oracle7 | |
Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 342 | javanano_jdk7 | |
| 343 | javanano_oracle7 | |
| 344 | objectivec_ios | |
Thomas Van Lenten | 368a2f4 | 2016-05-24 11:27:33 -0400 | [diff] [blame] | 345 | objectivec_ios_debug | |
| 346 | objectivec_ios_release | |
Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 347 | objectivec_osx | |
Sergio Campamá | f0c1492 | 2016-06-14 11:26:01 -0700 | [diff] [blame] | 348 | objectivec_cocoapods_integration | |
Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 349 | python | |
| 350 | python_cpp | |
Josh Haberman | ffc8118 | 2016-02-22 15:39:29 -0800 | [diff] [blame] | 351 | ruby19 | |
| 352 | ruby20 | |
| 353 | ruby21 | |
| 354 | ruby22 | |
Josh Haberman | 738393b | 2016-02-18 20:10:23 -0800 | [diff] [blame] | 355 | jruby } |
| 356 | " |
| 357 | exit 1 |
| 358 | fi |
| 359 | |
| 360 | set -e # exit immediately on error |
| 361 | set -x # display all commands |
| 362 | eval "build_$1" |