Kaynağa Gözat

Added ccache support.

Josh Haberman 9 yıl önce
ebeveyn
işleme
d33e93b833

+ 9 - 0
tools/docker/Dockerfile

@@ -36,6 +36,7 @@ RUN apt-get update && apt-get install -y \
   autotools-dev \
   build-essential \
   bzip2 \
+  ccache \
   curl \
   gcc \
   git \
@@ -53,5 +54,13 @@ RUN apt-get update && apt-get install -y \
   wget \
   zip && apt-get clean
 
+# Prepare ccache
+RUN ln -s /usr/bin/ccache /usr/local/bin/gcc
+RUN ln -s /usr/bin/ccache /usr/local/bin/g++
+RUN ln -s /usr/bin/ccache /usr/local/bin/cc
+RUN ln -s /usr/bin/ccache /usr/local/bin/c++
+RUN ln -s /usr/bin/ccache /usr/local/bin/clang
+RUN ln -s /usr/bin/ccache /usr/local/bin/clang++
+
 # Define the default command.
 CMD ["bash"]

+ 4 - 0
tools/run_tests/jenkins.sh

@@ -5,9 +5,13 @@ BUILD_DIR=/tmp/protobuf
 
 source $MY_DIR/tests.sh
 
+# Set value used in tests.sh.
+PARALLELISM=-j8
+
 rm -rf $BUILD_DIR
 mkdir -p $BUILD_DIR
 cd $BUILD_DIR
 git clone /var/local/jenkins/protobuf
 cd protobuf
+
 build_cpp

+ 4 - 4
tools/run_tests/tests.sh

@@ -4,7 +4,7 @@
 # For when some other test needs the C++ main build, including protoc and
 # libprotobuf.
 internal_build_cpp() {
-  if [ $(uname -s) == "Linux" && "$TRAVIS" == "true" ]; then
+  if [[ $(uname -s) == "Linux" && "$TRAVIS" == "true" ]]; then
     # Install GCC 4.8 to replace the default GCC 4.6. We need 4.8 for more
     # decent C++ 11 support in order to compile conformance tests.
     sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
@@ -15,19 +15,19 @@ internal_build_cpp() {
 
   ./autogen.sh
   ./configure
-  make -j2
+  make $PARALLELISM
 }
 
 build_cpp() {
   internal_build_cpp
-  make check -j2
+  make check $PARALLELISM
   cd conformance && make test_cpp && cd ..
 }
 
 build_cpp_distcheck() {
   ./autogen.sh
   ./configure
-  make distcheck -j2
+  make distcheck $PARALLELISM
 }
 
 build_csharp() {

+ 5 - 2
tools/run_tests/travis.sh

@@ -1,8 +1,8 @@
 #!/usr/bin/env bash
 
-my_dir="$(dirname "$0")"
+MY_DIR="$(dirname "$0")"
 
-source $my_dir/tests.sh
+source $MY_DIR/tests.sh
 
 # Note: travis currently does not support testing more than one language so the
 # .travis.yml cheats and claims to only be cpp.  If they add multiple language
@@ -14,6 +14,9 @@ source $my_dir/tests.sh
 
 # -------- main --------
 
+# Set value used in tests.sh.
+PARALLELISM=-j2
+
 if [ "$#" -ne 1 ]; then
   echo "
 Usage: $0 { cpp |