Skip to content

Commit

Permalink
Merge pull request #1271 from k-takata/feature/use-leproc-for-chm
Browse files Browse the repository at this point in the history
Azure Pipelines/GitHub Actions で HTML Help をビルドできるようにする
  • Loading branch information
k-takata authored May 24, 2020
2 parents b38d58f + 0c4e7b7 commit 5399fa2
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 29 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/build-sakura.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,18 @@ jobs:
run: build-sln.bat ${{ matrix.platform }} ${{ matrix.config }}
shell: cmd

## #922 のため無効化
#
#- name: Build HTML Help
# run: build-chm.bat
# shell: cmd
#
#- name: Build installer with Inno Setup
# run: build-installer.bat ${{ matrix.platform }} ${{ matrix.config }}
# shell: cmd
- name: Install Locale Emulator
run: choco install locale-emulator -y
shell: cmd

- name: Build HTML Help
run: build-chm.bat
shell: cmd

- name: Build installer with Inno Setup
run: build-installer.bat ${{ matrix.platform }} ${{ matrix.config }}
shell: cmd

- name: zipArtifacts
run: zipArtifacts.bat ${{ matrix.platform }} ${{ matrix.config }}
shell: cmd
Expand Down
37 changes: 24 additions & 13 deletions build-chm.bat
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,33 @@ exit /b 0
:BuildChm
set PROJECT_HHP=%1
set PROJECT_CHM=%2
set PROJECT_LOG=%~dp2\Compile.log

if exist "%PROJECT_CHM%" del /F "%PROJECT_CHM%"

@rem hhc.exe returns 1 on success, and returns 0 on failure
"%CMD_HHC%" %PROJECT_HHP%
if not errorlevel 1 (
echo error %PROJECT_HHP% errorlevel %errorlevel%

del /F "%PROJECT_CHM%"
"%CMD_HHC%" %PROJECT_HHP%
)
if not errorlevel 1 (
echo retry error %PROJECT_HHP% errorlevel %errorlevel%
exit /b 1
if exist "%PROJECT_LOG%" del /F "%PROJECT_LOG%"

if defined CMD_LEPROC (
for /L %%i in (1,1,2) do (
"%CMD_LEPROC%" %COMSPEC% /c """%CMD_HHC%"" %PROJECT_HHP%"
@rem wait to create chm
for /L %%j in (1,1,30) do (
ping -n 2 localhost > NUL
copy "%PROJECT_LOG%" nul > NUL 2>&1
if not errorlevel 1 exit /b 0
)
echo retry creating %PROJECT_CHM%
)
echo fail to create %PROJECT_CHM%
) else (
for /L %%i in (1,1,2) do (
@rem hhc.exe returns 1 on success, and returns 0 on failure
"%CMD_HHC%" %PROJECT_HHP%
if errorlevel 1 exit /b 0
echo error %PROJECT_HHP% errorlevel %errorlevel%
del /F "%PROJECT_CHM%"
)
)
exit /b 0
exit /b 1

:download_archive
pwsh.exe -ExecutionPolicy RemoteSigned -File %SRC_HELP%\extract-chm-from-artifact.ps1
Expand Down
18 changes: 11 additions & 7 deletions ci/azure-pipelines/template.job.build-unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,17 @@ jobs:
- script: build-bmp-tools.bat $(Configuration)
displayName: Bitmap Split/Mux

# # Build HTML Help
# - script: build-chm.bat
# displayName: Build HTML Help
#
# # Build installer with Inno Setup
# - script: build-installer.bat $(BuildPlatform) $(Configuration)
# displayName: Build installer with Inno Setup
# Install Locale Emulator
- script: choco install locale-emulator -y
displayName: Install Locale Emulator

# Build HTML Help
- script: build-chm.bat
displayName: Build HTML Help

# Build installer with Inno Setup
- script: build-installer.bat $(BuildPlatform) $(Configuration)
displayName: Build installer with Inno Setup

# zip files for artifacts
- script: zipArtifacts.bat $(BuildPlatform) $(Configuration)
Expand Down
12 changes: 12 additions & 0 deletions tools/find-tools.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ if "%1" equ "clear" (
set CMD_MSBUILD=
set CMD_CMAKE=
set CMD_NINJA=
set CMD_LEPROC=
set NUM_VSVERSION=
set CMAKE_G_PARAM=
set FIND_TOOLS_CALLED=
Expand All @@ -37,6 +38,7 @@ if not defined CMD_VSWHERE call :vswhere 2> nul
if not defined CMD_MSBUILD call :msbuild 2> nul
if not defined CMD_CMAKE call :cmake 2> nul
if not defined CMD_NINJA call :cmake 2> nul
if not defined CMD_LEPROC call :leproc 2> nul
echo ^|- CMD_GIT=%CMD_GIT%
echo ^|- CMD_7Z=%CMD_7Z%
echo ^|- CMD_HHC=%CMD_HHC%
Expand All @@ -47,6 +49,7 @@ echo ^|- CMD_VSWHERE=%CMD_VSWHERE%
echo ^|- CMD_MSBUILD=%CMD_MSBUILD%
echo ^|- CMD_CMAKE=%CMD_CMAKE%
echo ^|- CMD_NINJA=%CMD_NINJA%
echo ^|- CMD_LEPROC=%CMD_LEPROC%
echo ^|- CMAKE_G_PARAM=%CMAKE_G_PARAM%
endlocal ^
&& set "CMD_GIT=%CMD_GIT%" ^
Expand All @@ -59,6 +62,7 @@ endlocal ^
&& set "CMD_MSBUILD=%CMD_MSBUILD%" ^
&& set "CMD_CMAKE=%CMD_CMAKE%" ^
&& set "CMD_NINJA=%CMD_NINJA%" ^
&& set "CMD_LEPROC=%CMD_LEPROC%" ^
&& set "NUM_VSVERSION=%NUM_VSVERSION%" ^
&& set "CMAKE_G_PARAM=%CMAKE_G_PARAM%" ^
&& echo end
Expand Down Expand Up @@ -258,3 +262,11 @@ for /f "usebackq delims=" %%a in (`where $PATH:ninja`) do (
exit /b
)
exit /b

:leproc
set PATH2=%PATH%
for /f "usebackq delims=" %%a in (`where $PATH2:LEProc.exe`) do (
set "CMD_LEPROC=%%a"
exit /b
)
exit /b
1 change: 1 addition & 0 deletions tools/find-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
| doxygen | CMD_DOXYGEN | doxygen\bin | doxygen.exe |
| vswhere | CMD_VSWHERE | Microsoft Visual Studio\Installer | vswhere.exe |
| MSBuild | CMD_MSBUILD | 特殊 | MSBuild.exe |
| Locale Emulator | CMD_LEPROC | なし | LEProc.exe |

## MSBuild以外の探索手順
MSBuild以外の探索手順は同一であり、7-Zipを例に説明する。
Expand Down

0 comments on commit 5399fa2

Please sign in to comment.