From 1ad4d174205e4cdb5904c9a80ecda53aa603fa52 Mon Sep 17 00:00:00 2001 From: Martyn Gigg <martyn.gigg@stfc.ac.uk> Date: Thu, 4 Jun 2015 11:47:41 +0100 Subject: [PATCH] Add additional arguments to the fetch_Third_Party.bat script Allows just the includes/libs to be fetched and also shallow clones both repositories. --- Code/Mantid/Build/Jenkins/doctests.bat | 2 +- Code/fetch_Third_Party.bat | 64 ++++++++++++++++---------- 2 files changed, 40 insertions(+), 26 deletions(-) diff --git a/Code/Mantid/Build/Jenkins/doctests.bat b/Code/Mantid/Build/Jenkins/doctests.bat index f1ddc0cbca4..1ee2abba78e 100755 --- a/Code/Mantid/Build/Jenkins/doctests.bat +++ b/Code/Mantid/Build/Jenkins/doctests.bat @@ -20,7 +20,7 @@ echo %sha1% :: Get or update the third party dependencies (basically just to get python) ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: cd %WORKSPACE%\Code -call fetch_Third_Party win64 +call fetch_Third_Party --libs-only win64 cd %WORKSPACE% ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: diff --git a/Code/fetch_Third_Party.bat b/Code/fetch_Third_Party.bat index b534c96efc7..17c0fad3712 100755 --- a/Code/fetch_Third_Party.bat +++ b/Code/fetch_Third_Party.bat @@ -1,10 +1,18 @@ :: This script deals with getting hold of the required third party includes and libraries :: It will either clone or pull 3rdpartyincludes & 3rdpartylibs-win32/64 and put them in the right place for CMake :: -:: Usage: fetch_Third_Party [win32|win64] +:: Usage: fetch_Third_Party [--includes-only] [--libs-only] [win32|win64] :: :: - [x86|x64] If provided this indicates the required architecture. If left bank your architecture is auto-determined @echo off +setlocal enableextensions +setlocal enabledelayedexpansion + +set fetchincludes=1 +set fetchlibs=1 +set userarch=win64 + +call:argcheck %* :: Check for git. Older versions used %GitCmd%, newer just git. The older versions still :: have git.exe but it should be called through git.cmd so git.cmd check is first @@ -44,43 +52,49 @@ del CheckOS.txt del StringCheck.txt :: Check if user has overridden the value -if NOT "%1"=="" ( - if "%1"=="win64" ( - set arch=win64 - ) else ( - if "%1"=="win32" ( - set arch=win32 - ) else ( - echo "Unknown architecture. Valid options are:win32,win64." - exit /B 1 - ) - ) +if NOT "%userarch"=="" ( + set arch=!userarch! ) echo Using architecture=%arch% - :: Find out the url where mantid came from so we use the same location & protocol FOR /F %%I IN ('%GitCmd% config --get remote.origin.url') DO SET url=%%I echo Mantid repository URL: %url% :: Check if includes are already there - if so, just update -IF EXIST Third_Party/include GOTO UpdateInc +if /i "%fetchincludes%"=="1" ( + IF EXIST Third_Party/include GOTO :UpdateInc -set incs=%url:mantid.git=%3rdpartyincludes.git -:: Otherwise we need to clone -echo Cloning Third_Party includes from %incs% -call %GitCmd% clone %incs% Third_Party/include + set incs=%url:mantid.git=%3rdpartyincludes.git + :: Otherwise we need to clone + echo Cloning Third_Party includes from !incs! + call !GitCmd! clone --depth=1 !incs! Third_Party/include +) +GOTO :DoLibs + +:argcheck +if "%~1" NEQ "" ( + if /i "%1"=="win32" set userarch=win32 & GOTO:argcheck_shift + if /i "%1"=="win64" set userarch=win64 & GOTO:argcheck_shift + if /i "%1"=="--includes-only" set fetchlibs=0 & GOTO:argcheck_shift + if /i "%1"=="--libs-only" set fetchincludes=0 & GOTO:argcheck_shift + :argcheck_shift + shift + goto :argcheck +) +goto:eof :DoLibs -:: Check is libs are already there - if so, just update -IF EXIST Third_Party/lib/%arch% GOTO UpdateLib +if /i "%fetchlibs%"=="1" ( + :: Check is libs are already there - if so, just update + IF EXIST Third_Party/lib/%arch% GOTO UpdateLib -set libs=%url:mantid.git=%3rdpartylibs-%arch%.git -echo %libs% + set libs=%url:mantid.git=%3rdpartylibs-%arch%.git -:: Otherwise we need to clone -echo Cloning Third_Party libraries from %libs% -call %GitCmd% clone %libs% Third_Party/lib/%arch% + :: Otherwise we need to clone + echo Cloning Third_Party libraries from !libs! + call %GitCmd% clone --depth=1 !libs! Third_Party/lib/%arch% +) exit /B 0 :: Just making sure what we have is up to date -- GitLab