Clean up old scripts and deps

This commit is contained in:
Ben Olden-Cooligan 2022-11-12 08:44:15 -08:00
parent 8c213722f0
commit 8cc47e5fbe
20 changed files with 10 additions and 582 deletions

View File

@ -1,30 +0,0 @@
param([Parameter(Position=0, Mandatory=$false)] [String] $Name,
[Parameter(Mandatory=$false)] [switch] $d)
. .\naps2.ps1
# Rebuild NAPS2
$msbuild = Get-MSBuild-Path
& $msbuild "$SolutionRoot\NAPS2.sln" /v:q /p:Configuration=Debug
$Version = Get-NAPS2-Version
$PublishDir = "$SolutionRoot\NAPS2.Setup\publish\$Version\"
if (-not (Test-Path $PublishDir)) {
mkdir $PublishDir
}
Get-Process | where { $_.ProcessName -eq "NAPS2.vshost" } | kill
"Building ZIP"
& $msbuild "$SolutionRoot\NAPS2.sln" /v:q /p:Configuration=Standalone /t:Clean
if ($d) {
& $msbuild "$SolutionRoot\NAPS2.sln" /v:q /p:Configuration=Standalone /t:Rebuild /p:DefineConstants=DEBUG%3BSTANDALONE
} else {
& $msbuild "$SolutionRoot\NAPS2.sln" /v:q /p:Configuration=Standalone /t:Rebuild
}
Publish-NAPS2-Standalone $PublishDir "Standalone" ($PublishDir + "naps2-$Version-test_$Name-portable.zip")
""
"Saved to " + ($PublishDir + "naps2-$Version-test_$Name-portable.zip")
""

View File

@ -1,39 +0,0 @@
<#@ template debug="true" hostSpecific="true" #>
<#@ output extension=".wxs" encoding="us-ascii" #>
<#@ import namespace="System.IO" #>
<?xml version='1.0' encoding='windows-1252'?>
<!-- This file is auto-generated by LanguageComponents.tt -->
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Fragment Id='LanguageComponentsFragment'>
<#
var setupDirPath = Path.GetDirectoryName(Host.TemplateFile);
var outputDirPath = Path.Combine(setupDirPath, @"..\NAPS2.Sdk\bin\InstallerMSI");
var outputDir = new DirectoryInfo(outputDirPath);
#>
<ComponentGroup Id="LangComponents">
<#
foreach(var folder in outputDir.EnumerateDirectories()) {
var langName = folder.Name;
#>
<ComponentRef Id="LangComponent_<#= langName.Replace("-", "_") #>" />
<#
}
#>
</ComponentGroup>
<DirectoryRef Id="LIBFOLDER">
<#
foreach(var folder in outputDir.EnumerateDirectories()) {
var langName = folder.Name;
#>
<Directory Id="LangFolder_<#= langName.Replace("-", "_") #>" Name="<#= langName #>">
<Component Id="LangComponent_<#= langName.Replace("-", "_") #>">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462<#= "\\" + langName #>\NAPS2.Sdk.resources.dll" Id="LangFile_<#= langName.Replace("-", "_") #>" />
</Component>
</Directory>
<#
}
#>
</DirectoryRef>
</Fragment>
</Wix>

View File

@ -1,257 +0,0 @@
<?xml version='1.0' encoding='windows-1252'?>
<!-- This file is auto-generated by LanguageComponents.tt -->
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Fragment Id='LanguageComponentsFragment'>
<ComponentGroup Id="LangComponents">
<ComponentRef Id="LangComponent_af" />
<ComponentRef Id="LangComponent_ar" />
<ComponentRef Id="LangComponent_bg" />
<ComponentRef Id="LangComponent_ca" />
<ComponentRef Id="LangComponent_cs" />
<ComponentRef Id="LangComponent_da" />
<ComponentRef Id="LangComponent_de" />
<ComponentRef Id="LangComponent_el" />
<ComponentRef Id="LangComponent_es" />
<ComponentRef Id="LangComponent_et" />
<ComponentRef Id="LangComponent_fa" />
<ComponentRef Id="LangComponent_fi" />
<ComponentRef Id="LangComponent_fr" />
<ComponentRef Id="LangComponent_he" />
<ComponentRef Id="LangComponent_hr" />
<ComponentRef Id="LangComponent_hu" />
<ComponentRef Id="LangComponent_it" />
<ComponentRef Id="LangComponent_ja" />
<ComponentRef Id="LangComponent_ko" />
<ComponentRef Id="LangComponent_lt" />
<ComponentRef Id="LangComponent_lv" />
<ComponentRef Id="LangComponent_nb" />
<ComponentRef Id="LangComponent_nl" />
<ComponentRef Id="LangComponent_nn" />
<ComponentRef Id="LangComponent_pl" />
<ComponentRef Id="LangComponent_pt_BR" />
<ComponentRef Id="LangComponent_pt_PT" />
<ComponentRef Id="LangComponent_ro" />
<ComponentRef Id="LangComponent_ru" />
<ComponentRef Id="LangComponent_si" />
<ComponentRef Id="LangComponent_sk" />
<ComponentRef Id="LangComponent_sl" />
<ComponentRef Id="LangComponent_sq" />
<ComponentRef Id="LangComponent_sr_Cyrl" />
<ComponentRef Id="LangComponent_sr_Latn" />
<ComponentRef Id="LangComponent_sv" />
<ComponentRef Id="LangComponent_tr" />
<ComponentRef Id="LangComponent_uk" />
<ComponentRef Id="LangComponent_vi" />
<ComponentRef Id="LangComponent_zh_CHS" />
<ComponentRef Id="LangComponent_zh_TW" />
</ComponentGroup>
<DirectoryRef Id="LIBFOLDER">
<Directory Id="LangFolder_af" Name="af">
<Component Id="LangComponent_af">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\af\NAPS2.Sdk.resources.dll" Id="LangFile_af" />
</Component>
</Directory>
<Directory Id="LangFolder_ar" Name="ar">
<Component Id="LangComponent_ar">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\ar\NAPS2.Sdk.resources.dll" Id="LangFile_ar" />
</Component>
</Directory>
<Directory Id="LangFolder_bg" Name="bg">
<Component Id="LangComponent_bg">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\bg\NAPS2.Sdk.resources.dll" Id="LangFile_bg" />
</Component>
</Directory>
<Directory Id="LangFolder_ca" Name="ca">
<Component Id="LangComponent_ca">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\ca\NAPS2.Sdk.resources.dll" Id="LangFile_ca" />
</Component>
</Directory>
<Directory Id="LangFolder_cs" Name="cs">
<Component Id="LangComponent_cs">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\cs\NAPS2.Sdk.resources.dll" Id="LangFile_cs" />
</Component>
</Directory>
<Directory Id="LangFolder_da" Name="da">
<Component Id="LangComponent_da">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\da\NAPS2.Sdk.resources.dll" Id="LangFile_da" />
</Component>
</Directory>
<Directory Id="LangFolder_de" Name="de">
<Component Id="LangComponent_de">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\de\NAPS2.Sdk.resources.dll" Id="LangFile_de" />
</Component>
</Directory>
<Directory Id="LangFolder_el" Name="el">
<Component Id="LangComponent_el">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\el\NAPS2.Sdk.resources.dll" Id="LangFile_el" />
</Component>
</Directory>
<Directory Id="LangFolder_es" Name="es">
<Component Id="LangComponent_es">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\es\NAPS2.Sdk.resources.dll" Id="LangFile_es" />
</Component>
</Directory>
<Directory Id="LangFolder_et" Name="et">
<Component Id="LangComponent_et">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\et\NAPS2.Sdk.resources.dll" Id="LangFile_et" />
</Component>
</Directory>
<Directory Id="LangFolder_fa" Name="fa">
<Component Id="LangComponent_fa">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\fa\NAPS2.Sdk.resources.dll" Id="LangFile_fa" />
</Component>
</Directory>
<Directory Id="LangFolder_fi" Name="fi">
<Component Id="LangComponent_fi">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\fi\NAPS2.Sdk.resources.dll" Id="LangFile_fi" />
</Component>
</Directory>
<Directory Id="LangFolder_fr" Name="fr">
<Component Id="LangComponent_fr">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\fr\NAPS2.Sdk.resources.dll" Id="LangFile_fr" />
</Component>
</Directory>
<Directory Id="LangFolder_he" Name="he">
<Component Id="LangComponent_he">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\he\NAPS2.Sdk.resources.dll" Id="LangFile_he" />
</Component>
</Directory>
<Directory Id="LangFolder_hr" Name="hr">
<Component Id="LangComponent_hr">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\hr\NAPS2.Sdk.resources.dll" Id="LangFile_hr" />
</Component>
</Directory>
<Directory Id="LangFolder_hu" Name="hu">
<Component Id="LangComponent_hu">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\hu\NAPS2.Sdk.resources.dll" Id="LangFile_hu" />
</Component>
</Directory>
<Directory Id="LangFolder_it" Name="it">
<Component Id="LangComponent_it">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\it\NAPS2.Sdk.resources.dll" Id="LangFile_it" />
</Component>
</Directory>
<Directory Id="LangFolder_ja" Name="ja">
<Component Id="LangComponent_ja">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\ja\NAPS2.Sdk.resources.dll" Id="LangFile_ja" />
</Component>
</Directory>
<Directory Id="LangFolder_ko" Name="ko">
<Component Id="LangComponent_ko">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\ko\NAPS2.Sdk.resources.dll" Id="LangFile_ko" />
</Component>
</Directory>
<Directory Id="LangFolder_lt" Name="lt">
<Component Id="LangComponent_lt">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\lt\NAPS2.Sdk.resources.dll" Id="LangFile_lt" />
</Component>
</Directory>
<Directory Id="LangFolder_lv" Name="lv">
<Component Id="LangComponent_lv">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\lv\NAPS2.Sdk.resources.dll" Id="LangFile_lv" />
</Component>
</Directory>
<Directory Id="LangFolder_nb" Name="nb">
<Component Id="LangComponent_nb">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\nb\NAPS2.Sdk.resources.dll" Id="LangFile_nb" />
</Component>
</Directory>
<Directory Id="LangFolder_nl" Name="nl">
<Component Id="LangComponent_nl">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\nl\NAPS2.Sdk.resources.dll" Id="LangFile_nl" />
</Component>
</Directory>
<Directory Id="LangFolder_nn" Name="nn">
<Component Id="LangComponent_nn">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\nn\NAPS2.Sdk.resources.dll" Id="LangFile_nn" />
</Component>
</Directory>
<Directory Id="LangFolder_pl" Name="pl">
<Component Id="LangComponent_pl">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\pl\NAPS2.Sdk.resources.dll" Id="LangFile_pl" />
</Component>
</Directory>
<Directory Id="LangFolder_pt_BR" Name="pt-BR">
<Component Id="LangComponent_pt_BR">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\pt-BR\NAPS2.Sdk.resources.dll" Id="LangFile_pt_BR" />
</Component>
</Directory>
<Directory Id="LangFolder_pt_PT" Name="pt-PT">
<Component Id="LangComponent_pt_PT">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\pt-PT\NAPS2.Sdk.resources.dll" Id="LangFile_pt_PT" />
</Component>
</Directory>
<Directory Id="LangFolder_ro" Name="ro">
<Component Id="LangComponent_ro">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\ro\NAPS2.Sdk.resources.dll" Id="LangFile_ro" />
</Component>
</Directory>
<Directory Id="LangFolder_ru" Name="ru">
<Component Id="LangComponent_ru">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\ru\NAPS2.Sdk.resources.dll" Id="LangFile_ru" />
</Component>
</Directory>
<Directory Id="LangFolder_si" Name="si">
<Component Id="LangComponent_si">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\si\NAPS2.Sdk.resources.dll" Id="LangFile_si" />
</Component>
</Directory>
<Directory Id="LangFolder_sk" Name="sk">
<Component Id="LangComponent_sk">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\sk\NAPS2.Sdk.resources.dll" Id="LangFile_sk" />
</Component>
</Directory>
<Directory Id="LangFolder_sl" Name="sl">
<Component Id="LangComponent_sl">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\sl\NAPS2.Sdk.resources.dll" Id="LangFile_sl" />
</Component>
</Directory>
<Directory Id="LangFolder_sq" Name="sq">
<Component Id="LangComponent_sq">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\sq\NAPS2.Sdk.resources.dll" Id="LangFile_sq" />
</Component>
</Directory>
<Directory Id="LangFolder_sr_Cyrl" Name="sr-Cyrl">
<Component Id="LangComponent_sr_Cyrl">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\sr-Cyrl\NAPS2.Sdk.resources.dll" Id="LangFile_sr_Cyrl" />
</Component>
</Directory>
<Directory Id="LangFolder_sr_Latn" Name="sr-Latn">
<Component Id="LangComponent_sr_Latn">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\sr-Latn\NAPS2.Sdk.resources.dll" Id="LangFile_sr_Latn" />
</Component>
</Directory>
<Directory Id="LangFolder_sv" Name="sv">
<Component Id="LangComponent_sv">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\sv\NAPS2.Sdk.resources.dll" Id="LangFile_sv" />
</Component>
</Directory>
<Directory Id="LangFolder_tr" Name="tr">
<Component Id="LangComponent_tr">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\tr\NAPS2.Sdk.resources.dll" Id="LangFile_tr" />
</Component>
</Directory>
<Directory Id="LangFolder_uk" Name="uk">
<Component Id="LangComponent_uk">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\uk\NAPS2.Sdk.resources.dll" Id="LangFile_uk" />
</Component>
</Directory>
<Directory Id="LangFolder_vi" Name="vi">
<Component Id="LangComponent_vi">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\vi\NAPS2.Sdk.resources.dll" Id="LangFile_vi" />
</Component>
</Directory>
<Directory Id="LangFolder_zh_CHS" Name="zh-CHS">
<Component Id="LangComponent_zh_CHS">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\zh-CHS\NAPS2.Sdk.resources.dll" Id="LangFile_zh_CHS" />
</Component>
</Directory>
<Directory Id="LangFolder_zh_TW" Name="zh-TW">
<Component Id="LangComponent_zh_TW">
<File Source="..\NAPS2.App.WinForms\bin\InstallerMSI\net462\zh-TW\NAPS2.Sdk.resources.dll" Id="LangFile_zh_TW" />
</Component>
</Directory>
</DirectoryRef>
</Fragment>
</Wix>

View File

@ -1,23 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net5;net462</TargetFrameworks>
<TargetFrameworks>net6;net462</TargetFrameworks>
</PropertyGroup>
<Import Project="..\NAPS2.Setup\CommonTargets.targets" />
<ItemGroup>
<None Update="LanguageComponents.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>LanguageComponents.wxs</LastGenOutput>
</None>
<None Update="LanguageComponents.wxs">
<DependentUpon>LanguageComponents.tt</DependentUpon>
</None>
</ItemGroup>
<ItemGroup>
<Compile Include="setup.template.wxs" />
</ItemGroup>
</Project>

View File

@ -1,41 +0,0 @@
param([Parameter(Position=0, Mandatory=$false)] [String] $Version,
[Parameter(Mandatory=$false)] [String] $Name,
[Switch] $Force)
. .\naps2.ps1
if ($Version -notmatch '^[0-9]+(\.[0-9]+)+$') {
$Version = Get-NAPS2-Version
}
if ([string]::IsNullOrEmpty($Name)) {
$Name = $Version
}
$PublishDir = "$SolutionRoot\NAPS2.Setup\publish\$Version\"
if (-not (Test-Path $PublishDir)) {
mkdir $PublishDir
} elseif (-not $Force) {
"Publish dir already exists: $PublishDir"
"Use -Force to overwrite."
return
}
Set-NAPS2-Version $Version
Build-NAPS2
# MSI Installer
cp "$SolutionRoot\NAPS2.Setup.Msi\bin\Release\NAPS2.Setup.msi" ($PublishDir + "naps2-$Name-setup.msi")
# EXE Installer
& (Get-Inno-Path) "setup.iss"
if (-not [string]::IsNullOrEmpty($Name)) {
if ($Force -and (Test-Path ($PublishDir + "naps2-$Name-setup.exe")) -and (-not ($Name -eq $Version))) {
Remove-Item ($PublishDir + "naps2-$Name-setup.exe")
}
ren ($PublishDir + "naps2-$Version-setup.exe") "naps2-$Name-setup.exe"
}
# Standalone ZIP/7Z
Publish-NAPS2-Standalone $PublishDir "Standalone" ($PublishDir + "naps2-$Name-portable.zip")
Publish-NAPS2-Standalone $PublishDir "Standalone" ($PublishDir + "naps2-$Name-portable.7z")

View File

@ -1,47 +0,0 @@
param([Parameter(Position=0, Mandatory=$false)] [String] $PoUrl,
[Parameter(Position=1, Mandatory=$false)] [String] $Lang)
. .\naps2.ps1
# Download PO file and update language files
$Ext = [System.IO.Path]::GetExtension($PoUrl)
if (-not ($Ext -eq ".po")) {
return
}
$LanguageCode = $Lang
if ([string]::IsNullOrEmpty($LanguageCode)) {
$LanguageCode = [System.IO.Path]::GetFileNameWithoutExtension($PoUrl)
if ($LanguageCode -eq $null -or $LanguageCode -eq "") {
return
}
}
Invoke-WebRequest -Uri $PoUrl -OutFile "$SolutionRoot\NAPS2.Sdk\Lang\po\$LanguageCode.po"
.\Update-Resources.ps1 $LanguageCode
# Rebuild NAPS2
$Version = Get-NAPS2-Version
$PublishDir = "$SolutionRoot\NAPS2.Setup\publish\$Version\"
if (-not (Test-Path $PublishDir)) {
mkdir $PublishDir
}
$msbuild = Get-MSBuild-Path
Get-Process | where { $_.ProcessName -eq "NAPS2.vshost" } | kill
"Building MSI"
& $msbuild "$SolutionRoot\NAPS2.sln" /v:q /p:Configuration=InstallerMSI
"Building ZIP"
& $msbuild "$SolutionRoot\NAPS2.sln" /v:q /p:Configuration=Standalone
Publish-NAPS2-Standalone $PublishDir "Standalone" ($PublishDir + "naps2-$Version-test_$LanguageCode-portable.zip")
""
"Saved to " + ($PublishDir + "naps2-$Version-test_$LanguageCode-portable.zip")
""
$confirmation = Read-Host "Revert changes (y/n)"
if ($confirmation -eq 'y') {
& git checkout -- "$SolutionRoot\*.po"
& git checkout -- "$SolutionRoot\*.resx"
}

View File

@ -1,19 +0,0 @@
param([Parameter(Position=0, Mandatory=$false)] [String] $LanguageCode)
. .\naps2.ps1
$Localize = "$SolutionRoot\NAPS2.Tools.Localization\bin\Debug\NAPS2.Localization.exe"
if (Test-Path $Localize) {
if ($LanguageCode -eq $null -or $LanguageCode -eq "") {
foreach ($LanguageCode in Get-NAPS2-Languages) {
"$LanguageCode"
& $Localize language $LanguageCode
}
} else {
"$LanguageCode"
& $Localize language $LanguageCode
}
} else {
"NAPS2.Tools.Localization is not built"
}

View File

@ -1,9 +0,0 @@
. .\naps2.ps1
$Localize = "$SolutionRoot\NAPS2.Tools.Localization\bin\Debug\NAPS2.Localization.exe"
if (Test-Path $Localize) {
& $Localize templates
} else {
"NAPS2.Tools.Localization is not built"
}

View File

@ -1,124 +0,0 @@
$SolutionRoot = ".."
function Get-MSBuild-Path {
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe"
}
function Get-7z-Path {
"C:\Program Files\7-Zip\7z.exe"
}
function Get-Inno-Path {
"C:\Program Files (x86)\Inno Setup 5\ISCC.exe"
}
function Get-NAPS2-Version {
& (Get-MSBuild-Path) "$SolutionRoot\NAPS2.App.WinForms\NAPS2.App.WinForms.csproj" /v:q /p:Configuration=Debug | Out-Null
$Version = [Reflection.AssemblyName]::GetAssemblyName([IO.Path]::Combine($pwd, "$SolutionRoot\NAPS2.App.WinForms\bin\Debug\NAPS2.exe")).Version
$VersionStr = "" + $Version.Major + "." + $Version.Minor + "." + $Version.Build
$VersionStr
}
function Replace-Content {
param([Parameter(Position=0)] [String] $Path,
[Parameter(Position=1)] [String] $SearchRegex,
[Parameter(Position=2)] [String] $Replacement)
(Get-Content $Path) |
foreach { $_ -replace $SearchRegex, $Replacement } |
Set-Content $Path
}
function Set-Assembly-Version {
param([Parameter(Position=0)] [String] $AssemblyInfoPath,
[Parameter(Position=1)] [String] $Version)
Replace-Content $AssemblyInfoPath 'AssemblyVersion\("[^\)]+"\)' "AssemblyVersion(`"$Version`")"
}
function Set-NAPS2-Version {
param([Parameter(Position=0)] [String] $Version)
Set-Assembly-Version ([IO.Path]::Combine($pwd, "$SolutionRoot\NAPS2.App.WinForms\Properties\AssemblyInfo.cs")) $Version".*"
Set-Assembly-Version ([IO.Path]::Combine($pwd, "$SolutionRoot\NAPS2.App.Worker\Properties\AssemblyInfo.cs")) $Version".*"
Set-Assembly-Version ([IO.Path]::Combine($pwd, "$SolutionRoot\NAPS2.App.Server\Properties\AssemblyInfo.cs")) $Version".*"
Set-Assembly-Version ([IO.Path]::Combine($pwd, "$SolutionRoot\NAPS2.Sdk\Properties\AssemblyInfo.cs")) $Version".*"
Set-Assembly-Version ([IO.Path]::Combine($pwd, "$SolutionRoot\NAPS2.Lib\Properties\AssemblyInfo.cs")) $Version".*"
Set-Assembly-Version ([IO.Path]::Combine($pwd, "$SolutionRoot\NAPS2.App.Console\Properties\AssemblyInfo.cs")) $Version".*"
Set-Assembly-Version ([IO.Path]::Combine($pwd, "$SolutionRoot\NAPS2.App.PortableLauncher\Properties\AssemblyInfo.cs")) $Version".*"
Replace-Content ([IO.Path]::Combine($pwd, "setup.iss")) '^#define AppVersion "[^"]+"' "#define AppVersion `"$Version`""
# TODO: Do some XML processing instead of this flaky replacement
Replace-Content ([IO.Path]::Combine($pwd, "$SolutionRoot\NAPS2.Setup.Msi\NAPS2.Setup.Msi.wxs")) '^ Version="[^"]+"' " Version=`"$Version`""
}
function Build-NAPS2 {
$msbuild = Get-MSBuild-Path
Get-Process | where { $_.ProcessName -eq "NAPS2.vshost" } | kill
"Cleaning"
& $msbuild "$SolutionRoot\NAPS2.sln" /v:q /t:Clean
"Building EXE"
& $msbuild "$SolutionRoot\NAPS2.sln" /v:q /p:Configuration=InstallerEXE
"Building MSI"
& $msbuild "$SolutionRoot\NAPS2.sln" /v:q /p:Configuration=InstallerMSI
"Building Standalone"
& $msbuild "$SolutionRoot\NAPS2.sln" /v:q /p:Configuration=Standalone
"Build complete."
}
function Get-NAPS2-Languages {
Get-ChildItem "$SolutionRoot\NAPS2.Sdk\Lang\po\" |
foreach { $_.Name -replace ".po", "" } |
where { $_ -ne "templatest" } |
where { $_ -ne "en" }
}
function Publish-NAPS2-Standalone {
param([Parameter(Position=0)] [String] $PublishDir,
[Parameter(Position=1)] [String] $Configuration,
[Parameter(Position=2)] [String] $ArchiveFile)
$StandaloneDir = $PublishDir + "naps2-$Version-portable\"
$AppDir = $StandaloneDir + "App\"
$LibDir = $StandaloneDir + "App\lib\"
$DataDir = $StandaloneDir + "Data\"
if (Test-Path $StandaloneDir) {
rmdir $StandaloneDir -Recurse
}
mkdir $StandaloneDir
mkdir $AppDir
mkdir $DataDir
$BinDir = "$SolutionRoot\NAPS2.App.WinForms\bin\$Configuration\"
$CmdBinDir = "$SolutionRoot\NAPS2.App.Console\bin\$Configuration\"
$ServerBinDir = "$SolutionRoot\NAPS2.App.Server\bin\$Configuration\"
$PortableBinDir = "$SolutionRoot\NAPS2.App.PortableLauncher\bin\Release\"
cp ($PortableBinDir + "NAPS2.Portable.exe") $StandaloneDir
foreach ($LanguageCode in Get-NAPS2-Languages) {
$LangDir = $LibDir + "$LanguageCode\"
mkdir $LangDir
cp ($BinDir + "$LanguageCode\NAPS2.Core.resources.dll") $LangDir
}
foreach ($Dir in ($BinDir, $CmdBinDir)) {
foreach ($File in (Get-ChildItem $Dir | where { $_.Name -match '(?<!vshost)\.exe(\.config)?$' })) {
cp $File.FullName $AppDir
}
foreach ($File in (Get-ChildItem $Dir | where { $_.Name -match '\.dll$' })) {
cp $File.FullName $LibDir
}
}
foreach ($File in ("$SolutionRoot\NAPS2.App.WinForms\appsettings.xml", "lib\twaindsm.dll")) {
cp $File $LibDir
}
$LibDir_win32 = $LibDir + "_win32\"
mkdir $LibDir_win32
foreach ($File in ("lib\win32\twaindsm.dll")) {
cp $File $LibDir32
}
$LibDir_win64 = $LibDir + "_win64\"
mkdir $LibDir_win64
foreach ($File in ("lib\win64\twaindsm.dll")) {
cp $File $LibDir64
}
cp "$SolutionRoot\LICENSE" ($AppDir + "license.txt")
cp "$SolutionRoot\CONTRIBUTORS" ($AppDir + "contributors.txt")
if (Test-Path $ArchiveFile) {
rm $ArchiveFile
}
& (Get-7z-Path) a $ArchiveFile $($StandaloneDir + "*")
rmdir -Recurse $StandaloneDir
}

View File

@ -1 +0,0 @@
start powershell

View File

@ -10,6 +10,13 @@ namespace NAPS2.Tools;
public static class Program
{
// TODO: Add a "testpo"/"testlang" command that:
// - Takes the URL/path of a .po file as input
// - Downloads it
// - Replaces the corresponding .po file
// - Updates language resources for that language
// - Possibly then runs "pkg zip --name test-{lang}"
public static void Main(string[] args) =>
Parser.Default
.ParseArguments<CleanOptions, BuildOptions, TestOptions, PackageOptions, InstallOptions, VerifyOptions,

View File

@ -19,4 +19,6 @@ public class PackageOptions
public bool Verbose { get; set; }
// TODO: Add net target (net462/net6/net6-windows etc.)
// TODO: Add an option to change the package name for building test packages
}