Added fancy printing when building, fixed compressionlevel attempting to be set when no compression is specified
Signed-off-by: arzumify <jliwin98@danwin1210.de>
This commit is contained in:
parent
d6adc1c775
commit
6b483f712e
34
build.sh
34
build.sh
|
@ -1,13 +1,33 @@
|
|||
#!/bin/sh
|
||||
|
||||
clear
|
||||
|
||||
fancy() {
|
||||
width="$(tput cols)"
|
||||
# Create a string of spaces based on the width
|
||||
spaces=$(printf '%*s' "$width" '' | tr ' ' ' ')
|
||||
|
||||
# Print the formatted output
|
||||
printf "%b%s %s %s%s\n\033[0m" "$1" "$spaces" "$2" "$(printf '%*s' "$((width - ${#2} - 4))" '' | tr ' ' ' ')" "$spaces"
|
||||
}
|
||||
|
||||
fancy "\033[1;106m" "Welcome to fulgens! Starting build..."
|
||||
|
||||
sleep 1
|
||||
|
||||
path=$(realpath "$(dirname "$0")") || exit 1
|
||||
search_dir="$path/services-src"
|
||||
find -L "$search_dir" -type f -name "build.sh" | while read -r build_script; do
|
||||
echo "Running $build_script..."
|
||||
build_dir=$(dirname "$build_script")
|
||||
(cd "$build_dir" && ./build.sh) || {
|
||||
echo "Error: $build_script failed."
|
||||
searchDir="$path/services-src"
|
||||
find -L "$searchDir" -type f -name "build.sh" | while read -r buildScript; do
|
||||
clear
|
||||
buildDir=$(dirname "$buildScript")
|
||||
fancy "\033[1;104m" "Starting build of $(basename "$buildDir")..."
|
||||
(cd "$buildDir" && ./build.sh) || {
|
||||
printf "\033[1;31mError: %s failed.\033[0m\n" "$buildScript"
|
||||
exit 1
|
||||
}
|
||||
done
|
||||
clear
|
||||
fancy "\033[1;105m" "Building Fulgens..."
|
||||
go build --ldflags "-s -w" -o "$path/fulgens" || exit 1
|
||||
echo "Fulgens has been built successfully."
|
||||
clear
|
||||
fancy "\033[1;102m" "Fulgensfas has been built successfully!"
|
13
main.go
13
main.go
|
@ -539,14 +539,15 @@ func parseConfig(path string) Config {
|
|||
}
|
||||
|
||||
// Set the compression level
|
||||
compressionLevelI64, err := config.Global.CompressionLevelJN.Int64()
|
||||
if err != nil {
|
||||
slog.Error("Error parsing compression level: ", err)
|
||||
os.Exit(1)
|
||||
if config.Global.Compression != "" {
|
||||
compressionLevelI64, err := config.Global.CompressionLevelJN.Int64()
|
||||
if err != nil {
|
||||
slog.Error("Error parsing compression level: ", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
config.Global.CompressionLevel = int(compressionLevelI64)
|
||||
}
|
||||
|
||||
config.Global.CompressionLevel = int(compressionLevelI64)
|
||||
|
||||
// Validate the configuration
|
||||
err = validate.Struct(config)
|
||||
if err != nil {
|
||||
|
|
|
@ -5,19 +5,19 @@ resourceDir="$path/../../resources/00000000-0000-0000-0000-000000000004"
|
|||
rm -rf "$resourceDir" || exit 1
|
||||
rm -rf "$path/../../services/auth.fgs" || exit 1
|
||||
cd "$path" || exit 1
|
||||
printf "\033[1;35mBuilding auth.fgs...\033[0m\n"
|
||||
go build -o "$path/../../services/auth.fgs" --buildmode=plugin -ldflags "-s -w" || exit 1
|
||||
mkdir -p "$resourceDir/static/wasm" || exit 1
|
||||
cd "$path/resources/wasm/login" || exit 1
|
||||
GOOS=js GOARCH=wasm go build -o "$resourceDir/static/wasm/login.wasm" -ldflags "-s -w" || exit 1
|
||||
cd "$path/resources/wasm/signup" || exit 1
|
||||
GOOS=js GOARCH=wasm go build -o "$resourceDir/static/wasm/signup.wasm" -ldflags "-s -w" || exit 1
|
||||
cd "$path/resources/wasm/authorize" || exit 1
|
||||
GOOS=js GOARCH=wasm go build -o "$resourceDir/static/wasm/authorize.wasm" -ldflags "-s -w" || exit 1
|
||||
cd "$path/resources/wasm/dashboard" || exit 1
|
||||
GOOS=js GOARCH=wasm go build -o "$resourceDir/static/wasm/dashboard.wasm" -ldflags "-s -w" || exit 1
|
||||
cd "$path/resources/wasm/testApp" || exit 1
|
||||
GOOS=js GOARCH=wasm go build -o "$resourceDir/static/wasm/testApp.wasm" -ldflags "-s -w" || exit 1
|
||||
cd "$path/resources/wasm/clientKeyShare" || exit 1
|
||||
GOOS=js GOARCH=wasm go build -o "$resourceDir/static/wasm/clientKeyShare.wasm" -ldflags "-s -w" || exit 1
|
||||
find -L "$path/resources/wasm" -type f -name "main.go" | while read -r mainGo; do
|
||||
buildDir=$(dirname "$mainGo")
|
||||
baseName=$(basename "$buildDir")
|
||||
printf "\033[1;34m\033[1;33mBuilding WASM object %s...\033[0m\n" "$baseName"
|
||||
(cd "$buildDir" && GOOS=js GOARCH=wasm go build -o "$resourceDir/static/wasm/$(basename "$buildDir").wasm" -ldflags "-s -w") || {
|
||||
printf "\033[1;31mError: %s failed.\033[0m\n" "$mainGo"
|
||||
exit 1
|
||||
}
|
||||
done
|
||||
printf "\033[1;34mCopying static files...\033[0m\n"
|
||||
cp -r "$path/resources/static" "$resourceDir/" || exit 1
|
||||
cp -r "$path/resources/templates" "$resourceDir/" || exit 1
|
||||
printf "\033[1;36mauth.fgs has been built successfully!\033[0m\n"
|
|
@ -2,4 +2,6 @@
|
|||
|
||||
path=$(realpath "$(dirname "$0")") || exit 1
|
||||
rm -rf "$path/../../services/storage.fgs" || exit 1
|
||||
printf "\033[1;35mBuilding storage.fgs...\033[0m\n"
|
||||
go build -o "$path/../../services/storage.fgs" --buildmode=plugin -ldflags "-s -w" || exit 1
|
||||
printf "\033[1;36mstorage.fgs has been built successfully!\033[0m\n"
|
Loading…
Reference in New Issue