mirror of
https://github.com/2dust/v2rayN.git
synced 2025-08-30 06:46:19 +00:00
Update build.ps1
refactoring codes
This commit is contained in:
parent
7bcc5ab30b
commit
85b332ba84
1 changed files with 39 additions and 31 deletions
|
@ -1,12 +1,12 @@
|
|||
param (
|
||||
[Parameter()]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$OutputPath = '.\bin\v2rayN'
|
||||
[string] $OutputPath = '.\bin\v2rayN'
|
||||
)
|
||||
|
||||
Write-Host 'Building'
|
||||
Write-Host 'Building...'
|
||||
|
||||
# Publish for Windows
|
||||
dotnet publish `
|
||||
.\v2rayN\v2rayN.csproj `
|
||||
-c Release `
|
||||
|
@ -16,6 +16,7 @@ dotnet publish `
|
|||
-p:PublishSingleFile=true `
|
||||
-o "$OutputPath\win-x64"
|
||||
|
||||
# Publish for Linux
|
||||
dotnet publish `
|
||||
.\v2rayN.Desktop\v2rayN.Desktop.csproj `
|
||||
-c Release `
|
||||
|
@ -25,18 +26,25 @@ dotnet publish `
|
|||
-p:PublishSingleFile=true `
|
||||
-o "$OutputPath\linux-x64"
|
||||
|
||||
|
||||
if ( -Not $? ) {
|
||||
exit $lastExitCode
|
||||
}
|
||||
|
||||
if ( Test-Path -Path .\bin\v2rayN ) {
|
||||
rm -Force "$OutputPath\win-x64\*.pdb"
|
||||
rm -Force "$OutputPath\linux-x64\*.pdb"
|
||||
# Check if the publish succeeded
|
||||
if (-Not $?) {
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
|
||||
Write-Host 'Build done'
|
||||
# Clean up PDB files if they exist
|
||||
if (Test-Path -Path "$OutputPath\win-x64") {
|
||||
Remove-Item -Force "$OutputPath\win-x64\*.pdb"
|
||||
}
|
||||
if (Test-Path -Path "$OutputPath\linux-x64") {
|
||||
Remove-Item -Force "$OutputPath\linux-x64\*.pdb"
|
||||
}
|
||||
|
||||
ls $OutputPath
|
||||
Write-Host 'Build done.'
|
||||
|
||||
# List the output directory contents
|
||||
Get-ChildItem $OutputPath
|
||||
|
||||
# Create a zip archive of the output
|
||||
7z a v2rayN.zip $OutputPath
|
||||
|
||||
exit 0
|
Loading…
Reference in a new issue