Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'make watch' #12636

Merged
merged 4 commits into from
Sep 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ help:
@echo " - build build everything"
@echo " - frontend build frontend files"
@echo " - backend build backend files"
@echo " - watch watch everything and continuously rebuild"
@echo " - watch-frontend watch frontend files and continuously rebuild"
@echo " - watch-backend watch backend files and continuously rebuild"
@echo " - clean delete backend and integration files"
Expand Down Expand Up @@ -316,6 +317,10 @@ lint-frontend: node_modules
.PHONY: lint-backend
lint-backend: golangci-lint revive vet

.PHONY: watch
watch:
bash tools/watch.sh

.PHONY: watch-frontend
watch-frontend: node-check $(FOMANTIC_DEST) node_modules
rm -rf $(WEBPACK_DEST_ENTRIES)
Expand Down
8 changes: 2 additions & 6 deletions docs/content/doc/advanced/hacking-on-gitea.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,10 @@ See `make help` for all available `make` targets. Also see [`.drone.yml`](https:

## Building continuously

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

````bash
# in your first terminal
make watch-backend

# in your second terminal
make watch-frontend
make watch
````

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.
Expand Down
8 changes: 8 additions & 0 deletions tools/watch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -euo pipefail

make watch-frontend &
make watch-backend &

trap 'kill $(jobs -p)' EXIT
wait