goldendict-ng/.github/scripts/windows-publish.ps1
xiaoyifang 3858932ec4
feat!: add libzim dependency (#725)
* feat!: add libzim dependency

* 🎨 apply clang-format changes

* action: add libzim dependency to action

* feat!: change dependency folder

* action: add zim support

* feat!: add libzim support

* action: fix sonarcloud check

* doc: add libzim readme

* action: cmake build

* action: cmake check

* fix: code smell

* action: cmake check

* action: cmake on Macos

* action: cmake on Macos

* feat: use libzim to read title and description

* 🎨 apply clang-format changes

* feat: split zim file support

* feat: loadArticle refactor

* 🎨 apply clang-format changes

* 🎨 apply clang-format changes

* feat: update library and goldendict.pro

* 🎨 apply clang-format changes

* fix:word count

* 🎨 apply clang-format changes

* fix: video src url subsititue

* 🎨 apply clang-format changes

* zim: headword is not usually a valid

it is from title and url.

* fix: remove nested try catch

* zim: fix resource loading issue.

* 🎨 apply clang-format changes

* action: remove libao

* zim: process url

some old zim dictionary url does not contain namespace such as
/C/url

make the old and new zim dictionary's url consistent without the leading
../C/  etc.

* 🎨 apply clang-format changes

* zim: process url

remove leading dot and slash
such as ../-/assets  ,remove ../

* 🎨 apply clang-format changes

* zim: remove resourceIndex creation

use libzim to read the resource directly.

* zim: only iterate all the articles

* 🎨 apply clang-format changes

* fix: code smell

* 🎨 apply clang-format changes

* zim: refactor method to convert url to wstring

* 🎨 apply clang-format changes

* fix:code smell

* 🎨 apply clang-format changes

* zim: update windows dependencies

* zim: add mutex lock

* 🎨 apply clang-format changes

* fix: code smell

* 🎨 apply clang-format changes

---------

Co-authored-by: xiaoyifang <xiaoyifang@users.noreply.github.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-05-27 12:12:16 +08:00

86 lines
3.1 KiB
PowerShell

[CmdletBinding()]
param (
[string] $archiveName, [string] $targetName
)
# 外部环境变量包括:
# archiveName: ${{ matrix.qt_ver }}-${{ matrix.qt_arch }}
# winSdkDir: ${{ steps.build.outputs.winSdkDir }}
# winSdkVer: ${{ steps.build.outputs.winSdkVer }}
# vcToolsInstallDir: ${{ steps.build.outputs.vcToolsInstallDir }}
# vcToolsRedistDir: ${{ steps.build.outputs.vcToolsRedistDir }}
# msvcArch: ${{ matrix.msvc_arch }}
# winSdkDir: C:\Program Files (x86)\Windows Kits\10\
# winSdkVer: 10.0.19041.0\
# vcToolsInstallDir: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.28.29333\
# vcToolsRedistDir: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Redist\MSVC\14.28.29325\
# archiveName: 5.9.9-win32_msvc2015
# msvcArch: x86
$scriptDir = $PSScriptRoot
$currentDir = Get-Location
Write-Host "currentDir" $currentDir
Write-Host "scriptDir" $scriptDir
function Main() {
New-Item -ItemType Directory $archiveName
New-Item -ItemType Directory $archiveName\locale
New-Item -ItemType Directory $archiveName\opencc
# 拷贝exe
Copy-Item release\$targetName $archiveName\
Write-Host "copy item finished..."
# #拷贝pdb
# Copy-Item release\*.pdb $archiveName\
# Write-Host "copy pdb finished..."
# 拷贝依赖
windeployqt --qmldir . --plugindir $archiveName\plugins --compiler-runtime $archiveName\$targetName
# 删除不必要的文件
# $excludeList = @("*.qmlc", "*.ilk", "*.exp", "*.lib", "*.pdb")
$excludeList = @("*.qmlc", "*.ilk", "*.exp", "*.lib")
Remove-Item -Path $archiveName -Include $excludeList -Recurse -Force
Write-Host "remove item finished..."
# 拷贝vcRedist dll
$redistDll="{0}{1}\*.CRT\*.dll" -f $env:vcToolsRedistDir.Trim(),$env:msvcArch
Write-Host "redist dll $($redistDll)"
Copy-Item $redistDll $archiveName\
Write-Host "copy redist dll..."
Copy-Item "LICENSE.txt" $archiveName\
Write-Host "copy license.."
Copy-Item "opencc\*" $archiveName\opencc\
Write-Host "opencc config files.."
# 拷贝WinSDK dll
$sdkDll="{0}Redist\{1}ucrt\DLLs\{2}\*.dll" -f $env:winSdkDir.Trim(),$env:winSdkVer.Trim(),$env:msvcArch
Write-Host "copy sdk dll$($sdkDll)"
Copy-Item $sdkDll $archiveName\
Copy-Item winlibs\lib\msvc\*.dll $archiveName\
Copy-Item winlibs\lib\xapian\rel\*.dll $archiveName\
Copy-Item winlibs\lib\*.dll $archiveName\
Copy-Item locale\*.qm $archiveName\locale\
$webengineqm="{0}\translations\qtwebengine_*.qm" -f $env:QTDIR.Trim()
Write-Host "copy qtwebengine qm from $($webengineqm)"
Copy-Item $webengineqm $archiveName\locale\
# $multimedia="{0}\plugins\multimedia" -f $env:QTDIR.Trim()
# if(Test-Path $multimedia){
# Write-Host "copy multimedia $($multimedia) to plugins"
# Copy-Item -Path $multimedia -Destination $archiveName\plugins -Recurse
# }
Write-Host "compress zip..."
# 打包zip
Compress-Archive -Path $archiveName -DestinationPath $archiveName'.zip'
}
if ($null -eq $archiveName || $null -eq $targetName) {
Write-Host "args missing, archiveName is" $archiveName ", targetName is" $targetName
return
}
Main