-
Notifications
You must be signed in to change notification settings - Fork 60
/
Makefile
74 lines (55 loc) · 1.78 KB
/
Makefile
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
71
72
73
.PHONY: get build watch clean test analyze test-unit test-widget test-all all fvm_check
# Check if FVM is installed
FVM_PRESENT := $(shell command -v fvm 2> /dev/null)
# Use fvm if installed; otherwise use flutter directly
FLUTTER_CMD := $(if $(FVM_PRESENT),fvm flutter,flutter)
DART_CMD := $(if $(FVM_PRESENT),fvm dart,dart)
PACKAGES_DIR := packages
INTEGRATION_TEST_DIR=test/integration
DRIVER_FILE=$(INTEGRATION_TEST_DIR)/driver/driver.dart
DART_DEFINE_ARGS=
ifdef id
DART_DEFINE_ARGS += --dart-define=id=$(id)
endif
clean:
$(FLUTTER_CMD) clean
get:
$(FLUTTER_CMD) pub get
@for dir in $(shell find $(PACKAGES_DIR) -maxdepth 1 -type d); do \
if [ "$$dir" != "$(PACKAGES_DIR)" ]; then \
echo "Running $(FLUTTER_CMD) pub get in $$dir"; \
(cd $$dir && $(FLUTTER_CMD) pub get); \
fi \
done
run:
$(FLUTTER_CMD) run
all: clean get build run
watch:
$(DART_CMD) run build_runner watch --delete-conflicting-outputs
lint:
$(FLUTTER_CMD) analyze
build:
$(DART_CMD) run build_runner build --delete-conflicting-outputs
analyze:
$(FLUTTER_CMD) analyze
unit:
$(FLUTTER_CMD) test test/unit
widget:
$(FLUTTER_CMD) test test/widget
integration:
ifeq ($(strip $(target)),)
$(FLUTTER_CMD) test $(INTEGRATION_TEST_DIR)
else
$(FLUTTER_CMD) test $(INTEGRATION_TEST_DIR)/$(target)_test.dart $(DART_DEFINE_ARGS)
endif
integration-drive:
ifeq ($(strip $(target)),)
find $(INTEGRATION_TEST_DIR) -name '*_test.dart' | while read test_file; do \
flutter drive --driver=$(DRIVER_FILE) --target=$$test_file $(DART_DEFINE_ARGS); \
done
else
flutter drive --driver=$(DRIVER_FILE) --target=$(INTEGRATION_TEST_DIR)/$(target)_test.dart $(DART_DEFINE_ARGS)
endif
test: $(FLUTTER_CMD) test
fvm_check:
@echo Using $(FLUTTER_CMD) and $(DART_CMD) based on availability of FVM