1language: android 2 3env: 4 global: 5 - BORINGSSL_HOME="$HOME/boringssl" 6 - CXXFLAGS="-std=c++11" 7 - GOOGLE_JAVA_FORMAT_VERSION=1.1 8 9cache: 10 directories: 11 - $HOME/.gradle/caches/ 12 - $HOME/.gradle/wrapper/dists/ 13 14matrix: 15 include: 16 ### 17 ### Linux build is the only platform that builds Android here. 18 ### 19 - os: linux 20 jdk: openjdk8 21 sudo: false 22 23 env: 24 - ANDROID_TOOLS_URL="https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip" 25 - ANDROID_HOME="$HOME/android-sdk-linux" 26 - ANDROID_NDK_HOME="$ANDROID_HOME/ndk-bundle" 27 - JAVA7_HOME=/usr/lib/jvm/java-7-openjdk-amd64 28 - CC=clang-5.0 29 - CXX=clang++-5.0 30 31 before_install: 32 - curl -L $ANDROID_TOOLS_URL -o $HOME/tools.zip 33 - unzip -q $HOME/tools.zip -d $ANDROID_HOME 34 # Accept all the license agreements 35 - yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses 36 # sdkmanager 26.1.1 produces an enormous amount of progress info 37 # Append tr '\r' '\n' | uniq to all the commands to suppress it 38 - $ANDROID_HOME/tools/bin/sdkmanager tools | tr '\r' '\n' | uniq 39 - $ANDROID_HOME/tools/bin/sdkmanager platform-tools | tr '\r' '\n' | uniq 40 - $ANDROID_HOME/tools/bin/sdkmanager 'build-tools;27.0.3' | tr '\r' '\n' | uniq 41 - $ANDROID_HOME/tools/bin/sdkmanager 'platforms;android-26' | tr '\r' '\n' | uniq 42 - $ANDROID_HOME/tools/bin/sdkmanager 'extras;android;m2repository' | tr '\r' '\n' | uniq 43 - $ANDROID_HOME/tools/bin/sdkmanager ndk-bundle | tr '\r' '\n' | uniq 44 - $ANDROID_HOME/tools/bin/sdkmanager 'cmake;3.6.4111459' | tr '\r' '\n' | uniq 45 46 addons: 47 apt: 48 sources: 49 - kalakris-cmake 50 - llvm-toolchain-trusty-5.0 51 - ubuntu-toolchain-r-test 52 packages: 53 - clang-5.0 54 - clang-format-5.0 # for style checks 55 - cmake 56 - g++-multilib 57 - gcc-multilib 58 - libc6-dev-i386 59 - libc6-dev:i386 60 - ninja-build 61 - openjdk-7-jre # for running tests with Java 7 62 63 ### 64 ### MacOS build only does x86-64. 65 ### 66 - os: osx 67 osx_image: xcode8 68 env: 69 - CC=clang 70 - CXX=clang++ 71 72 before_install: 73 - brew update 74 - brew install ninja 75 - export JAVA_HOME=`/usr/libexec/java_home -v 1.8` 76 77before_cache: 78 - find $HOME/.gradle -name "*.lock" -exec rm {} \; 79 - rm -rf $HOME/.gradle/caches/[1-9]* 80 81before_script: 82 # Get Google Java Format 83 - curl -L https://github.com/google/google-java-format/releases/download/google-java-format-1.1/google-java-format-${GOOGLE_JAVA_FORMAT_VERSION}-all-deps.jar -o $HOME/gjf.jar 84 85 # get BoringSSL 86 - mkdir $BORINGSSL_HOME 87 - git clone --depth 1 https://boringssl.googlesource.com/boringssl $BORINGSSL_HOME 88 89 # Build BoringSSL for 64-bit 90 - mkdir $BORINGSSL_HOME/build64 && pushd $BORINGSSL_HOME/build64 91 - cmake -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE -DCMAKE_BUILD_TYPE=Release -DCMAKE_ASM_FLAGS=-Wa,--noexecstack -GNinja .. 92 - ninja 93 - popd 94 95 # Get git-clang-format 96 - if [ ! -d "$HOME/bin" ]; then mkdir $HOME/bin; fi 97 - curl -L https://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/git-clang-format -o $HOME/bin/git-clang-format 98 - chmod 0755 $HOME/bin/git-clang-format 99 - export PATH="$HOME/bin:$PATH" 100 101 # We need this to find the merge-base 102 - if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PULL_REQUEST" != "false" ]]; 103 then 104 git fetch origin +refs/heads/${TRAVIS_BRANCH}:refs/remotes/origin/${TRAVIS_BRANCH}; 105 fi 106 107script: 108 # MacOS (BSD) xargs is missing some nice features that make this easy, so skip it. 109 - if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PULL_REQUEST" != "false" ]]; 110 then 111 git rev-list $(git merge-base HEAD origin/master)..HEAD | xargs -i git clang-format --binary=$(which clang-format-5.0) --style=file --diff {}^ {} | ( git apply; true ) && git diff --exit-code || { git reset --hard; false; } 112 fi 113 - if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PULL_REQUEST" != "false" ]]; 114 then 115 git rev-list $(git merge-base HEAD origin/master)..HEAD | xargs -i git diff-tree --no-commit-id --name-only -r {} | grep -E '\.java$' | xargs -r git ls-files | xargs -r java -jar $HOME/gjf.jar -a -i --fix-imports-only && git diff --exit-code || { git reset --hard; false; } 116 fi 117 118 - ./gradlew build -PcheckErrorQueue 119 120 # Also test with Java 7 on linux 121 - if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PULL_REQUEST" != "false" ]]; 122 then 123 ${JAVA7_HOME}/bin/java -version; 124 fi 125 - if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PULL_REQUEST" != "false" ]]; 126 then 127 ./gradlew check -DjavaExecutable64=${JAVA7_HOME}/bin/java -PcheckErrorQueue; 128 fi 129 130after_script: 131 - "[ -f android/build/outputs/lint-results-debug.xml ] && cat android/build/outputs/lint-results-debug.xml" 132