From c6d2a7f8215a34090de4907849a51595391cd79c Mon Sep 17 00:00:00 2001 From: Adam Retter Date: Mon, 23 Jul 2018 13:24:50 -0700 Subject: [PATCH] Build improvements: Split docker targets and parallelize java builds Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/4165 Differential Revision: D8955531 Pulled By: sagar0 fbshipit-source-id: 97d5a1375e200bde3c6414f94703504a4ed7536a --- Makefile | 24 ++++++++++++-------- java/crossbuild/build-linux-centos.sh | 2 +- java/crossbuild/docker-build-linux-centos.sh | 4 ++-- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index ea8069b29..b25fbff4e 100644 --- a/Makefile +++ b/Makefile @@ -1760,20 +1760,26 @@ rocksdbjavastaticrelease: rocksdbjavastatic cd java/target;jar -uf $(ROCKSDB_JAR_ALL) librocksdbjni-*.so librocksdbjni-*.jnilib cd java/target/classes;jar -uf ../$(ROCKSDB_JAR_ALL) org/rocksdb/*.class org/rocksdb/util/*.class -rocksdbjavastaticreleasedocker: rocksdbjavastatic - DOCKER_LINUX_X64_CONTAINER=`docker ps -aqf name=rocksdb_linux_x64-be`; \ - if [ -z "$$DOCKER_LINUX_X64_CONTAINER" ]; then \ - docker container create --attach stdin --attach stdout --attach stderr --volume `pwd`:/rocksdb-host --name rocksdb_linux_x64-be evolvedbinary/rocksjava:centos6_x64-be /rocksdb-host/java/crossbuild/docker-build-linux-centos.sh; \ - fi - docker start -a rocksdb_linux_x64-be +rocksdbjavastaticreleasedocker: rocksdbjavastatic rocksdbjavastaticdockerx86 rocksdbjavastaticdockerx86_64 + cd java;jar -cf target/$(ROCKSDB_JAR_ALL) HISTORY*.md + cd java/target;jar -uf $(ROCKSDB_JAR_ALL) librocksdbjni-*.so librocksdbjni-*.jnilib + cd java/target/classes;jar -uf ../$(ROCKSDB_JAR_ALL) org/rocksdb/*.class org/rocksdb/util/*.class + +rocksdbjavastaticdockerx86: + mkdir -p java/target DOCKER_LINUX_X86_CONTAINER=`docker ps -aqf name=rocksdb_linux_x86-be`; \ if [ -z "$$DOCKER_LINUX_X86_CONTAINER" ]; then \ docker container create --attach stdin --attach stdout --attach stderr --volume `pwd`:/rocksdb-host --name rocksdb_linux_x86-be evolvedbinary/rocksjava:centos6_x86-be /rocksdb-host/java/crossbuild/docker-build-linux-centos.sh; \ fi docker start -a rocksdb_linux_x86-be - cd java;jar -cf target/$(ROCKSDB_JAR_ALL) HISTORY*.md - cd java/target;jar -uf $(ROCKSDB_JAR_ALL) librocksdbjni-*.so librocksdbjni-*.jnilib - cd java/target/classes;jar -uf ../$(ROCKSDB_JAR_ALL) org/rocksdb/*.class org/rocksdb/util/*.class + +rocksdbjavastaticdockerx86_64: + mkdir -p java/target + DOCKER_LINUX_X64_CONTAINER=`docker ps -aqf name=rocksdb_linux_x64-be`; \ + if [ -z "$$DOCKER_LINUX_X64_CONTAINER" ]; then \ + docker container create --attach stdin --attach stdout --attach stderr --volume `pwd`:/rocksdb-host --name rocksdb_linux_x64-be evolvedbinary/rocksjava:centos6_x64-be /rocksdb-host/java/crossbuild/docker-build-linux-centos.sh; \ + fi + docker start -a rocksdb_linux_x64-be rocksdbjavastaticdockerppc64le: mkdir -p java/target diff --git a/java/crossbuild/build-linux-centos.sh b/java/crossbuild/build-linux-centos.sh index 98f8da681..c532398f6 100755 --- a/java/crossbuild/build-linux-centos.sh +++ b/java/crossbuild/build-linux-centos.sh @@ -26,6 +26,6 @@ export JAVA_HOME=/usr/lib/jvm/java-1.7.0 # build rocksdb cd /rocksdb scl enable devtoolset-2 'make jclean clean' -scl enable devtoolset-2 'PORTABLE=1 make rocksdbjavastatic' +scl enable devtoolset-2 'PORTABLE=1 make -j8 rocksdbjavastatic' cp /rocksdb/java/target/librocksdbjni-* /rocksdb-build cp /rocksdb/java/target/rocksdbjni-* /rocksdb-build diff --git a/java/crossbuild/docker-build-linux-centos.sh b/java/crossbuild/docker-build-linux-centos.sh index be0999bc7..6353b9ea2 100755 --- a/java/crossbuild/docker-build-linux-centos.sh +++ b/java/crossbuild/docker-build-linux-centos.sh @@ -9,10 +9,10 @@ cd /rocksdb-local # Use scl devtoolset if available (i.e. CentOS <7) if hash scl 2>/dev/null; then scl enable devtoolset-2 'make jclean clean' - scl enable devtoolset-2 'PORTABLE=1 make rocksdbjavastatic' + scl enable devtoolset-2 'PORTABLE=1 make -j8 rocksdbjavastatic' else make jclean clean - PORTABLE=1 make rocksdbjavastatic + PORTABLE=1 make -j8 rocksdbjavastatic fi cp java/target/librocksdbjni-linux*.so java/target/rocksdbjni-*-linux*.jar /rocksdb-host/java/target