aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Haberman <jhaberman@gmail.com>2016-03-03 16:02:55 -0800
committerJosh Haberman <jhaberman@gmail.com>2016-03-03 16:27:51 -0800
commit1ee0fda556b252944e7dd140ad0cd7b8949eb496 (patch)
treecceb0f1f780a31231dac1c7597ec28c290b6a059
parent2f3f1de16debdff284792367245d5ba0e9310b35 (diff)
downloadprotobuf-1ee0fda556b252944e7dd140ad0cd7b8949eb496.tar.gz
protobuf-1ee0fda556b252944e7dd140ad0cd7b8949eb496.tar.bz2
protobuf-1ee0fda556b252944e7dd140ad0cd7b8949eb496.zip
Use a local Maven repository to avoid network fetches during tests.
-rw-r--r--tools/docker/Dockerfile26
-rwxr-xr-xtools/run_tests/tests.sh5
2 files changed, 31 insertions, 0 deletions
diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
index bceb6044..b7621f67 100644
--- a/tools/docker/Dockerfile
+++ b/tools/docker/Dockerfile
@@ -116,7 +116,11 @@ RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc"
RUN /bin/bash -l -c "echo 'rvm --default use ruby-2.1' >> ~/.bashrc"
RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc"
+##################
# Prepare ccache
+
+# We do this BEFORE the Java dependency step below, so the build of protoc
+# can benefit from it.
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
@@ -124,5 +128,27 @@ 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++
+
+##################
+# Java dependencies
+
+# This step requires compiling protoc. :(
+
+ENV MAVEN_REPO /var/maven_local_repository
+ENV MVN mvn --batch-mode
+
+RUN cd /tmp && \
+ git clone https://github.com/google/protobuf.git && \
+ cd protobuf && \
+ ./autogen.sh && \
+ ./configure && \
+ make -j6 && \
+ cd java && \
+ $MVN install dependency:go-offline -Dmaven.repo.local=$MAVEN_REPO -P lite && \
+ $MVN install dependency:go-offline -Dmaven.repo.local=$MAVEN_REPO && \
+ cd ../javanano && \
+ $MVN install dependency:go-offline -Dmaven.repo.local=$MAVEN_REPO
+
+
# Define the default command.
CMD ["bash"]
diff --git a/tools/run_tests/tests.sh b/tools/run_tests/tests.sh
index 4b2aef77..c28a5daa 100755
--- a/tools/run_tests/tests.sh
+++ b/tools/run_tests/tests.sh
@@ -104,6 +104,11 @@ use_java() {
;;
esac
+ if [ "$TRAVIS" != "true" ]; then
+ MAVEN_LOCAL_REPOSITORY=/var/maven_local_repository
+ MVN="$MVN -e -X --offline -Dmaven.repo.local=$MAVEN_LOCAL_REPOSITORY"
+ fi;
+
which java
java -version
}