Skip to content

Commit

Permalink
Add jenkins-related stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
sslyadnev committed Feb 26, 2018
1 parent 45cbabc commit d3a2f51
Show file tree
Hide file tree
Showing 4 changed files with 179 additions and 0 deletions.
67 changes: 67 additions & 0 deletions jenkins-configure-and-build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
@echo off

REM ===========================================================================
REM Configure environment on Jenkins machine
REM ===========================================================================

if exist %~dp0jenkins-custom.bat call %~dp0jenkins-custom.bat

REM ===========================================================================
REM Copy and unpack 3-rd parties
REM ===========================================================================

mkdir 3rd-parties-arc

copy %JENKINS_3RDPARTIES_ARCHIVE_DIR%\%JENKINS_3RDPARTIES_ARCHIVE% 3rd-parties-arc
copy %JENKINS_3RDPARTIES_ARCHIVE_DIR%\%JENKINS_3RDPARTIES_FBX_ARCHIVE% 3rd-parties-arc
copy %JENKINS_3RDPARTIES_ARCHIVE_DIR%\7z.dll 3rd-parties-arc
copy %JENKINS_3RDPARTIES_ARCHIVE_DIR%\7z.exe 3rd-parties-arc
copy jenkins-install-products.bat 3rd-parties-arc

cd 3rd-parties-arc

call "jenkins-install-products.bat" ..\3rd-parties

cd ..

set "JENKINS_3RDPARTIES=%~dp03rd-parties"

REM ===========================================================================
REM Configure environment
REM ===========================================================================

set "JENKINS_JOB_DIR=%~dp0"
echo JENKINS_JOB_DIR: %JENKINS_JOB_DIR%

REM ===========================================================================
REM Prepare build and install directories for CMake
REM ===========================================================================

echo Create cmake-build-dir and cmake-install-dir

mkdir cmake-build-dir
mkdir cmake-install-dir

REM ===========================================================================
REM Run CMake from build directory: configure
REM ===========================================================================

cd cmake-build-dir

"%JENKINS_CMAKE_BIN%\cmake.exe" -G"Visual Studio 12 2013 Win64" -DCMAKE_BUILD_TYPE=Release -DUSE_CONSOLE=false -D3RDPARTY_DIR:PATH=%JENKINS_3RDPARTIES% -DINSTALL_DIR:PATH=../cmake-install-dir ../

REM ===========================================================================
REM CMake build and install
REM ===========================================================================

"%JENKINS_CMAKE_BIN%\cmake.exe" --build . --config Release --target INSTALL

REM ===========================================================================
REM Prepare installer
REM ===========================================================================

cd ..

xcopy /S /Y cmake-build-dir\setup .\setup

"%JENKINS_3RDPARTIES%\innosetup5\ISCC.exe" .\setup\setup.iss
35 changes: 35 additions & 0 deletions jenkins-copy-lastbuild.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@echo off

REM ===========================================================================
REM Configure environment on Jenkins machine
REM ===========================================================================

if exist %~dp0jenkins-custom.bat call %~dp0jenkins-custom.bat

REM ===========================================================================
REM Copy to shared team dir
REM ===========================================================================

echo date=%date%

REM timestamp without spaces
for /F "tokens=1,2,3 delims= " %%i in ("%date%") do set da_nospaces=%%j
echo da_nospaces=%da%

REM timestamp without slashes
for /F "tokens=1,2,3 delims=/" %%i in ("%da_nospaces%") do set da_nospaces_noslashes=%%k-%%i-%%j
echo da_nospaces_noslashes=%da_nospaces_noslashes%

REM timestamp with time
for /F "usebackq tokens=1,2,3 delims=: " %%i in (`time /T`) do set timestamp=%da_nospaces_noslashes%-T%%i%%j
echo timestamp=%timestamp%

set "TEAMDIR=%JENKINS_LAST_BUILD_DIR%\%timestamp%"
if not exist %TEAMDIR% md %TEAMDIR%
xcopy /Y cmake-install-dir\setup %TEAMDIR%

REM ===========================================================================
REM Copy to shared publix dir
REM ===========================================================================

xcopy /Y cmake-install-dir\setup %JENKINS_PUBLIC_DIR%
11 changes: 11 additions & 0 deletions jenkins-custom.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@echo off

set "JENKINS_CMAKE_BIN=C:\Program Files\CMake\bin"

REM ===========================================================================
REM Configuration of Network Resources
REM ===========================================================================

set "JENKINS_3RDPARTIES_ARCHIVE_DIR=\\MASTER\projects\CADProcessor\archives\3rd-parties"
set "JENKINS_3RDPARTIES_ARCHIVE=3rd-parties-win-2018-01-29.zip"
set "JENKINS_LAST_BUILD_DIR=\\master\projects\CADProcessor\tools\AnalysisSitus"
66 changes: 66 additions & 0 deletions jenkins-install-products.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
@echo off

if "%1" == "" (
echo This script unpacks Analysis Situs pre-requisites to the specified installation directory.
echo
echo Usage:
echo install_products.bat full_path_to_installation_directory
echo
exit 0
)

set ARCH_DIR=%~dp0
set TARGET_DIR=%1

set CURDIR=%CD%
cd /d %ARCH_DIR%

if not exist 7z.exe (
echo
echo 7z.exe is not found in the archive directory %ARCH_DIR%. Cannot proceed.
echo
exit 1
)

echo Installing Analysis Situs pre-requisites to %TARGET_DIR%

echo Installing Analysis Situs pre-requisites to %TARGET_DIR% > install_products.log
echo ==================================================================== >> install_products.log

if exist %TARGET_DIR%\* (
echo Installation directory %TARGET_DIR% already exists and is not empty, cleaning its contents >> install_products.log
rd %TARGET_DIR% /s /q >> install_products.log
if errorlevel 1 goto error
md %TARGET_DIR% >> install_products.log
if errorlevel 1 goto error
)
if not exist %TARGET_DIR% (
echo Creating installation directory %TARGET_DIR% >> install_products.log
md %TARGET_DIR% >> install_products.log
if errorlevel 1 goto error
)

setlocal enabledelayedexpansion
for %%a in (*.zip) do (
set arc_name=%%~na

echo arc_name = !arc_name!
echo Installing %%a... >> install_products.log

7z.exe x -aoa -o%TARGET_DIR% !arc_name!.zip >> install_products.log
if errorlevel 1 goto error
)
endlocal

echo ==================================================================== >> install_products.log
echo Installation completed >> install_products.log
echo Installation completed, see %ARCH_DIR%install_products.log for details
goto end:

:error
echo ==================================================================== >> install_products.log
echo Installation failed >> install_products.log
echo Installation failed, see %ARCH_DIR%install_products.log for details

:end
cd /d %CURDIR%

0 comments on commit d3a2f51

Please sign in to comment.