From c686315ee0be2656679440a159c1442836078a49 Mon Sep 17 00:00:00 2001 From: Netch Date: Sun, 12 Sep 2021 23:08:57 +0800 Subject: [PATCH] Build xray-plugin --- Other/xray-plugin/build.ps1 | 19 +++++++++++++++++++ Other/xray-plugin/deps.ps1 | 0 scripts/deps/xray-plugin.ps1 | 25 ------------------------- 3 files changed, 19 insertions(+), 25 deletions(-) create mode 100644 Other/xray-plugin/build.ps1 create mode 100644 Other/xray-plugin/deps.ps1 delete mode 100644 scripts/deps/xray-plugin.ps1 diff --git a/Other/xray-plugin/build.ps1 b/Other/xray-plugin/build.ps1 new file mode 100644 index 00000000..51b72f4b --- /dev/null +++ b/Other/xray-plugin/build.ps1 @@ -0,0 +1,19 @@ +Push-Location (Split-Path $MyInvocation.MyCommand.Path -Parent) + +git clone https://github.com/teddysun/xray-plugin src +if ( -Not $? ) { + Pop-Location + exit $lastExitCode +} +Push-Location src + +$Env:CGO_ENABLED='0' +$Env:GOROOT_FINAL='/usr' + +$Env:GOOS='windows' +$Env:GOARCH='amd64' +go build -a -trimpath -asmflags '-s -w' -ldflags '-s -w' -o '..\..\release\xray-plugin.exe' + +Pop-Location +Pop-Location +exit $lastExitCode \ No newline at end of file diff --git a/Other/xray-plugin/deps.ps1 b/Other/xray-plugin/deps.ps1 new file mode 100644 index 00000000..e69de29b diff --git a/scripts/deps/xray-plugin.ps1 b/scripts/deps/xray-plugin.ps1 deleted file mode 100644 index 870caf8c..00000000 --- a/scripts/deps/xray-plugin.ps1 +++ /dev/null @@ -1,25 +0,0 @@ -param ( - [string] - $OutputPath -) - -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 'xray-plugin.tar.gz' -if ( -Not $? ) { exit $lastExitCode } - -7z x 'xray-plugin.tar' -if ( -Not $? ) { exit $lastExitCode } - -mv -Force 'xray-plugin_windows_amd64.exe' "$OutputPath\xray-plugin.exe" - -rm -Force 'xray-plugin.tar' -rm -Force 'xray-plugin.tar.gz' -exit 0 \ No newline at end of file