summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Allsopp <david.allsopp@metastack.com>2017-09-29 15:02:42 +0100
committerDavid Allsopp <david.allsopp@metastack.com>2017-10-01 12:20:11 +0100
commit3e805f173a560862e35da4e08470e125ff2c829e (patch)
tree16868586852047f9e85976ab5d88718d60f0ff7a
parent5b1cffc2f3ee3ddf55a4f15e45a82dce7d70a3c0 (diff)
downloadocaml-3e805f173a560862e35da4e08470e125ff2c829e.tar.gz
Move AppVeyor commands to a script
Gets rid of all the silly escaping requirements of appveyor.yml and allows a certain level of refactoring. Most functionality is moved to appveyor_build.sh with appveyor_build.cmd setting things up.
-rw-r--r--.gitattributes4
-rw-r--r--appveyor.yml40
-rw-r--r--appveyor_build.cmd78
-rw-r--r--appveyor_build.sh156
4 files changed, 172 insertions, 106 deletions
diff --git a/.gitattributes b/.gitattributes
index 2d1ee0fa60..8c2d4e3b80 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -44,7 +44,9 @@ README* ocaml-typo=missing-header
/Changes ocaml-typo=non-ascii,missing-header
/INSTALL ocaml-typo=missing-header
/LICENSE ocaml-typo=long-line,very-long-line,missing-header
-/appveyor.yml ocaml-typo=long-line,very-long-line
+# appveyor_build.cmd only has missing-header because dra27 too lazy to update
+# check-typo to interpret Cmd-style comments!
+/appveyor_build.cmd ocaml-typo=long-line,very-long-line,missing-header
asmcomp/*/emit.mlp ocaml-typo=tab,long-line,unused-prop
diff --git a/appveyor.yml b/appveyor.yml
index f9c752c47e..02cb25f94f 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -34,42 +34,12 @@ cache:
- C:\cygwin64\var\cache\setup
install:
- - mkdir "%OCAMLROOT%/bin/flexdll"
- - appveyor DownloadFile "http://alain.frisch.fr/flexdll/flexdll-bin-0.35.zip" -FileName "flexdll.zip"
- - appveyor DownloadFile "http://alain.frisch.fr/flexdll/flexdll-0.35.tar.gz" -FileName "flexdll.tar.gz"
- - mkdir C:\projects\flexdll-tmp
- - cd C:\projects\flexdll-tmp
- - unzip -q /c/projects/ocaml/flexdll.zip
- - for %%F in (flexdll.h flexlink.exe default_amd64.manifest) do copy %%F "%OCAMLROOT%\bin\flexdll"
- - cd ..
- # Make sure the Cygwin path comes before the Git one (otherwise
- # cygpath behaves crazily), but after the MSVC one.
- - set Path=C:\cygwin64\bin;%OCAMLROOT%\bin\flexdll;%Path%
- - '%CYG_ROOT%\bin\bash -lc "cygcheck -dc cygwin"'
- - '"%CYG_ROOT%\setup-x86_64.exe" -qgnNdO -R "%CYG_ROOT%" -s "%CYG_MIRROR%" -l "%CYG_CACHE%" -P diffutils -P make -P mingw64-i686-gcc-core >NUL'
- - '%CYG_ROOT%\bin\bash -lc "cygcheck -dc cygwin"'
- - set OCAML_PREV_PATH=%PATH%
- - set OCAML_PREV_LIB=%LIB%
- - set OCAML_PREV_INCLUDE=%INCLUDE%
- - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
+# This is a hangover from monitoring effects of MPR#7452
+ - wmic cpu get name
+ - call "%APPVEYOR_BUILD_FOLDER%\appveyor_build.cmd" install
build_script:
- - "%CYG_ROOT%/bin/bash -lc \"echo 'eval $($APPVEYOR_BUILD_FOLDER/tools/msvs-promote-path)' >> ~/.bash_profile\""
- - '%CYG_ROOT%/bin/bash -lc "$APPVEYOR_BUILD_FOLDER/appveyor_build.sh"'
- - set PATH=%OCAML_PREV_PATH%
- - set LIB=%OCAML_PREV_LIB%
- - set INCLUDE=%OCAML_PREV_INCLUDE%
- - call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86
- - '%CYG_ROOT%/bin/bash -lc "$APPVEYOR_BUILD_FOLDER/appveyor_build.sh msvc32-only"'
+ - call "%APPVEYOR_BUILD_FOLDER%\appveyor_build.cmd" build
test_script:
- - set PATH=%OCAML_PREV_PATH%
- - set LIB=%OCAML_PREV_LIB%
- - set INCLUDE=%OCAML_PREV_INCLUDE%
- - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
- - '%APPVEYOR_BUILD_FOLDER%\ocamlc.opt -version'
- - set CAML_LD_LIBRARY_PATH=%OCAMLROOT%/lib/stublibs
- - '%CYG_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER && make tests"'
- - '%CYG_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER/../build-mingw32 && make tests"'
- - '%CYG_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER && make install"'
- - '%CYG_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER/../build-mingw32 && make install"'
+ - call "%APPVEYOR_BUILD_FOLDER%\appveyor_build.cmd" test
diff --git a/appveyor_build.cmd b/appveyor_build.cmd
new file mode 100644
index 0000000000..2562d78bf3
--- /dev/null
+++ b/appveyor_build.cmd
@@ -0,0 +1,78 @@
+@rem ***********************************************************************
+@rem * *
+@rem * OCaml *
+@rem * *
+@rem * David Allsopp, OCaml Labs, Cambridge. *
+@rem * *
+@rem * Copyright 2017 MetaStack Solutions Ltd. *
+@rem * *
+@rem * All rights reserved. This file is distributed under the terms of *
+@rem * the GNU Lesser General Public License version 2.1, with the *
+@rem * special exception on linking described in the file LICENSE. *
+@rem * *
+@rem ***********************************************************************
+
+@rem BE CAREFUL ALTERING THIS FILE TO ENSURE THAT ERRORS PROPAGATE
+@rem IF A COMMAND SHOULD FAIL IT PROBABLY NEEDS TO END WITH
+@rem || exit /b 1
+@rem BASICALLY, DO THE TESTING IN BASH...
+
+@rem Do not call setlocal!
+@echo off
+
+goto %1
+
+goto :EOF
+
+:SaveVars
+set OCAML_PREV_PATH=%PATH%
+set OCAML_PREV_LIB=%LIB%
+set OCAML_PREV_INCLUDE=%INCLUDE%
+goto :EOF
+
+:RestoreVars
+set PATH=%OCAML_PREV_PATH%
+set LIB=%OCAML_PREV_LIB%
+set INCLUDE=%OCAML_PREV_INCLUDE%
+goto :EOF
+
+:install
+rem appveyor DownloadFile "http://alain.frisch.fr/flexdll/flexdll-0.35.tar.gz" -FileName "flexdll.tar.gz" || exit /b 1
+appveyor DownloadFile "http://alain.frisch.fr/flexdll/flexdll-bin-0.35.zip" -FileName "flexdll.zip" || exit /b 1
+rem flexdll.zip is processed here, rather than in appveyor_build.sh because the
+rem unzip command comes from MSYS2 (via Git for Windows) and it has to be
+rem invoked via cmd /c in a bash script which is weird(er).
+mkdir "%APPVEYOR_BUILD_FOLDER%\..\flexdll"
+move flexdll.zip "%APPVEYOR_BUILD_FOLDER%\..\flexdll"
+cd "%APPVEYOR_BUILD_FOLDER%\..\flexdll" && unzip -q flexdll.zip
+
+rem Make sure the Cygwin path comes before the Git one (otherwise cygpath
+rem gets confused as to which root it's in).
+set Path=C:\cygwin64\bin;%OCAMLROOT%\bin\flexdll;%Path%
+"%CYG_ROOT%\bin\bash.exe" -lc "cygcheck -dc cygwin"
+"%CYG_ROOT%\setup-x86_64.exe" -qgnNdO -R "%CYG_ROOT%" -s "%CYG_MIRROR%" -l "%CYG_CACHE%" -P diffutils -P make -P mingw64-i686-gcc-core >NUL || exit /b 1
+"%CYG_ROOT%\bin\bash.exe" -lc "cygcheck -dc cygwin"
+"%CYG_ROOT%\bin\bash.exe" -lec "$APPVEYOR_BUILD_FOLDER/appveyor_build.sh install" || exit /b 1
+
+call :SaveVars
+goto :EOF
+
+:build
+rem Run the msvc64 and mingw32 builds
+call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
+"%CYG_ROOT%\bin\bash.exe" -lec "$APPVEYOR_BUILD_FOLDER/appveyor_build.sh" || exit /b 1
+
+rem Reconfigure the environment and run the msvc32 partial build
+call :RestoreVars
+call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86
+"%CYG_ROOT%\bin\bash.exe" -lec "$APPVEYOR_BUILD_FOLDER/appveyor_build.sh msvc32-only" || exit /b 1
+goto :EOF
+
+:test
+rem Reconfigure the environment for the msvc64 build
+call :RestoreVars
+call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
+"%APPVEYOR_BUILD_FOLDER%\ocamlc.opt" -version || exit /b 1
+set CAML_LD_LIBRARY_PATH=%OCAMLROOT%/lib/stublibs
+"%CYG_ROOT%\bin\bash.exe" -lec "$APPVEYOR_BUILD_FOLDER/appveyor_build.sh test" || exit /b 1
+goto :EOF
diff --git a/appveyor_build.sh b/appveyor_build.sh
index 8148613439..b0a95ac06a 100644
--- a/appveyor_build.sh
+++ b/appveyor_build.sh
@@ -27,73 +27,89 @@ function run {
fi
}
-PREFIX="C:/Program Files/OCaml"
-
-wmic cpu get name
-
-if [[ $1 = "msvc32-only" ]] ; then
-# cd $APPVEYOR_BUILD_FOLDER/flexdll-0.35
-# make MSVC_DETECT=0 CHAINS=msvc MSVC_FLAGS="-nologo -MD -D_CRT_NO_DEPRECATE -GS- -WX" support
-# cp flexdll*_msvc.obj "$PREFIX/bin/flexdll"
-
- cd $APPVEYOR_BUILD_FOLDER/../build-msvc32
- cp config/m-nt.h byterun/caml/m.h
- cp config/s-nt.h byterun/caml/s.h
-
- eval $(tools/msvs-promote-path)
-
- PREFIX="C:/Program Files/OCaml-msmvc32"
- echo "Edit config/Makefile to set PREFIX=$PREFIX"
- sed -e "s|PREFIX=.*|PREFIX=$PREFIX|" -e "/^ *CFLAGS *=/s/\r\?$/ -WX\0/" config/Makefile.msvc > config/Makefile
-
- git submodule update --init flexdll
- run "make flexdll" make flexdll
- run "make world" make world
- run "make runtimeopt" make runtimeopt
- run "make -C otherlibs/systhreads libthreadsnat.lib" make -C otherlibs/systhreads libthreadsnat.lib
-
- exit 0
-fi
-
-cd $APPVEYOR_BUILD_FOLDER
-
-git worktree add ../build-mingw32 -b appveyor-build-mingw32
-git worktree add ../build-msvc32 -b appveyor-build-msvc32
-
-cd ../build-mingw32
-git submodule update --init flexdll
-
-cd $APPVEYOR_BUILD_FOLDER
-
-# tar -xzf flexdll.tar.gz
-# cd flexdll-0.35
-# make MSVC_DETECT=0 CHAINS=msvc64 support
-# cp flexdll*_msvc64.obj "$PREFIX/bin/flexdll"
-# cd ..
-
-cp config/m-nt.h byterun/caml/m.h
-cp config/s-nt.h byterun/caml/s.h
-
-echo "Edit config/Makefile to set PREFIX=$PREFIX"
-sed -e "s|PREFIX=.*|PREFIX=$PREFIX|" -e "/^ *CFLAGS *=/s/\r\?$/ -WX\0/" config/Makefile.msvc64 > config/Makefile
-#run "Content of config/Makefile" cat config/Makefile
-
-git submodule update --init flexdll
-run "make flexdll" make flexdll
-run "make world" make world
-run "make bootstrap" make bootstrap
-run "make opt" make opt
-run "make opt.opt" make opt.opt
-
-cd ../build-mingw32
-
-cp config/m-nt.h byterun/caml/m.h
-cp config/s-nt.h byterun/caml/s.h
-
-PREFIX="C:/Program Files/OCaml-mingw32"
-echo "Edit config/Makefile to set PREFIX=$PREFIX"
-sed -e "s|PREFIX=.*|PREFIX=$PREFIX|" -e "/^ *CFLAGS *=/s/\r\?$/ -Werror\0/" config/Makefile.mingw > config/Makefile
-#run "Content of config/Makefile" cat config/Makefile
-
-run "make flexdll" make flexdll
-run "make world.opt" make world.opt
+PREFIX=$(echo $OCAMLROOT| cygpath -f - -m)
+APPVEYOR_BUILD_FOLDER=$(echo $APPVEYOR_BUILD_FOLDER| cygpath -f -)
+
+case "$1" in
+ install)
+ mkdir -p "$PREFIX/bin/flexdll"
+ cd $APPVEYOR_BUILD_FOLDER/../flexdll
+ for f in flexdll.h flexlink.exe default_amd64.manifest ; do
+ cp $f "$PREFIX/bin/flexdll/$f"
+ done
+ echo 'eval $($APPVEYOR_BUILD_FOLDER/tools/msvs-promote-path)' >> ~/.bash_profile
+ ;;
+ msvc32-only)
+# cd $APPVEYOR_BUILD_FOLDER/flexdll-0.35
+# make MSVC_DETECT=0 CHAINS=msvc MSVC_FLAGS="-nologo -MD -D_CRT_NO_DEPRECATE -GS- -WX" support
+# cp flexdll*_msvc.obj "$PREFIX/bin/flexdll"
+
+ cd $APPVEYOR_BUILD_FOLDER/../build-msvc32
+ cp config/m-nt.h byterun/caml/m.h
+ cp config/s-nt.h byterun/caml/s.h
+
+ PREFIX="C:/Program Files/OCaml-msvc32"
+ echo "Edit config/Makefile to set PREFIX=$PREFIX"
+ sed -e "s|PREFIX=.*|PREFIX=$PREFIX|" -e "/^ *CFLAGS *=/s/\r\?$/ -WX\0/" config/Makefile.msvc > config/Makefile
+
+ # Temporarily initialise the submodule in the msvc32 build
+ git submodule update --init flexdll
+ run "make flexdll" make flexdll
+ run "make world" make world
+ run "make runtimeopt" make runtimeopt
+ run "make -C otherlibs/systhreads libthreadsnat.lib" make -C otherlibs/systhreads libthreadsnat.lib
+
+ exit 0
+ ;;
+ test)
+ run "test msvc64" make -C $APPVEYOR_BUILD_FOLDER tests
+ run "test mingw32" make -C $APPVEYOR_BUILD_FOLDER/../build-mingw32 tests
+ run "install msvc64" make -C $APPVEYOR_BUILD_FOLDER install
+ run "install mingw32" make -C $APPVEYOR_BUILD_FOLDER/../build-mingw32 install
+ ;;
+ *)
+ cd $APPVEYOR_BUILD_FOLDER
+
+ git worktree add ../build-mingw32 -b appveyor-build-mingw32
+ git worktree add ../build-msvc32 -b appveyor-build-msvc32
+
+ cd ../build-mingw32
+ git submodule update --init flexdll
+
+ cd $APPVEYOR_BUILD_FOLDER
+
+ # tar -xzf flexdll.tar.gz
+ # cd flexdll-0.35
+ # make MSVC_DETECT=0 CHAINS=msvc64 support
+ # cp flexdll*_msvc64.obj "$PREFIX/bin/flexdll"
+ # cd ..
+
+ cp config/m-nt.h byterun/caml/m.h
+ cp config/s-nt.h byterun/caml/s.h
+
+ echo "Edit config/Makefile to set PREFIX=$PREFIX"
+ sed -e "s|PREFIX=.*|PREFIX=$PREFIX|" -e "/^ *CFLAGS *=/s/\r\?$/ -WX\0/" config/Makefile.msvc64 > config/Makefile
+ #run "Content of config/Makefile" cat config/Makefile
+
+ # Temporarily initialise the submodule in the main (msvc64) build
+ git submodule update --init flexdll
+ run "make flexdll" make flexdll
+ run "make world" make world
+ run "make bootstrap" make bootstrap
+ run "make opt" make opt
+ run "make opt.opt" make opt.opt
+
+ cd ../build-mingw32
+
+ cp config/m-nt.h byterun/caml/m.h
+ cp config/s-nt.h byterun/caml/s.h
+
+ PREFIX=$(echo $OCAMLROOT2| cygpath -f - -m)
+ echo "Edit config/Makefile to set PREFIX=$PREFIX"
+ sed -e "s|PREFIX=.*|PREFIX=$PREFIX|" -e "/^ *CFLAGS *=/s/\r\?$/ -Werror\0/" config/Makefile.mingw > config/Makefile
+ #run "Content of config/Makefile" cat config/Makefile
+
+ run "make flexdll" make flexdll
+ run "make world.opt" make world.opt
+ ;;
+esac