Skip to content

Commit aa7e2ef

Browse files
author
Ivan Dlugos
committed
makefile simplification, test verbosity and a new help target
1 parent c2264f4 commit aa7e2ef

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ platform) which actually implements the database functionality. The library shou
3030
If you're just getting started, run the following simple steps to set up the repository on your machine
3131
* clone this repository
3232
* `pip install virtualenv` install [virtualenv](https://pypi.org/project/virtualenv/) if you don't have it yet
33-
* `make init` initialize the virtualenv
34-
* `make get-lib` get the objectbox-c shared library for your platform; also run this to update to a newer version
33+
* `make depend` to initialize `virtualenv` and get dependencies (objectbox-c shared library)
34+
* `make` to build and test
35+
36+
You can also run `make help` to see all available options.
3537

3638
#### Regular development workflow
3739
You'll probably use the following commands regularly when implementing a new feature in the library:

Makefile

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
VENV = .venv
2-
export VIRTUAL_ENV := $(abspath ${VENV})
3-
export PATH := ${VIRTUAL_ENV}/bin:${PATH}
2+
export PATH := $(abspath ${VENV})/bin:${PATH}
3+
4+
.PHONY: init test build benchmark
5+
6+
# Default target executed when no arguments are given to make.
7+
default_target: all
8+
9+
help: ## Show this help
10+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
411

512
################################
613

7-
build: ${VENV} clean
14+
all: depend build test ## Prepare, build and test
15+
16+
build: ${VENV} clean ## Build and clean
817
python3 setup.py bdist_wheel
918
ls -lh dist
1019

@@ -19,20 +28,16 @@ ${VENV}/bin/activate: requirements.txt
1928
# let make know this is the last time requirements changed
2029
touch ${VENV}/bin/activate
2130

22-
init: ${VENV}
31+
depend: ${VENV} ## Prepare dependencies
32+
python3 download-c-lib.py
2333

24-
test: ${VENV}
25-
python3 -m pytest -s
34+
test: ${VENV} ## Test all targets
35+
python3 -m pytest --capture=no --verbose
2636

27-
benchmark: ${VENV}
37+
benchmark: ${VENV} ## Run CRUD benchmarks
2838
python3 -m benchmark
2939

30-
clean:
40+
clean: ## Clean build artifacts
3141
rm -rf build/
3242
rm -rf dist/
3343
rm -rf *.egg-info
34-
35-
get-lib:
36-
python3 download-c-lib.py
37-
38-
.PHONY: init test build benchmark

0 commit comments

Comments
 (0)