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