mirror of
https://github.com/dnote/dnote
synced 2026-03-14 22:45:50 +01:00
Remove dependency on packr (#597)
* Embed files * Build CLI * Remove packr * Embed view directory * Embed static files * Make view engine * Populate build info
This commit is contained in:
parent
f649b5225b
commit
5bba57fd29
67 changed files with 789 additions and 789 deletions
|
|
@ -19,11 +19,6 @@ projectDir="$dir/../.."
|
|||
basedir="$projectDir/pkg/cli"
|
||||
outputDir="$projectDir/build/cli"
|
||||
|
||||
# xgo has issues when using modules
|
||||
# https://github.com/karalabe/xgo/issues/176
|
||||
# bypass it by copying the project inside a GOPATH
|
||||
goPathBasedir="$GOPATH/src/github.com/dnote/dnote"
|
||||
|
||||
command_exists () {
|
||||
command -v "$1" >/dev/null 2>&1;
|
||||
}
|
||||
|
|
@ -41,7 +36,7 @@ if [[ $1 == v* ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
goVersion=1.13.x
|
||||
goVersion=go-1.17.x
|
||||
|
||||
get_binary_name() {
|
||||
platform=$1
|
||||
|
|
@ -62,9 +57,11 @@ build() {
|
|||
|
||||
# build binary
|
||||
destDir="$outputDir/$platform-$arch"
|
||||
ldflags="-X main.apiEndpoint=https://api.getdnote.com -X main.versionTag=$version"
|
||||
ldflags="-X main.apiEndpoint=https://api.getdnote.com -X github.com/dnote/dnote/pkg/server/buildinfo.Version=$version"
|
||||
tags="fts5"
|
||||
|
||||
pushd "$projectDir"
|
||||
|
||||
mkdir -p "$destDir"
|
||||
|
||||
if [ "$native" == true ]; then
|
||||
|
|
@ -75,17 +72,25 @@ build() {
|
|||
-o="$destDir/cli-$platform-$arch" \
|
||||
"$basedir"
|
||||
else
|
||||
flags=()
|
||||
if [ "$platform" == "windows" ]; then
|
||||
flags+=("-buildmode=exe")
|
||||
fi
|
||||
|
||||
xgo \
|
||||
-go "$goVersion" \
|
||||
--targets="$platform/$arch" \
|
||||
-targets="$platform/$arch" \
|
||||
-ldflags "$ldflags" \
|
||||
--tags "$tags" \
|
||||
--dest="$destDir" \
|
||||
-x \
|
||||
-v \
|
||||
"$goPathBasedir/pkg/cli"
|
||||
-dest="$destDir" \
|
||||
-out="cli" \
|
||||
"${flags[@]}" \
|
||||
-tags "$tags" \
|
||||
-pkg pkg/cli \
|
||||
.
|
||||
fi
|
||||
|
||||
popd
|
||||
|
||||
binaryName=$(get_binary_name "$platform")
|
||||
mv "$destDir/cli-${platform}-"* "$destDir/$binaryName"
|
||||
|
||||
|
|
@ -105,11 +110,8 @@ build() {
|
|||
}
|
||||
|
||||
if [ -z "$GOOS" ] && [ -z "$GOARCH" ]; then
|
||||
# fetch tool
|
||||
go get -u github.com/dnote/xgo
|
||||
|
||||
rm -rf "$GOPATH/src/github.com/dnote/dnote"
|
||||
cp -R "$projectDir" "$goPathBasedir"
|
||||
# install the tool
|
||||
go install src.techknowlogick.com/xgo@latest
|
||||
|
||||
build linux amd64
|
||||
build linux arm64
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue