update startup scripts to call hookgen

reduce boilerplate in some older startup scripts
update advance install docs
This commit is contained in:
Azareal 2020-05-24 18:06:24 +10:00
parent 13552ee662
commit 480ff79d6d
13 changed files with 289 additions and 78 deletions

View File

@ -5,20 +5,31 @@ rm -f gen_*.go
rm -f tmpl_client/template_* rm -f tmpl_client/template_*
rm -f tmpl_client/tmpl_* rm -f tmpl_client/tmpl_*
rm -f ./Gosora rm -f ./Gosora
rm -f ./common/gen_extend.go
echo "Building the router generator" echo "Building the router generator"
go build -ldflags="-s -w" -o RouterGen "./router_gen" go build -ldflags="-s -w" -o RouterGen "./router_gen"
echo "Running the router generator" echo "Running the router generator"
./RouterGen ./RouterGen
echo "Building the hook stub generator"
go build -ldflags="-s -w" -o HookStubGen "./cmd/hook_stub_gen"
echo "Running the hook stub generator"
./HookStubGen
echo "Building the hook generator"
go build -tags hookgen -ldflags="-s -w" -o HookGen "./cmd/hook_gen"
echo "Running the hook generator"
./HookGen
echo "Generating the JSON handlers"
easyjson -pkg common
echo "Building the query generator" echo "Building the query generator"
go build -ldflags="-s -w" -o QueryGen "./cmd/query_gen" go build -ldflags="-s -w" -o QueryGen "./cmd/query_gen"
echo "Running the query generator" echo "Running the query generator"
./QueryGen ./QueryGen
echo "Generating the JSON handlers"
easyjson -pkg common
echo "Building Gosora" echo "Building Gosora"
go generate go generate
go build -ldflags="-s -w" -o Gosora go build -ldflags="-s -w" -o Gosora

View File

@ -5,32 +5,34 @@ rm -f gen_*.go
rm -f tmpl_client/template_* rm -f tmpl_client/template_*
rm -f tmpl_client/tmpl_* rm -f tmpl_client/tmpl_*
rm -f ./Gosora rm -f ./Gosora
rm -f ./common/gen_extend.go
echo "Building the router generator" echo "Building the router generator"
cd ./router_gen go build -ldflags="-s -w" -o RouterGen "./router_gen"
go build -ldflags="-s -w" -o RouterGen
mv ./RouterGen ..
cd ..
echo "Running the router generator" echo "Running the router generator"
./RouterGen ./RouterGen
echo "Building the query generator" echo "Building the hook stub generator"
cd ./cmd/query_gen go build -ldflags="-s -w" -o HookStubGen "./cmd/hook_stub_gen"
go build -ldflags="-s -w" -o QueryGen echo "Running the hook stub generator"
mv ./QueryGen ../.. ./HookStubGen
cd ../..
echo "Running the query generator" echo "Building the hook generator"
./QueryGen go build -tags hookgen -ldflags="-s -w" -o HookGen "./cmd/hook_gen"
echo "Running the hook generator"
./HookGen
echo "Generating the JSON handlers" echo "Generating the JSON handlers"
easyjson -pkg common easyjson -pkg common
echo "Building the query generator"
go build -ldflags="-s -w" -o QueryGen "./cmd/query_gen"
echo "Running the query generator"
./QueryGen
echo "Building Gosora" echo "Building Gosora"
go generate go generate
go build -ldflags="-s -w" -o Gosora -tags no_ws go build -ldflags="-s -w" -o Gosora -tags no_ws
echo "Building the installer" echo "Building the installer"
cd ./install go build -ldflags="-s -w" -o Installer "./install"
go build -ldflags="-s -w" -o Installer
mv ./Installer ..
cd ..

View File

@ -3,8 +3,9 @@ rem TODO: Make these deletes a little less noisy
del "template_*.go" del "template_*.go"
del "tmpl_*.go" del "tmpl_*.go"
del "gen_*.go" del "gen_*.go"
del "tmpl_client/template_*" del ".\tmpl_client\template_*"
del "tmpl_client/tmpl_*" del ".\tmpl_client\tmpl_*"
del ".\common\gen_extend.go"
del "gosora.exe" del "gosora.exe"
echo Generating the dynamic code echo Generating the dynamic code
@ -38,6 +39,20 @@ if %errorlevel% neq 0 (
exit /b %errorlevel% exit /b %errorlevel%
) )
echo Building the hook stub generator
go build -ldflags="-s -w" "./cmd/hook_stub_gen"
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Building the hook generator
go build -tags hookgen -ldflags="-s -w" "./cmd/hook_gen"
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Building the query generator echo Building the query generator
go build -ldflags="-s -w" "./cmd/query_gen" go build -ldflags="-s -w" "./cmd/query_gen"
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (

View File

@ -3,10 +3,9 @@ rem TODO: Make these deletes a little less noisy
del "template_*.go" del "template_*.go"
del "tmpl_*.go" del "tmpl_*.go"
del "gen_*.go" del "gen_*.go"
cd tmpl_client del ".\tmpl_client\template_*"
del "template_*" del ".\tmpl_client\tmpl_*"
del "tmpl_*" del ".\common\gen_extend.go"
cd ..
del "gosora.exe" del "gosora.exe"
echo Generating the dynamic code echo Generating the dynamic code
@ -40,6 +39,20 @@ if %errorlevel% neq 0 (
exit /b %errorlevel% exit /b %errorlevel%
) )
echo Building the hook stub generator
go build -ldflags="-s -w" "./cmd/hook_stub_gen"
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Building the hook generator
go build -tags hookgen -ldflags="-s -w" "./cmd/hook_gen"
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Building the query generator echo Building the query generator
go build -ldflags="-s -w" "./cmd/query_gen" go build -ldflags="-s -w" "./cmd/query_gen"
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (

View File

@ -151,6 +151,14 @@ go build -ldflags="-s -w" -o RouterGen "./router_gen"
./RouterGen ./RouterGen
go build -ldflags="-s -w" -o HookStubGen "./cmd/hook_stub_gen"
./HookStubGen
go build -ldflags="-s -w" -o HookGen "./cmd/hook_gen"
./HookGen
go build -ldflags="-s -w" -o QGen "./cmd/query_gen" go build -ldflags="-s -w" -o QGen "./cmd/query_gen"
./QGen ./QGen
@ -203,6 +211,14 @@ go build -ldflags="-s -w" "./router_gen"
router_gen.exe router_gen.exe
go build -ldflags="-s -w" "./cmd/hook_stub_gen"
hook_stub_gen.exe
go build -ldflags="-s -w" "./cmd/hook_gen"
hook_gen.exe
easyjson -pkg common easyjson -pkg common
go build -ldflags="-s -w" "./cmd/query_gen" go build -ldflags="-s -w" "./cmd/query_gen"
@ -224,4 +240,6 @@ I'm looking into minimising the number of go gets for the advanced build and to
If systemd gives you no permission errors, then make sure you `chown`, `chgrp` and `chmod` the files and folders appropriately. If systemd gives you no permission errors, then make sure you `chown`, `chgrp` and `chmod` the files and folders appropriately.
You don't need `-ldflags="-s -w"` in any of the commands, however it will make compilation times faster. You don't need `-ldflags="-s -w"` in any of the commands, however it will make compilation times faster.
Building and running HookGen is optional, but strips unneccesary hook indirects for plugins you don't use.

View File

@ -5,6 +5,7 @@ rm -f gen_*.go
rm -f tmpl_client/template_* rm -f tmpl_client/template_*
rm -f tmpl_client/tmpl_* rm -f tmpl_client/tmpl_*
rm -f ./Gosora rm -f ./Gosora
rm -f ./common/gen_extend.go
echo "Generating the dynamic code" echo "Generating the dynamic code"
go generate go generate
@ -17,14 +18,24 @@ go build -ldflags="-s -w" -o RouterGen "./router_gen"
echo "Running the router generator" echo "Running the router generator"
./RouterGen ./RouterGen
echo "Building the hook stub generator"
go build -ldflags="-s -w" -o HookStubGen "./cmd/hook_stub_gen"
echo "Running the hook stub generator"
./HookStubGen
echo "Building the hook generator"
go build -tags hookgen -ldflags="-s -w" -o HookGen "./cmd/hook_gen"
echo "Running the hook generator"
./HookGen
echo "Building Gosora"
go build -ldflags="-s -w" -o Gosora
echo "Building the query generator" echo "Building the query generator"
go build -ldflags="-s -w" -o QueryGen "./cmd/query_gen" go build -ldflags="-s -w" -o QueryGen "./cmd/query_gen"
echo "Running the query generator" echo "Running the query generator"
./QueryGen ./QueryGen
echo "Building Gosora"
go build -ldflags="-s -w" -o Gosora
echo "Building the templates" echo "Building the templates"
./Gosora -build-templates ./Gosora -build-templates

View File

@ -5,6 +5,7 @@ rm -f gen_*.go
rm -f tmpl_client/template_* rm -f tmpl_client/template_*
rm -f tmpl_client/tmpl_* rm -f tmpl_client/tmpl_*
rm -f ./Gosora rm -f ./Gosora
rm -f ./common/gen_extend.go
echo "Generating the dynamic code" echo "Generating the dynamic code"
go generate go generate
@ -14,14 +15,24 @@ go build -ldflags="-s -w" -o RouterGen "./router_gen"
echo "Running the router generator" echo "Running the router generator"
./RouterGen ./RouterGen
echo "Building the query generator" echo "Building the hook stub generator"
go build -ldflags="-s -w" -o QueryGen "./cmd/query_gen" go build -ldflags="-s -w" -o HookStubGen "./cmd/hook_stub_gen"
echo "Running the query generator" echo "Running the hook stub generator"
./QueryGen ./HookStubGen
echo "Building the hook generator"
go build -tags hookgen -ldflags="-s -w" -o HookGen "./cmd/hook_gen"
echo "Running the hook generator"
./HookGen
echo "Generating the JSON handlers" echo "Generating the JSON handlers"
easyjson -pkg common easyjson -pkg common
echo "Building the query generator"
go build -ldflags="-s -w" -o QGen "./cmd/query_gen"
echo "Running the query generator"
./QGen
echo "Building Gosora" echo "Building Gosora"
go build -ldflags="-s -w" -o Gosora go build -ldflags="-s -w" -o Gosora

View File

@ -5,29 +5,34 @@ rm -f gen_*.go
rm -f tmpl_client/template_* rm -f tmpl_client/template_*
rm -f tmpl_client/tmpl_* rm -f tmpl_client/tmpl_*
rm -f ./Gosora rm -f ./Gosora
rm -f ./common/gen_extend.go
echo "Generating the dynamic code" echo "Generating the dynamic code"
go generate go generate
echo "Building the router generator" echo "Building the router generator"
cd ./router_gen go build -ldflags="-s -w" -o RouterGen "./router_gen"
go build -ldflags="-s -w" -o RouterGen
mv ./RouterGen ..
cd ..
echo "Running the router generator" echo "Running the router generator"
./RouterGen ./RouterGen
echo "Building the query generator" echo "Building the hook stub generator"
cd ./cmd/query_gen go build -ldflags="-s -w" -o HookStubGen "./cmd/hook_stub_gen"
go build -ldflags="-s -w" -o QueryGen echo "Running the hook stub generator"
mv ./QueryGen ../.. ./HookStubGen
cd ../..
echo "Running the query generator" echo "Building the hook generator"
./QueryGen go build -tags hookgen -ldflags="-s -w" -o HookGen "./cmd/hook_gen"
echo "Running the hook generator"
./HookGen
echo "Generating the JSON handlers" echo "Generating the JSON handlers"
easyjson -pkg common easyjson -pkg common
echo "Building the query generator"
go build -ldflags="-s -w" -o QueryGen "./cmd/query_gen"
echo "Running the query generator"
./QueryGen
echo "Building Gosora" echo "Building Gosora"
go build -ldflags="-s -w" -o Gosora -tags no_ws go build -ldflags="-s -w" -o Gosora -tags no_ws

View File

@ -3,10 +3,9 @@ rem TODO: Make these deletes a little less noisy
del "template_*.go" del "template_*.go"
del "tmpl_*.go" del "tmpl_*.go"
del "gen_*.go" del "gen_*.go"
cd tmpl_client del ".\tmpl_client\template_*"
del "template_*" del ".\tmpl_client\tmpl_*"
del "tmpl_*" del ".\common\gen_extend.go"
cd ..
del "gosora.exe" del "gosora.exe"
echo Generating the dynamic code echo Generating the dynamic code
@ -29,6 +28,35 @@ if %errorlevel% neq 0 (
exit /b %errorlevel% exit /b %errorlevel%
) )
echo Building the hook stub generator
go build -ldflags="-s -w" "./cmd/hook_stub_gen"
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Running the hook stub generator
hook_stub_gen.exe
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Building the hook generator
go build -tags hookgen -ldflags="-s -w" "./cmd/hook_gen"
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Running the hook generator
hook_gen.exe
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Generating the JSON handlers
easyjson -pkg common
echo Building the query generator echo Building the query generator
go build -ldflags="-s -w" "./cmd/query_gen" go build -ldflags="-s -w" "./cmd/query_gen"
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (
@ -42,9 +70,6 @@ if %errorlevel% neq 0 (
exit /b %errorlevel% exit /b %errorlevel%
) )
echo Generating the JSON handlers
easyjson -pkg common
echo Building the executable echo Building the executable
go build -ldflags="-s -w" -o gosora.exe -tags no_ws go build -ldflags="-s -w" -o gosora.exe -tags no_ws
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (

39
run.bat
View File

@ -3,10 +3,9 @@ rem TODO: Make these deletes a little less noisy
del "template_*.go" del "template_*.go"
del "tmpl_*.go" del "tmpl_*.go"
del "gen_*.go" del "gen_*.go"
cd tmpl_client del ".\tmpl_client\template_*"
del "template_*" del ".\tmpl_client\tmpl_*"
del "tmpl_*" del ".\common\gen_extend.go"
cd ..
del "gosora.exe" del "gosora.exe"
echo Generating the dynamic code echo Generating the dynamic code
@ -29,6 +28,35 @@ if %errorlevel% neq 0 (
exit /b %errorlevel% exit /b %errorlevel%
) )
echo Building the hook stub generator
go build -ldflags="-s -w" "./cmd/hook_stub_gen"
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Running the hook stub generator
hook_stub_gen.exe
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Building the hook generator
go build -tags hookgen -ldflags="-s -w" "./cmd/hook_gen"
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Running the hook generator
hook_gen.exe
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Generating the JSON handlers
easyjson -pkg common
echo Building the query generator echo Building the query generator
go build -ldflags="-s -w" "./cmd/query_gen" go build -ldflags="-s -w" "./cmd/query_gen"
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (
@ -42,9 +70,6 @@ if %errorlevel% neq 0 (
exit /b %errorlevel% exit /b %errorlevel%
) )
echo Generating the JSON handlers
easyjson -pkg common
echo Building the executable echo Building the executable
go build -ldflags="-s -w" -o gosora.exe go build -ldflags="-s -w" -o gosora.exe
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (

View File

@ -3,10 +3,9 @@ rem TODO: Make these deletes a little less noisy
del "template_*.go" del "template_*.go"
del "tmpl_*.go" del "tmpl_*.go"
del "gen_*.go" del "gen_*.go"
cd tmpl_client del ".\tmpl_client\template_*"
del "template_*" del ".\tmpl_client\tmpl_*"
del "tmpl_*" del ".\common\gen_extend.go"
cd ..
del "gosora.exe" del "gosora.exe"
echo Generating the dynamic code echo Generating the dynamic code
@ -29,6 +28,35 @@ if %errorlevel% neq 0 (
exit /b %errorlevel% exit /b %errorlevel%
) )
echo Building the hook stub generator
go build -ldflags="-s -w" "./cmd/hook_stub_gen"
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Running the hook stub generator
hook_stub_gen.exe
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Building the hook generator
go build -tags hookgen -ldflags="-s -w" "./cmd/hook_gen"
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Running the hook generator
hook_gen.exe
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Generating the JSON handlers
easyjson -pkg common
echo Building the query generator echo Building the query generator
go build -ldflags="-s -w" "./cmd/query_gen" go build -ldflags="-s -w" "./cmd/query_gen"
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (
@ -42,9 +70,6 @@ if %errorlevel% neq 0 (
exit /b %errorlevel% exit /b %errorlevel%
) )
echo Generating the JSON handlers
easyjson -pkg common
echo Building the executable echo Building the executable
go build -ldflags="-s -w" -o gosora.exe -tags mssql go build -ldflags="-s -w" -o gosora.exe -tags mssql
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (

View File

@ -3,10 +3,9 @@ rem TODO: Make these deletes a little less noisy
del "template_*.go" del "template_*.go"
del "tmpl_*.go" del "tmpl_*.go"
del "gen_*.go" del "gen_*.go"
cd tmpl_client del ".\tmpl_client\template_*"
del "template_*" del ".\tmpl_client\tmpl_*"
del "tmpl_*" del ".\common\gen_extend.go"
cd ..
del "gosora.exe" del "gosora.exe"
echo Generating the dynamic code echo Generating the dynamic code
@ -29,6 +28,35 @@ if %errorlevel% neq 0 (
exit /b %errorlevel% exit /b %errorlevel%
) )
echo Building the hook stub generator
go build -ldflags="-s -w" "./cmd/hook_stub_gen"
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Running the hook stub generator
hook_stub_gen.exe
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Building the hook generator
go build -tags hookgen -ldflags="-s -w" "./cmd/hook_gen"
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Running the hook generator
hook_gen.exe
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Generating the JSON handlers
easyjson -pkg common
echo Building the query generator echo Building the query generator
go build -ldflags="-s -w" "./cmd/query_gen" go build -ldflags="-s -w" "./cmd/query_gen"
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (
@ -42,9 +70,6 @@ if %errorlevel% neq 0 (
exit /b %errorlevel% exit /b %errorlevel%
) )
echo Generating the JSON handlers
easyjson -pkg common
echo Building the executable echo Building the executable
go test go test
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (

View File

@ -3,10 +3,9 @@ rem TODO: Make these deletes a little less noisy
del "template_*.go" del "template_*.go"
del "tmpl_*.go" del "tmpl_*.go"
del "gen_*.go" del "gen_*.go"
cd tmpl_client del ".\tmpl_client\template_*"
del "template_*" del ".\tmpl_client\tmpl_*"
del "tmpl_*" del ".\common\gen_extend.go"
cd ..
del "gosora.exe" del "gosora.exe"
echo Generating the dynamic code echo Generating the dynamic code
@ -29,6 +28,35 @@ if %errorlevel% neq 0 (
exit /b %errorlevel% exit /b %errorlevel%
) )
echo Building the hook stub generator
go build -ldflags="-s -w" "./cmd/hook_stub_gen"
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Running the hook stub generator
hook_stub_gen.exe
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Building the hook generator
go build -tags hookgen -ldflags="-s -w" "./cmd/hook_gen"
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Running the hook generator
hook_gen.exe
if %errorlevel% neq 0 (
pause
exit /b %errorlevel%
)
echo Generating the JSON handlers
easyjson -pkg common
echo Building the query generator echo Building the query generator
go build -ldflags="-s -w" "./cmd/query_gen" go build -ldflags="-s -w" "./cmd/query_gen"
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (
@ -42,9 +70,6 @@ if %errorlevel% neq 0 (
exit /b %errorlevel% exit /b %errorlevel%
) )
echo Generating the JSON handlers
easyjson -pkg common
echo Building the executable echo Building the executable
go test -tags mssql go test -tags mssql
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (