From 4b76b3b8a6e476337c16de682b34ce668ecef954 Mon Sep 17 00:00:00 2001 From: Damien Doligez Date: Mon, 19 Dec 2016 15:49:23 +0100 Subject: [PATCH] A variant of CI golf: ci-build-script golf. Try to make the CI build work in the directory checked out by Jenkins, even for Windows (with CRLF line endings). Also adapt to the new unified Makefiles (where Makefile.nt is gone). --- tools/ci-build | 50 +++++++++++++++++++++----------------------------- 1 file changed, 21 insertions(+), 29 deletions(-) diff --git a/tools/ci-build b/tools/ci-build index bbee86b5b..3c6ff84ea 100755 --- a/tools/ci-build +++ b/tools/ci-build @@ -20,12 +20,12 @@ # arguments: # 1. architecture: bsd, macos, linux, cygwin, mingw, mingw64, msvc, msvc64 # 2. directory in which to build (trunk, 4.02, etc) -# for windows, this is relative to $HOME/jenkins-workspace -# for bsd, macos, linux, this is ignored and the build is always in . +# If this is "." then build in the Jenkins-checked out directory +# Otherwise, go to $HOME/jenkins-workspace/ and check out a +# fresh copy of the branch, then build there. # 3. options: # -conf configure-option add configure-option to configure cmd line # -patch1 file-name apply patch with -p1 -# -newmakefiles do not use Makefile.nt even for Windows # -no-native do not build "opt" and "opt.opt" error () { @@ -82,50 +82,40 @@ set -ex # default values make=make instdir="$HOME/ocaml-tmp-install" -docheckout=false makefile=Makefile configure=unix +case "$branch" in + .) workdir=. + docheckout=false + ;; + *) workdir="$HOME/jenkins-workspace/$branch" + docheckout=true + ;; +esac + case "$arch" in - bsd) - make=gmake - workdir=. - ;; - macos) - workdir=. - ;; - linux) - workdir=. - ;; - cygwin) - workdir="$HOME/jenkins-workspace/$branch" - docheckout=true - ;; + bsd) make=gmake ;; + macos) ;; + linux) ;; + cygwin) ;; mingw) instdir=/cygdrive/c/ocamlmgw - workdir="$HOME/jenkins-workspace/$branch" - docheckout=true makefile=Makefile.nt configure=nt ;; mingw64) instdir=/cygdrive/c/ocamlmgw64 - workdir="$HOME/jenkins-workspace/$branch" - docheckout=true makefile=Makefile.nt configure=nt ;; msvc) instdir=/cygdrive/c/ocamlms - workdir="$HOME/jenkins-workspace/$branch" - docheckout=true makefile=Makefile.nt configure=nt ;; msvc64) instdir=/cygdrive/c/ocamlms64 - workdir="$HOME/jenkins-workspace/$branch" - docheckout=true makefile=Makefile.nt configure=nt ;; @@ -138,6 +128,9 @@ esac pwd cd "$workdir" +# If Makefile.nt is absent, assume the new makefile system. +if ! [ -f $makefile ]; then makefile=Makefile; fi + ######################################################################### # parse optional command-line arguments (has to be done after the "cd") @@ -147,7 +140,6 @@ while [ $# -gt 0 ]; do case $1 in -conf) confoptions="$confoptions `quote1 "$2"`"; shift;; -patch1) patch -f -p1 <"$2"; shift;; - -newmakefiles) makefile=Makefile;; -no-native) make_native=false;; *) error "unknown option $1";; esac @@ -163,8 +155,8 @@ export LC_ALL=C $make -f $makefile distclean || : if $docheckout; then - git checkout boot/ocamlc boot/ocamllex boot/ocamldep - git pull + git fetch origin + git reset --hard FETCH_HEAD fi case $configure in