Skip to content

Commit 480ff79

Browse files
committed
update startup scripts to call hookgen
reduce boilerplate in some older startup scripts update advance install docs
1 parent 13552ee commit 480ff79

13 files changed

+289
-78
lines changed

build-linux

+14-3
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,31 @@ rm -f gen_*.go
55
rm -f tmpl_client/template_*
66
rm -f tmpl_client/tmpl_*
77
rm -f ./Gosora
8+
rm -f ./common/gen_extend.go
89

910
echo "Building the router generator"
1011
go build -ldflags="-s -w" -o RouterGen "./router_gen"
1112
echo "Running the router generator"
1213
./RouterGen
1314

15+
echo "Building the hook stub generator"
16+
go build -ldflags="-s -w" -o HookStubGen "./cmd/hook_stub_gen"
17+
echo "Running the hook stub generator"
18+
./HookStubGen
19+
20+
echo "Building the hook generator"
21+
go build -tags hookgen -ldflags="-s -w" -o HookGen "./cmd/hook_gen"
22+
echo "Running the hook generator"
23+
./HookGen
24+
25+
echo "Generating the JSON handlers"
26+
easyjson -pkg common
27+
1428
echo "Building the query generator"
1529
go build -ldflags="-s -w" -o QueryGen "./cmd/query_gen"
1630
echo "Running the query generator"
1731
./QueryGen
1832

19-
echo "Generating the JSON handlers"
20-
easyjson -pkg common
21-
2233
echo "Building Gosora"
2334
go generate
2435
go build -ldflags="-s -w" -o Gosora

build-linux-nowebsockets

+17-15
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,34 @@ rm -f gen_*.go
55
rm -f tmpl_client/template_*
66
rm -f tmpl_client/tmpl_*
77
rm -f ./Gosora
8+
rm -f ./common/gen_extend.go
89

910
echo "Building the router generator"
10-
cd ./router_gen
11-
go build -ldflags="-s -w" -o RouterGen
12-
mv ./RouterGen ..
13-
cd ..
11+
go build -ldflags="-s -w" -o RouterGen "./router_gen"
1412
echo "Running the router generator"
1513
./RouterGen
1614

17-
echo "Building the query generator"
18-
cd ./cmd/query_gen
19-
go build -ldflags="-s -w" -o QueryGen
20-
mv ./QueryGen ../..
21-
cd ../..
22-
echo "Running the query generator"
23-
./QueryGen
15+
echo "Building the hook stub generator"
16+
go build -ldflags="-s -w" -o HookStubGen "./cmd/hook_stub_gen"
17+
echo "Running the hook stub generator"
18+
./HookStubGen
19+
20+
echo "Building the hook generator"
21+
go build -tags hookgen -ldflags="-s -w" -o HookGen "./cmd/hook_gen"
22+
echo "Running the hook generator"
23+
./HookGen
2424

2525
echo "Generating the JSON handlers"
2626
easyjson -pkg common
2727

28+
echo "Building the query generator"
29+
go build -ldflags="-s -w" -o QueryGen "./cmd/query_gen"
30+
echo "Running the query generator"
31+
./QueryGen
32+
2833
echo "Building Gosora"
2934
go generate
3035
go build -ldflags="-s -w" -o Gosora -tags no_ws
3136

3237
echo "Building the installer"
33-
cd ./install
34-
go build -ldflags="-s -w" -o Installer
35-
mv ./Installer ..
36-
cd ..
38+
go build -ldflags="-s -w" -o Installer "./install"

build-nowebsockets.bat

+17-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ rem TODO: Make these deletes a little less noisy
33
del "template_*.go"
44
del "tmpl_*.go"
55
del "gen_*.go"
6-
del "tmpl_client/template_*"
7-
del "tmpl_client/tmpl_*"
6+
del ".\tmpl_client\template_*"
7+
del ".\tmpl_client\tmpl_*"
8+
del ".\common\gen_extend.go"
89
del "gosora.exe"
910

1011
echo Generating the dynamic code
@@ -38,6 +39,20 @@ if %errorlevel% neq 0 (
3839
exit /b %errorlevel%
3940
)
4041

42+
echo Building the hook stub generator
43+
go build -ldflags="-s -w" "./cmd/hook_stub_gen"
44+
if %errorlevel% neq 0 (
45+
pause
46+
exit /b %errorlevel%
47+
)
48+
49+
echo Building the hook generator
50+
go build -tags hookgen -ldflags="-s -w" "./cmd/hook_gen"
51+
if %errorlevel% neq 0 (
52+
pause
53+
exit /b %errorlevel%
54+
)
55+
4156
echo Building the query generator
4257
go build -ldflags="-s -w" "./cmd/query_gen"
4358
if %errorlevel% neq 0 (

build.bat

+17-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ rem TODO: Make these deletes a little less noisy
33
del "template_*.go"
44
del "tmpl_*.go"
55
del "gen_*.go"
6-
cd tmpl_client
7-
del "template_*"
8-
del "tmpl_*"
9-
cd ..
6+
del ".\tmpl_client\template_*"
7+
del ".\tmpl_client\tmpl_*"
8+
del ".\common\gen_extend.go"
109
del "gosora.exe"
1110

1211
echo Generating the dynamic code
@@ -40,6 +39,20 @@ if %errorlevel% neq 0 (
4039
exit /b %errorlevel%
4140
)
4241

42+
echo Building the hook stub generator
43+
go build -ldflags="-s -w" "./cmd/hook_stub_gen"
44+
if %errorlevel% neq 0 (
45+
pause
46+
exit /b %errorlevel%
47+
)
48+
49+
echo Building the hook generator
50+
go build -tags hookgen -ldflags="-s -w" "./cmd/hook_gen"
51+
if %errorlevel% neq 0 (
52+
pause
53+
exit /b %errorlevel%
54+
)
55+
4356
echo Building the query generator
4457
go build -ldflags="-s -w" "./cmd/query_gen"
4558
if %errorlevel% neq 0 (

docs/installation.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,14 @@ go build -ldflags="-s -w" -o RouterGen "./router_gen"
151151

152152
./RouterGen
153153

154+
go build -ldflags="-s -w" -o HookStubGen "./cmd/hook_stub_gen"
155+
156+
./HookStubGen
157+
158+
go build -ldflags="-s -w" -o HookGen "./cmd/hook_gen"
159+
160+
./HookGen
161+
154162
go build -ldflags="-s -w" -o QGen "./cmd/query_gen"
155163

156164
./QGen
@@ -203,6 +211,14 @@ go build -ldflags="-s -w" "./router_gen"
203211
204212
router_gen.exe
205213
214+
go build -ldflags="-s -w" "./cmd/hook_stub_gen"
215+
216+
hook_stub_gen.exe
217+
218+
go build -ldflags="-s -w" "./cmd/hook_gen"
219+
220+
hook_gen.exe
221+
206222
easyjson -pkg common
207223
208224
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
224240

225241
If systemd gives you no permission errors, then make sure you `chown`, `chgrp` and `chmod` the files and folders appropriately.
226242

227-
You don't need `-ldflags="-s -w"` in any of the commands, however it will make compilation times faster.
243+
You don't need `-ldflags="-s -w"` in any of the commands, however it will make compilation times faster.
244+
245+
Building and running HookGen is optional, but strips unneccesary hook indirects for plugins you don't use.

pre-run-linux

+14-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ rm -f gen_*.go
55
rm -f tmpl_client/template_*
66
rm -f tmpl_client/tmpl_*
77
rm -f ./Gosora
8+
rm -f ./common/gen_extend.go
89

910
echo "Generating the dynamic code"
1011
go generate
@@ -17,14 +18,24 @@ go build -ldflags="-s -w" -o RouterGen "./router_gen"
1718
echo "Running the router generator"
1819
./RouterGen
1920

21+
echo "Building the hook stub generator"
22+
go build -ldflags="-s -w" -o HookStubGen "./cmd/hook_stub_gen"
23+
echo "Running the hook stub generator"
24+
./HookStubGen
25+
26+
echo "Building the hook generator"
27+
go build -tags hookgen -ldflags="-s -w" -o HookGen "./cmd/hook_gen"
28+
echo "Running the hook generator"
29+
./HookGen
30+
31+
echo "Building Gosora"
32+
go build -ldflags="-s -w" -o Gosora
33+
2034
echo "Building the query generator"
2135
go build -ldflags="-s -w" -o QueryGen "./cmd/query_gen"
2236
echo "Running the query generator"
2337
./QueryGen
2438

25-
echo "Building Gosora"
26-
go build -ldflags="-s -w" -o Gosora
27-
2839
echo "Building the templates"
2940
./Gosora -build-templates
3041

run-linux

+15-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ rm -f gen_*.go
55
rm -f tmpl_client/template_*
66
rm -f tmpl_client/tmpl_*
77
rm -f ./Gosora
8+
rm -f ./common/gen_extend.go
89

910
echo "Generating the dynamic code"
1011
go generate
@@ -14,14 +15,24 @@ go build -ldflags="-s -w" -o RouterGen "./router_gen"
1415
echo "Running the router generator"
1516
./RouterGen
1617

17-
echo "Building the query generator"
18-
go build -ldflags="-s -w" -o QueryGen "./cmd/query_gen"
19-
echo "Running the query generator"
20-
./QueryGen
18+
echo "Building the hook stub generator"
19+
go build -ldflags="-s -w" -o HookStubGen "./cmd/hook_stub_gen"
20+
echo "Running the hook stub generator"
21+
./HookStubGen
22+
23+
echo "Building the hook generator"
24+
go build -tags hookgen -ldflags="-s -w" -o HookGen "./cmd/hook_gen"
25+
echo "Running the hook generator"
26+
./HookGen
2127

2228
echo "Generating the JSON handlers"
2329
easyjson -pkg common
2430

31+
echo "Building the query generator"
32+
go build -ldflags="-s -w" -o QGen "./cmd/query_gen"
33+
echo "Running the query generator"
34+
./QGen
35+
2536
echo "Building Gosora"
2637
go build -ldflags="-s -w" -o Gosora
2738

run-linux-nowebsockets

+16-11
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,34 @@ rm -f gen_*.go
55
rm -f tmpl_client/template_*
66
rm -f tmpl_client/tmpl_*
77
rm -f ./Gosora
8+
rm -f ./common/gen_extend.go
89

910
echo "Generating the dynamic code"
1011
go generate
1112

1213
echo "Building the router generator"
13-
cd ./router_gen
14-
go build -ldflags="-s -w" -o RouterGen
15-
mv ./RouterGen ..
16-
cd ..
14+
go build -ldflags="-s -w" -o RouterGen "./router_gen"
1715
echo "Running the router generator"
1816
./RouterGen
1917

20-
echo "Building the query generator"
21-
cd ./cmd/query_gen
22-
go build -ldflags="-s -w" -o QueryGen
23-
mv ./QueryGen ../..
24-
cd ../..
25-
echo "Running the query generator"
26-
./QueryGen
18+
echo "Building the hook stub generator"
19+
go build -ldflags="-s -w" -o HookStubGen "./cmd/hook_stub_gen"
20+
echo "Running the hook stub generator"
21+
./HookStubGen
22+
23+
echo "Building the hook generator"
24+
go build -tags hookgen -ldflags="-s -w" -o HookGen "./cmd/hook_gen"
25+
echo "Running the hook generator"
26+
./HookGen
2727

2828
echo "Generating the JSON handlers"
2929
easyjson -pkg common
3030

31+
echo "Building the query generator"
32+
go build -ldflags="-s -w" -o QueryGen "./cmd/query_gen"
33+
echo "Running the query generator"
34+
./QueryGen
35+
3136
echo "Building Gosora"
3237
go build -ldflags="-s -w" -o Gosora -tags no_ws
3338

run-nowebsockets.bat

+32-7
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ rem TODO: Make these deletes a little less noisy
33
del "template_*.go"
44
del "tmpl_*.go"
55
del "gen_*.go"
6-
cd tmpl_client
7-
del "template_*"
8-
del "tmpl_*"
9-
cd ..
6+
del ".\tmpl_client\template_*"
7+
del ".\tmpl_client\tmpl_*"
8+
del ".\common\gen_extend.go"
109
del "gosora.exe"
1110

1211
echo Generating the dynamic code
@@ -29,6 +28,35 @@ if %errorlevel% neq 0 (
2928
exit /b %errorlevel%
3029
)
3130

31+
echo Building the hook stub generator
32+
go build -ldflags="-s -w" "./cmd/hook_stub_gen"
33+
if %errorlevel% neq 0 (
34+
pause
35+
exit /b %errorlevel%
36+
)
37+
echo Running the hook stub generator
38+
hook_stub_gen.exe
39+
if %errorlevel% neq 0 (
40+
pause
41+
exit /b %errorlevel%
42+
)
43+
44+
echo Building the hook generator
45+
go build -tags hookgen -ldflags="-s -w" "./cmd/hook_gen"
46+
if %errorlevel% neq 0 (
47+
pause
48+
exit /b %errorlevel%
49+
)
50+
echo Running the hook generator
51+
hook_gen.exe
52+
if %errorlevel% neq 0 (
53+
pause
54+
exit /b %errorlevel%
55+
)
56+
57+
echo Generating the JSON handlers
58+
easyjson -pkg common
59+
3260
echo Building the query generator
3361
go build -ldflags="-s -w" "./cmd/query_gen"
3462
if %errorlevel% neq 0 (
@@ -42,9 +70,6 @@ if %errorlevel% neq 0 (
4270
exit /b %errorlevel%
4371
)
4472

45-
echo Generating the JSON handlers
46-
easyjson -pkg common
47-
4873
echo Building the executable
4974
go build -ldflags="-s -w" -o gosora.exe -tags no_ws
5075
if %errorlevel% neq 0 (

0 commit comments

Comments
 (0)