This repository was archived by the owner on Nov 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathbuild_cli.ps1
More file actions
50 lines (40 loc) · 1.28 KB
/
build_cli.ps1
File metadata and controls
50 lines (40 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
param([string]$buildtfm = 'all')
$ErrorActionPreference = 'Stop'
Write-Host 'dotnet SDK info'
dotnet --info
$net_tfm = 'net6.0-windows'
$configuration = 'Release'
$output_dir = @("$PSScriptRoot\ClashSinicizationToolCLI\bin\$configuration")
$proj_path = @("$PSScriptRoot\ClashSinicizationToolCLI\ClashSinicizationToolCLI.csproj")
$dist_path = "$PSScriptRoot\Dist\$configuration"
$build = $buildtfm -eq 'all' -or $buildtfm -eq 'app'
function Build-App
{
Write-Host 'Building .NET App'
for ($i = 0; $i -lt 1; $i++)
{
$outdir = "{0}\$net_tfm" -f $output_dir[$i]
$publishDir = "$outdir\publish"
Remove-Item $publishDir -Recurse -Force -Confirm:$false -ErrorAction Ignore
dotnet publish -c $configuration -f $net_tfm $proj_path[$i]
if ($LASTEXITCODE) { exit $LASTEXITCODE }
Copy-Item -Path $publishDir\* -Destination $dist_path\ -Recurse -Force
}
}
if ($build)
{
if (Test-Path $PSScriptRoot\Dist)
{
Remove-Item -Path $PSScriptRoot\Dist -Recurse
}
if (-not (Test-Path $PSScriptRoot\Dist))
{
New-Item -Path $PSScriptRoot -Name Dist -ItemType Directory > $null
}
if (-not (Test-Path $dist_path))
{
New-Item -Path $PSScriptRoot\Dist -Name $configuration -ItemType Directory > $null
}
Build-App
Expand-Archive -Path $PSScriptRoot\Node_asar.zip -DestinationPath $dist_path\
}