mirror of
https://github.com/netchx/netch.git
synced 2026-04-01 19:15:09 +08:00
Update build scripts
This commit is contained in:
10
build.ps1
10
build.ps1
@@ -43,11 +43,11 @@ if (Test-Path .\other\release) {
|
||||
}
|
||||
|
||||
Write-Host
|
||||
Write-Host "Building Netch"
|
||||
Write-Host 'Building Netch'
|
||||
dotnet publish `
|
||||
-c $Configuration `
|
||||
-r "win-x64" `
|
||||
-p:Platform="x64" `
|
||||
-r 'win-x64' `
|
||||
-p:Platform='x64' `
|
||||
-p:PublishSingleFile=$PublishSingleFile `
|
||||
-p:SelfContained=$SelfContained `
|
||||
-p:PublishTrimmed=$SelfContained `
|
||||
@@ -57,7 +57,7 @@ dotnet publish `
|
||||
if ( -Not $? ) { exit $lastExitCode }
|
||||
|
||||
Write-Host
|
||||
Write-Host "Building Redirector"
|
||||
Write-Host 'Building Redirector'
|
||||
msbuild `
|
||||
-property:Configuration=Release `
|
||||
-property:Platform=x64 `
|
||||
@@ -66,7 +66,7 @@ if ( -Not $? ) { exit $lastExitCode }
|
||||
|
||||
Copy-Item -Force Redirector\bin\Redirector.bin $OutputPath\bin
|
||||
|
||||
if ( "Release".Equals($Configuration) ) {
|
||||
if ( $Configuration.Equals('Release') ) {
|
||||
Remove-Item -Force $OutputPath\*.pdb
|
||||
Remove-Item -Force $OutputPath\*.xml
|
||||
}
|
||||
|
||||
33
clean.ps1
33
clean.ps1
@@ -1,22 +1,27 @@
|
||||
Set-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)
|
||||
Push-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)
|
||||
|
||||
function Delete {
|
||||
param([string]$Path)
|
||||
param (
|
||||
[string]
|
||||
$Path
|
||||
)
|
||||
|
||||
if (Test-Path $Path) {
|
||||
Remove-Item -Recurse -Force $Path | Out-Null
|
||||
rm -Recurse -Force $Path | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
Delete ".vs"
|
||||
Delete "release"
|
||||
Delete "Netch\bin"
|
||||
Delete "Netch\obj"
|
||||
Delete "Tests\bin"
|
||||
Delete "Tests\obj"
|
||||
Delete "TestResults"
|
||||
Delete "Redirector\bin"
|
||||
Delete "Redirector\obj"
|
||||
Delete '.vs'
|
||||
Delete 'release'
|
||||
Delete 'Netch\bin'
|
||||
Delete 'Netch\obj'
|
||||
Delete 'Tests\bin'
|
||||
Delete 'Tests\obj'
|
||||
Delete 'TestResults'
|
||||
Delete 'Redirector\bin'
|
||||
Delete 'Redirector\obj'
|
||||
|
||||
.\Other\clean.ps1
|
||||
exit $lastExitCode
|
||||
.\other\clean.ps1
|
||||
|
||||
Pop-Location
|
||||
exit $lastExitCode
|
||||
21
deps.ps1
21
deps.ps1
@@ -3,29 +3,32 @@ param (
|
||||
$OutputPath = 'release'
|
||||
)
|
||||
|
||||
Push-Location $OutputPath
|
||||
if ( Test-Path -Path "$OutputPath" -IsValid ) {
|
||||
New-Item -ItemType Directory -Name "$OutputPath" | Out-Null
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Name bin | Out-Null
|
||||
New-Item -ItemType Directory -Name mode | Out-Null
|
||||
New-Item -ItemType Directory -Name i18n | Out-Null
|
||||
Push-Location "$OutputPath"
|
||||
New-Item -ItemType Directory -Name 'bin' | Out-Null
|
||||
New-Item -ItemType Directory -Name 'mode' | Out-Null
|
||||
New-Item -ItemType Directory -Name 'i18n' | Out-Null
|
||||
|
||||
# Get-ChildItem -Path ..\scripts\deps\base -File | ForEach-Object {
|
||||
# Get-ChildItem -Path '..\scripts\deps\main' -File | ForEach-Object {
|
||||
# $name=$_.Name
|
||||
|
||||
# Write-Host "Executing $name"
|
||||
# & "..\scripts\deps\base\$name"
|
||||
# if (-Not $?) {
|
||||
# if ( -Not $? ) {
|
||||
# Pop-Location
|
||||
# exit $lastExitCode
|
||||
# }
|
||||
# }
|
||||
|
||||
Get-ChildItem -Path ..\scripts\deps -File | ForEach-Object {
|
||||
Get-ChildItem -Path '..\scripts\deps' -File | ForEach-Object {
|
||||
$name=$_.Name
|
||||
|
||||
Write-Host "Executing $name"
|
||||
& "..\scripts\deps\$name" -OutputPath bin
|
||||
if (-Not $?) {
|
||||
& "..\scripts\deps\$name" -OutputPath 'bin'
|
||||
if ( -Not $? ) {
|
||||
Pop-Location
|
||||
exit $lastExitCode
|
||||
}
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
param([string]$OutputPath)
|
||||
$name="ck-client.exe"
|
||||
$address="https://github.com/cbeuw/Cloak/releases/download/v2.5.4/ck-client-windows-amd64-v2.5.4.exe"
|
||||
param (
|
||||
[string]
|
||||
$OutputPath
|
||||
)
|
||||
|
||||
..\scripts\download.ps1 $name $address
|
||||
if (-Not $?) { exit $lastExitCode }
|
||||
try {
|
||||
Invoke-WebRequest `
|
||||
-Uri 'https://github.com/cbeuw/Cloak/releases/download/v2.5.4/ck-client-windows-amd64-v2.5.4.exe' `
|
||||
-OutFile 'ck-client.exe'
|
||||
}
|
||||
catch {
|
||||
exit 1
|
||||
}
|
||||
|
||||
Move-Item -Force $name $OutputPath
|
||||
mv -Force 'ck-client.exe' $OutputPath
|
||||
exit 0
|
||||
@@ -1,9 +1,16 @@
|
||||
param([string]$OutputPath)
|
||||
$name="geoip.dat"
|
||||
$address="https://github.com/v2fly/geoip/releases/download/202107150023/geoip.dat"
|
||||
param (
|
||||
[string]
|
||||
$OutputPath
|
||||
)
|
||||
|
||||
..\scripts\download.ps1 $name $address
|
||||
if (-Not $?) { exit $lastExitCode }
|
||||
try {
|
||||
Invoke-WebRequest `
|
||||
-Uri 'https://github.com/v2fly/geoip/releases/download/202107150023/geoip.dat' `
|
||||
-OutFile 'geoip.dat'
|
||||
}
|
||||
catch {
|
||||
exit 1
|
||||
}
|
||||
|
||||
Move-Item -Force $name $OutputPath
|
||||
mv -Force 'geoip.dat' $OutputPath
|
||||
exit 0
|
||||
@@ -1,9 +1,16 @@
|
||||
param([string]$OutputPath)
|
||||
$name="geosite.dat"
|
||||
$address="https://github.com/v2fly/domain-list-community/releases/download/20210718155822/dlc.dat"
|
||||
param (
|
||||
[string]
|
||||
$OutputPath
|
||||
)
|
||||
|
||||
..\scripts\download.ps1 $name $address
|
||||
if (-Not $?) { exit $lastExitCode }
|
||||
try {
|
||||
Invoke-WebRequest `
|
||||
-Uri 'https://github.com/v2fly/domain-list-community/releases/download/20210718155822/dlc.dat' `
|
||||
-OutFile 'geosite.dat'
|
||||
}
|
||||
catch {
|
||||
exit 1
|
||||
}
|
||||
|
||||
Move-Item -Force $name $OutputPath
|
||||
mv -Force 'geosite.dat' $OutputPath
|
||||
exit 0
|
||||
@@ -1,17 +1,24 @@
|
||||
param([string]$OutputPath)
|
||||
$name="v2ray-core.zip"
|
||||
$address="https://github.com/v2fly/v2ray-core/releases/download/v4.40.1/v2ray-windows-64.zip"
|
||||
param (
|
||||
[string]
|
||||
$OutputPath
|
||||
)
|
||||
|
||||
..\scripts\download.ps1 $name $address
|
||||
if (-Not $?) { exit $lastExitCode }
|
||||
try {
|
||||
Invoke-WebRequest `
|
||||
-Uri 'https://github.com/v2fly/v2ray-core/releases/download/v4.40.1/v2ray-windows-64.zip' `
|
||||
-OutFile 'v2ray-core.zip'
|
||||
}
|
||||
catch {
|
||||
exit 1
|
||||
}
|
||||
|
||||
..\scripts\extract.ps1 $name "v2ray-core"
|
||||
if (-Not $?) { exit $lastExitCode }
|
||||
7z x 'v2ray-core.zip' -o'v2ray-core'
|
||||
if ( -Not $? ) { exit $lastExitCode }
|
||||
|
||||
Move-Item -Force v2ray-core\v2ctl.exe $OutputPath
|
||||
Move-Item -Force v2ray-core\v2ray.exe $OutputPath
|
||||
Move-Item -Force v2ray-core\wv2ray.exe $OutputPath
|
||||
mv -Force 'v2ray-core\v2ctl.exe' $OutputPath
|
||||
mv -Force 'v2ray-core\v2ray.exe' $OutputPath
|
||||
mv -Force 'v2ray-core\wv2ray.exe' $OutputPath
|
||||
|
||||
Remove-Item -Recurse -Force v2ray-core
|
||||
Remove-Item -Recurse -Force v2ray-core.zip
|
||||
rm -Recurse -Force v2ray-core
|
||||
rm -Recurse -Force v2ray-core.zip
|
||||
exit 0
|
||||
@@ -1,18 +1,25 @@
|
||||
param([string]$OutputPath)
|
||||
$name="v2ray-plugin.tar.gz"
|
||||
$address="https://github.com/teddysun/v2ray-plugin/releases/download/v4.40.1/v2ray-plugin-windows-amd64-v4.40.1.tar.gz"
|
||||
param (
|
||||
[string]
|
||||
$OutputPath
|
||||
)
|
||||
|
||||
..\scripts\download.ps1 $name $address
|
||||
if (-Not $?) { exit $lastExitCode }
|
||||
try {
|
||||
Invoke-WebRequest `
|
||||
-Uri 'https://github.com/teddysun/v2ray-plugin/releases/download/v4.40.1/v2ray-plugin-windows-amd64-v4.40.1.tar.gz' `
|
||||
-OutFile 'v2ray-plugin.tar.gz'
|
||||
}
|
||||
catch {
|
||||
exit 1
|
||||
}
|
||||
|
||||
7z x $name
|
||||
if (-Not $?) { exit $lastExitCode }
|
||||
7z x 'v2ray-plugin.tar.gz'
|
||||
if ( -Not $? ) { exit $lastExitCode }
|
||||
|
||||
7z x "v2ray-plugin.tar"
|
||||
if (-Not $?) { exit $lastExitCode }
|
||||
7z x 'v2ray-plugin.tar'
|
||||
if ( -Not $? ) { exit $lastExitCode }
|
||||
|
||||
Move-Item -Force "v2ray-plugin_windows_amd64.exe" "$OutputPath\v2ray-plugin.exe"
|
||||
mv -Force 'v2ray-plugin_windows_amd64.exe' "$OutputPath\v2ray-plugin.exe"
|
||||
|
||||
Remove-Item -Recurse -Force $name
|
||||
Remove-Item -Recurse -Force v2ray-plugin.tar
|
||||
rm -Force 'v2ray-plugin.tar'
|
||||
rm -Force 'v2ray-plugin.tar.gz'
|
||||
exit 0
|
||||
@@ -1,15 +1,22 @@
|
||||
param([string]$OutputPath)
|
||||
$name="xray-core.zip"
|
||||
$address="https://github.com/XTLS/Xray-core/releases/download/v1.4.2/Xray-windows-64.zip"
|
||||
param (
|
||||
[string]
|
||||
$OutputPath
|
||||
)
|
||||
|
||||
..\scripts\download.ps1 $name $address
|
||||
if (-Not $?) { exit $lastExitCode }
|
||||
try {
|
||||
Invoke-WebRequest `
|
||||
-Uri 'https://github.com/XTLS/Xray-core/releases/download/v1.4.2/Xray-windows-64.zip' `
|
||||
-OutFile 'xray-core.zip'
|
||||
}
|
||||
catch {
|
||||
exit 1
|
||||
}
|
||||
|
||||
..\scripts\extract.ps1 $name "xray-core"
|
||||
if (-Not $?) { exit $lastExitCode }
|
||||
7z x 'xray-core.zip' -o'xray-core'
|
||||
if ( -Not $? ) { exit $lastExitCode }
|
||||
|
||||
Move-Item -Force "xray-core\xray.exe" $OutputPath
|
||||
mv -Force 'xray-core\xray.exe' $OutputPath
|
||||
|
||||
Remove-Item -Recurse -Force xray-core
|
||||
Remove-Item -Recurse -Force xray-core.zip
|
||||
rm -Recurse -Force xray-core
|
||||
rm -Recurse -Force xray-core.zip
|
||||
exit 0
|
||||
@@ -1,18 +1,25 @@
|
||||
param([string]$OutputPath)
|
||||
$name="xray-plugin.tar.gz"
|
||||
$address="https://github.com/teddysun/xray-plugin/releases/download/v1.4.2/xray-plugin-windows-amd64-v1.4.2.tar.gz"
|
||||
param (
|
||||
[string]
|
||||
$OutputPath
|
||||
)
|
||||
|
||||
..\scripts\download.ps1 $name $address
|
||||
if (-Not $?) { exit $lastExitCode }
|
||||
try {
|
||||
Invoke-WebRequest `
|
||||
-Uri 'https://github.com/teddysun/xray-plugin/releases/download/v1.4.2/xray-plugin-windows-amd64-v1.4.2.tar.gz' `
|
||||
-OutFile 'xray-plugin.tar.gz'
|
||||
}
|
||||
catch {
|
||||
exit 1
|
||||
}
|
||||
|
||||
7z x $name
|
||||
if (-Not $?) { exit $lastExitCode }
|
||||
7z x 'xray-plugin.tar.gz'
|
||||
if ( -Not $? ) { exit $lastExitCode }
|
||||
|
||||
7z x "xray-plugin.tar"
|
||||
if (-Not $?) { exit $lastExitCode }
|
||||
7z x 'xray-plugin.tar'
|
||||
if ( -Not $? ) { exit $lastExitCode }
|
||||
|
||||
Move-Item -Force "xray-plugin_windows_amd64.exe" "$OutputPath\xray-plugin.exe"
|
||||
mv -Force 'xray-plugin_windows_amd64.exe' "$OutputPath\xray-plugin.exe"
|
||||
|
||||
Remove-Item -Recurse -Force $name
|
||||
Remove-Item -Recurse -Force xray-plugin.tar
|
||||
rm -Force 'xray-plugin.tar'
|
||||
rm -Force 'xray-plugin.tar.gz'
|
||||
exit 0
|
||||
@@ -1,18 +0,0 @@
|
||||
param (
|
||||
[string]
|
||||
$name,
|
||||
|
||||
[string]
|
||||
$address
|
||||
)
|
||||
|
||||
try
|
||||
{
|
||||
Invoke-WebRequest -OutFile $name -Uri $address
|
||||
}
|
||||
catch
|
||||
{
|
||||
exit 1
|
||||
}
|
||||
|
||||
exit 0
|
||||
@@ -1,19 +0,0 @@
|
||||
param (
|
||||
[string]
|
||||
$name,
|
||||
|
||||
[string]
|
||||
$address
|
||||
)
|
||||
|
||||
try
|
||||
{
|
||||
Expand-Archive -Force -Path $name -DestinationPath $address
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Host "Extract $name failed"
|
||||
exit 1
|
||||
}
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user