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,42 +1,50 @@
|
||||||
param (
|
param (
|
||||||
[Parameter()]
|
[Parameter()]
|
||||||
[ValidateNotNullOrEmpty()]
|
[ValidateNotNullOrEmpty()]
|
||||||
[string]
|
[string] $OutputPath = '.\bin\v2rayN'
|
||||||
$OutputPath = '.\bin\v2rayN'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Write-Host 'Building'
|
Write-Host 'Building...'
|
||||||
|
|
||||||
|
# Publish for Windows
|
||||||
dotnet publish `
|
dotnet publish `
|
||||||
.\v2rayN\v2rayN.csproj `
|
.\v2rayN\v2rayN.csproj `
|
||||||
-c Release `
|
-c Release `
|
||||||
-r win-x64 `
|
-r win-x64 `
|
||||||
--self-contained false `
|
--self-contained false `
|
||||||
-p:PublishReadyToRun=false `
|
-p:PublishReadyToRun=false `
|
||||||
-p:PublishSingleFile=true `
|
-p:PublishSingleFile=true `
|
||||||
-o "$OutputPath\win-x64"
|
-o "$OutputPath\win-x64"
|
||||||
|
|
||||||
|
# Publish for Linux
|
||||||
dotnet publish `
|
dotnet publish `
|
||||||
.\v2rayN.Desktop\v2rayN.Desktop.csproj `
|
.\v2rayN.Desktop\v2rayN.Desktop.csproj `
|
||||||
-c Release `
|
-c Release `
|
||||||
-r linux-x64 `
|
-r linux-x64 `
|
||||||
--self-contained true `
|
--self-contained true `
|
||||||
-p:PublishReadyToRun=false `
|
-p:PublishReadyToRun=false `
|
||||||
-p:PublishSingleFile=true `
|
-p:PublishSingleFile=true `
|
||||||
-o "$OutputPath\linux-x64"
|
-o "$OutputPath\linux-x64"
|
||||||
|
|
||||||
|
# Check if the publish succeeded
|
||||||
if ( -Not $? ) {
|
if (-Not $?) {
|
||||||
exit $lastExitCode
|
exit $LASTEXITCODE
|
||||||
}
|
|
||||||
|
|
||||||
if ( Test-Path -Path .\bin\v2rayN ) {
|
|
||||||
rm -Force "$OutputPath\win-x64\*.pdb"
|
|
||||||
rm -Force "$OutputPath\linux-x64\*.pdb"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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.'
|
||||||
7z a v2rayN.zip $OutputPath
|
|
||||||
exit 0
|
# 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