@@ -38,21 +38,34 @@ function GetPublishFolderPath($projectName, $folderNameSuffix) {
3838 " .\$projectName \bin\publish-$folderNameSuffix "
3939}
4040
41- function PlatformToBuildPlatform ($platform ) {
41+ function PlatformToBuildPlatform (
42+ [ValidateSet (' x64' , ' arm64' )]
43+ [string ]$platform ) {
4244 if ($platform -ieq " x64" ) { return " x64" }
4345 elseif ($platform -ieq " arm64" ) { return " ARM64" }
4446 else { ExitWithError " Unknown platform: $platform " }
4547}
4648
4749# Basic clear and publish for a specific project and publish profile
48- function Publish ($projectName , $platform , $installerType , $publishProfileName ) {
50+ function Publish (
51+ $projectName ,
52+ [ValidateSet (' x64' , ' arm64' )]
53+ [string ]$platform ,
54+ [ValidateSet (' installer' , ' portable' )]
55+ [string ]$installerType ,
56+ [string ]$publishProfileName ) {
4957 $folderNameSuffix = " $installerType -$platform "
5058 $buildPlatform = PlatformToBuildPlatform $platform
5159
5260 PublishRaw $projectName $buildPlatform $folderNameSuffix $publishProfileName
5361}
5462
55- function PublishRaw ($projectName , $buildPlatform , $folderNameSuffix , $publishProfileName ) {
63+ function PublishRaw (
64+ $projectName ,
65+ [ValidateSet (' x64' , ' ARM64' , ' AnyCPU' )]
66+ [string ]$buildPlatform ,
67+ [string ]$folderNameSuffix ,
68+ [string ]$publishProfileName ) {
5669 Write-Host " Publishing $folderNameSuffix on project $projectName for $buildPlatform ..."
5770 $publishFolderPath = GetPublishFolderPath $projectName $folderNameSuffix
5871 if (Test-Path - Path $publishFolderPath ) {
@@ -69,12 +82,17 @@ function PublishRaw($projectName, $buildPlatform, $folderNameSuffix, $publishPro
6982}
7083
7184# Publish an installer and copy extra files for it
72- function PublishInstaller ($platform , $publishProfileName ) {
85+ function PublishInstaller (
86+ [ValidateSet (' x64' , ' arm64' )]
87+ [string ]$platform ,
88+ [string ]$publishProfileName ) {
7389 Publish " VidCoder" $platform " installer" $publishProfileName
7490 CopyInstallerExtraFiles $platform
7591}
7692
77- function CopyInstallerExtraFiles ($platform ) {
93+ function CopyInstallerExtraFiles (
94+ [ValidateSet (' x64' , ' arm64' )]
95+ [string ]$platform ) {
7896 $extraFiles = @ (
7997 " .\VidCoder\Icons\File\VidCoderPreset.ico" ,
8098 " .\VidCoder\Icons\File\VidCoderQueue.ico" )
@@ -124,7 +142,9 @@ if ($debugBuild) {
124142
125143$winRarExe = " c:\Program Files\WinRar\WinRAR.exe"
126144
127- function BuildPortable ($platform ) {
145+ function BuildPortable (
146+ [ValidateSet (' x64' , ' arm64' )]
147+ [string ]$platform ) {
128148 Write-Host " Creating portable exe for $platform ..."
129149 New-Item - ItemType Directory - Force - Path " .\$builtInstallerFolder "
130150
@@ -142,7 +162,9 @@ function BuildPortable($platform) {
142162BuildPortable " x64"
143163BuildPortable " arm64"
144164
145- function BuildZip ($platform ) {
165+ function BuildZip (
166+ [ValidateSet (' x64' , ' arm64' )]
167+ [string ]$platform ) {
146168 # Sign executables in publish-installer, for inclusion in the .zip Release
147169 $publishedExes = Get-ChildItem - Path .\VidCoder\bin\publish-installer - $platform \ - Filter * .exe
148170 foreach ($exeFile in $publishedExes ) {
@@ -171,7 +193,13 @@ if ($beta) {
171193
172194$releaseDir = " .\Installer\Releases-$releaseDirSuffix "
173195
174- function Velopack ($packId , $channel , $releaseDir , $platform ) {
196+ function Velopack (
197+ [string ]$packId ,
198+ [ValidateSet (' win' , ' win-arm64' )]
199+ [string ]$channel ,
200+ [string ]$releaseDir ,
201+ [ValidateSet (' x64' , ' arm64' )]
202+ [string ]$platform ) {
175203 Write-Host " Building Velopack for $platform "
176204 vpk pack `
177205 - x `
0 commit comments