mirror of
https://github.com/v2rayA/v2rayA.git
synced 2026-11-20 23:02:25 +03:00
chore: refine build scripts
This commit is contained in:
1 parent
901ea6da56
commit
ae1049f520
2 files changed
+24
-19
No files matched your search
+18
-14
@@ -1,23 +1,17 @@
|
||||
## Check OS
|
||||
$TestWinDir = Test-Path $env:windir -ErrorAction Ignore
|
||||
|
||||
if ([String]::IsNullOrEmpty($TestWinDir)) {
|
||||
$v2rayaBin = "v2raya"
|
||||
}
|
||||
else {
|
||||
$v2rayaBin = "v2raya.exe"
|
||||
}
|
||||
Set-PSDebug -Trace 1
|
||||
|
||||
## Get current folder
|
||||
$SHELL_FOLDER = Get-Item -LiteralPath .\ | ForEach-Object -Process { $_.FullName }
|
||||
$CWD = Get-Location
|
||||
$shell_path = Resolve-Path -Path $PSCommandPath
|
||||
$SHELL_FOLDER = Split-Path $shell_path
|
||||
|
||||
## Get date
|
||||
$DateLong = git log -1 --format="%cd" --date=short
|
||||
$DateLong = git -C "$SHELL_FOLDER" log -1 --format="%cd" --date=short
|
||||
$Date = $DateLong -replace "-"; ""
|
||||
|
||||
## Other info
|
||||
$count = git rev-list --count HEAD
|
||||
$commit = git rev-parse --short HEAD
|
||||
$count = git -C "$SHELL_FOLDER" rev-list --count HEAD
|
||||
$commit = git -C "$SHELL_FOLDER" rev-parse --short HEAD
|
||||
|
||||
## Version
|
||||
$version = "unstable-$date.r$count.$commit"
|
||||
@@ -39,6 +33,15 @@ else {
|
||||
Write-Output "You don't install golang, please install it and add it to your path."
|
||||
}
|
||||
else {
|
||||
## Check OS
|
||||
$TestWinDir = Test-Path $env:windir -ErrorAction Ignore
|
||||
|
||||
if ([String]::IsNullOrEmpty($TestWinDir)) {
|
||||
$v2rayaBin = "v2raya"
|
||||
}
|
||||
else {
|
||||
$v2rayaBin = "v2raya.exe"
|
||||
}
|
||||
${env:CGO_ENABLED} = "0"
|
||||
${env:OUTPUT_DIR} = "$SHELL_FOLDER/service/server/router/web"
|
||||
$guiPath = $SHELL_FOLDER + "/gui"
|
||||
@@ -47,7 +50,8 @@ else {
|
||||
yarn build
|
||||
$corePath = $SHELL_FOLDER + "/service"
|
||||
Set-Location -path "$corePath"
|
||||
go build -ldflags "-X github.com/v2rayA/v2rayA/conf.Version=$version -s -w" -o "$SHELL_FOLDER/$v2rayaBin"
|
||||
go build -ldflags "-X github.com/v2rayA/v2rayA/conf.Version=$version -s -w" -o "$CWD/$v2rayaBin"
|
||||
}
|
||||
}
|
||||
}
|
||||
Set-Location -path "$CWD"
|
||||
@@ -1,13 +1,14 @@
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
SHELL_FOLDER="$(pwd)"/"$(dirname $0)"
|
||||
CWD="$(pwd)"
|
||||
SHELL_FOLDER="$(dirname $(realpath $0))"
|
||||
if [ -d "$SHELL_FOLDER/.git" ]; then
|
||||
date=$(git log -1 --format="%cd" --date=short | sed s/-//g)
|
||||
count=$(git rev-list --count HEAD)
|
||||
commit=$(git rev-parse --short HEAD)
|
||||
date=$(git -C "$SHELL_FOLDER" log -1 --format="%cd" --date=short | sed s/-//g)
|
||||
count=$(git -C "$SHELL_FOLDER" rev-list --count HEAD)
|
||||
commit=$(git -C "$SHELL_FOLDER" rev-parse --short HEAD)
|
||||
version="unstable-$date.r${count}.$commit"
|
||||
else
|
||||
version="unstable"
|
||||
fi
|
||||
cd "$SHELL_FOLDER"/gui && yarn && OUTPUT_DIR="$SHELL_FOLDER"/service/server/router/web yarn build
|
||||
cd "$SHELL_FOLDER"/service && CGO_ENABLED=0 go build -ldflags "-X github.com/v2rayA/v2rayA/conf.Version=$version -s -w" -o "$SHELL_FOLDER"/v2raya
|
||||
cd "$SHELL_FOLDER"/service && CGO_ENABLED=0 go build -ldflags "-X github.com/v2rayA/v2rayA/conf.Version=$version -s -w" -o "$CWD"/v2raya
|
||||
Reference in new issue
Block a user