-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (52 loc) · 1.93 KB
/
Copy pathMakefile
File metadata and controls
70 lines (52 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
SHELL=bash
# See https://tech.davis-hansson.com/p/make/
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
PHPUNIT_BIN = vendor/bin/phpunit
PHPUNIT = $(PHPUNIT_BIN)
RECTOR_BIN = vendor/bin/rector
RECTOR = $(RECTOR_BIN)
CODE_GENERATOR_BIN = code-generator/bin/console
CODE_GENERATOR = $(CODE_GENERATOR_BIN)
COVERAGE_DIR = dist/coverage
.DEFAULT_GOAL := generate_coverage
.PHONY: help
help:
@printf "\033[33mUsage:\033[0m\n make TARGET\n\n\033[32m#\n# Commands\n#---------------------------------------------------------------------------\033[0m\n"
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' | awk 'BEGIN {FS = ":"}; {printf "\033[33m%s:\033[0m%s\n", $$1, $$2}'
.PHONY: generate_code
generate_code: ## Generates the auto-generated source and test code
generate_code: $(CODE_GENERATOR_BIN) code-generator/vendor
@rm -rf src/AutoGenerated || true
@rm -rf tests/AutoGenerated || true
$(CODE_GENERATOR) generate 50
.PHONY: generate_coverage
generate_coverage: ## Executes the tests to generate the coverage reports
generate_coverage: $(PHPUNIT_BIN)
@rm -rf $(COVERAGE_DIR)
XDEBUG_MODE=coverage $(PHPUNIT) \
--coverage-xml=$(COVERAGE_DIR)/xml \
--log-junit=$(COVERAGE_DIR)/junit.xml
@# Correct the absolute paths found
PROJECT_ROOT=$$(pwd) && find $(COVERAGE_DIR) -type f -exec sed -i.bak "s|$${PROJECT_ROOT}|/path/to/project|g" {} \; && find $(COVERAGE_DIR) -name "*.bak" -type f -delete
.PHONY: phpunit
phpunit: ## Executes the PHPUnit tests
phpunit: $(PHPUNIT_BIN)
XDEBUG_MODE=off $(PHPUNIT)
.PHONY: rector
rector: ## Executes the tests to generate the coverage reports
rector: $(RECTOR_BIN)
$(RECTOR)
vendor: composer.lock
composer install
touch -c $@
composer.lock: composer.json
composer update --lock
touch -c $@
touch -c vendor
$(PHPUNIT_BIN): vendor
touch -c $@
$(RECTOR_BIN): vendor
touch -c $@
code-generator/vendor:
cd code-generator; make --file Makefile vendor