echo "Deleting artifacts from previous builds"
rm -f template_*.go
rm -f gen_*.go
rm -f tmpl_client/template_*.go
rm -f ./Gosora

echo "Building the router generator"
go build -ldflags="-s -w" -o RouterGen "./router_gen"
echo "Running the router generator"
./RouterGen

echo "Building the query generator"
go build -ldflags="-s -w" -o QueryGen "./cmd/query_gen"
echo "Running the query generator"
./QueryGen

echo "Generating the JSON handlers"
easyjson -pkg common

echo "Building Gosora"
go generate
go build -ldflags="-s -w" -o Gosora

echo "Building the installer"
go build -ldflags="-s -w" -o Installer "./install"