Skip to content

Commit e1535c7

Browse files
Add 'make watch' (#12636)
* Add 'make watch' This combines frontend and backend watch into a single command that runs them in parallel on on SIGINT terminates both. Termination is not super-clean but I guess it does not have to. * move to tools/, trap more signals, remove gnu-specific flag * simplify Co-authored-by: techknowlogick <[email protected]>
1 parent 9837b59 commit e1535c7

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ help:
155155
@echo " - build build everything"
156156
@echo " - frontend build frontend files"
157157
@echo " - backend build backend files"
158+
@echo " - watch watch everything and continuously rebuild"
158159
@echo " - watch-frontend watch frontend files and continuously rebuild"
159160
@echo " - watch-backend watch backend files and continuously rebuild"
160161
@echo " - clean delete backend and integration files"
@@ -316,6 +317,10 @@ lint-frontend: node_modules
316317
.PHONY: lint-backend
317318
lint-backend: golangci-lint revive vet
318319

320+
.PHONY: watch
321+
watch:
322+
bash tools/watch.sh
323+
319324
.PHONY: watch-frontend
320325
watch-frontend: node-check $(FOMANTIC_DEST) node_modules
321326
rm -rf $(WEBPACK_DEST_ENTRIES)

docs/content/doc/advanced/hacking-on-gitea.en-us.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,10 @@ See `make help` for all available `make` targets. Also see [`.drone.yml`](https:
9494

9595
## Building continuously
9696

97-
Both the `frontend` and `backend` targets can be ran continuously when source files change:
97+
To run and continously rebuild when source files change:
9898

9999
````bash
100-
# in your first terminal
101-
make watch-backend
102-
103-
# in your second terminal
104-
make watch-frontend
100+
make watch
105101
````
106102

107103
On macOS, watching all backend source files may hit the default open files limit which can be increased via `ulimit -n 12288` for the current shell or in your shell startup file for all future shells.

tools/watch.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
make watch-frontend &
5+
make watch-backend &
6+
7+
trap 'kill $(jobs -p)' EXIT
8+
wait

0 commit comments

Comments
 (0)