Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Ninja verbose build is not like the Makefile ones
[simgrid.git] / tools / jenkins / build.sh
index 8abe068..050c850 100755 (executable)
@@ -2,6 +2,13 @@
 
 # This script is used by various build projects on Jenkins
 
+case "$JENKINS_HOME" in
+*-qualif)
+  echo "Build skipped on $JENKINS_HOME."
+  exit 0
+  ;;
+esac
+
 # See https://ci.inria.fr/simgrid/job/SimGrid/configure
 # See https://ci.inria.fr/simgrid/job/Simgrid-Windows/configure
 
@@ -10,24 +17,15 @@ export LC_ALL=C
 
 echo "XXXX Cleanup previous attempts. Remaining content of /tmp:"
 rm -f /tmp/cc*
+rm -f /tmp/simgrid-mc-*
 rm -f /tmp/*.so
 rm -f /tmp/*.so.*
-rm -rf /tmp/simgrid-java*
-rm -rf /var/tmp/simgrid-java*
-rm -rf /tmp/jvm-*
-find $WORKSPACE -name "hs_err_pid*.log" -exec rm -f {} +
 ls /tmp
 df -h
 echo "XXXX Let's go"
 
 set -e
 
-# Help older cmakes
-if [ -e /usr/lib/jvm/java-7-openjdk-amd64 ] ;
-then
-  export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
-fi
-
 # usage: die status message...
 die () {
   status=${1:-1}
@@ -131,6 +129,13 @@ echo "Branch built is $branch_name"
 
 NUMBER_OF_PROCESSORS="$(nproc)" || NUMBER_OF_PROCESSORS=1
 GENERATOR="Unix Makefiles"
+BUILDER=make
+VERBOSE_BUILD="VERBOSE=1"
+if which ninja 2>/dev/null >/dev/null ; then
+  GENERATOR=Ninja
+  BUILDER=ninja
+  VERBOSE_BUILD="-v"
+fi
 
 ulimit -c 0 || true
 
@@ -146,7 +151,7 @@ mkdir "$WORKSPACE"/build
 cd "$WORKSPACE"/build
 
 have_NS3="no"
-if [ "$os" = "Debian" ] || [ "$os" = "Ubuntu" ] ; then
+if [ "$os" = "Debian" ] ; then
   if dpkg --compare-versions "$(dpkg-query -f '${Version}' -W libns3-dev)" ge 3.28; then
     have_NS3="yes"
   fi
@@ -171,7 +176,7 @@ echo "XX   pwd: $(pwd)"
 echo "XX"
 
 cmake -G"$GENERATOR" -Denable_documentation=OFF "$WORKSPACE"
-make dist -j $NUMBER_OF_PROCESSORS
+${BUILDER} dist -j $NUMBER_OF_PROCESSORS
 SIMGRID_VERSION=$(cat VERSION)
 
 echo "XX"
@@ -189,14 +194,6 @@ echo "XX   pwd: $(pwd)"
 echo "XX"
 set -x
 
-if cmake --version | grep -q 3\.11 ; then
-  # -DCMAKE_DISABLE_SOURCE_CHANGES=ON is broken with java on CMake 3.11
-  # https://gitlab.kitware.com/cmake/cmake/issues/17933
-  MAY_DISABLE_SOURCE_CHANGE=""
-else
-  MAY_DISABLE_SOURCE_CHANGE="-DCMAKE_DISABLE_SOURCE_CHANGES=ON"
-fi
-
 if [ "$os" = "CentOS" ]; then
     if [ "$(ld -v | cut -d\  -f4 | cut -c1-4)" = "2.30" ]; then
         echo "Temporary disable LTO, believed to be broken on this system."
@@ -204,10 +201,11 @@ if [ "$os" = "CentOS" ]; then
     else
         MAY_DISABLE_LTO=
     fi
-    if [ "$(rpm -q eigen3-devel --qf '%{VERSION}')" = "3.3.4" ]; then
-        echo "Temporary avoid build error seen with eigen3 version 3.3.4"
-        export CXXFLAGS=-Wno-error=int-in-bool-context
-    fi
+fi
+
+if [ $NODE_NAME = "armv8" ]; then
+    echo "disable LTO, believed to be too heavy for this particular system"
+    MAY_DISABLE_LTO=-Denable_lto=OFF
 fi
 
 cmake -G"$GENERATOR" ${INSTALL:+-DCMAKE_INSTALL_PREFIX=$INSTALL} \
@@ -221,14 +219,12 @@ cmake -G"$GENERATOR" ${INSTALL:+-DCMAKE_INSTALL_PREFIX=$INSTALL} \
   -Denable_compile_warnings=$(onoff test "$GENERATOR" != "MSYS Makefiles") -Denable_smpi=ON \
   -Denable_ns3=$(onoff test "$have_NS3" = "yes" -a "$build_mode" = "Debug") \
   -DSIMGRID_PYTHON_LIBDIR=${SIMGRID_PYTHON_LIBDIR} \
-  ${MAY_DISABLE_SOURCE_CHANGE} ${MAY_DISABLE_LTO} \
-  -Denable_java=$(onoff test "$build_mode" = "ModelChecker") \
-  -Denable_msg=$(onoff test "$build_mode" = "ModelChecker") \
+  -DCMAKE_DISABLE_SOURCE_CHANGES=ON ${MAY_DISABLE_LTO} \
   -DLTO_EXTRA_FLAG="auto" \
+  -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
   "$SRCFOLDER"
-set +x
 
-make -j $NUMBER_OF_PROCESSORS VERBOSE=1 tests
+${BUILDER} -j $NUMBER_OF_PROCESSORS ${VERBOSE_BUILD} tests
 
 echo "XX"
 echo "XX Run the tests"
@@ -244,7 +240,7 @@ if test -n "$INSTALL" && [ "${branch_name}" = "origin/master" ] ; then
 
   rm -rf "$INSTALL"
 
-  make install
+  ${BUILDER} install
 fi
 
 echo "XX"