generated from jwson-automation/blueberry_template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
80 lines (76 loc) · 1.88 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
74
75
76
77
78
79
80
ROOT := $(shell git rev-parse --show-toplevel)
# Detect operating system
ifeq ($(OS), Windows_NT)
DETECTED_OS := Windows
FLUTTER := $(shell where flutter 2>nul)
else
DETECTED_OS := $(shell uname -s)
ifeq ($(DETECTED_OS), Linux)
FLUTTER := $(shell which flutter)
else ifeq ($(DETECTED_OS), Darwin)
FLUTTER := $(shell which flutter)
endif
endif
# Define the default target to call all necessary targets
all: init analyze apply format buildRunner
# Define the init target to initialize the project
first : create init analyze buildRunner env
setting : init buildRunner
lint : analyze apply format
# Define the init target
create:
@echo "Create ios and android floder..."
ifeq ($(DETECTED_OS), Windows)
@flutter create .
else
@$(FLUTTER) create .
endif
# Define the init target
init:
@echo "Initializing Flutter project..."
ifeq ($(DETECTED_OS), Windows)
@flutter pub get
else
@$(FLUTTER) pub get
endif
# Define the analyze target
analyze:
@echo "Analyzing Flutter project..."
ifeq ($(DETECTED_OS), Windows)
-@flutter analyze
else
-@$(FLUTTER) analyze
endif
# Define the apply target
apply:
@echo "Applying dart fixes..."
ifeq ($(DETECTED_OS), Windows)
@dart fix --apply
else
@dart fix --apply
endif
# Define the apply target
format:
@echo "format dart fixes..."
ifeq ($(DETECTED_OS), Windows)
@dart format .
else
@dart format .
endif
# Define the buildRunner target
buildRunner:
@echo "Freezed Running build runner..."
ifeq ($(DETECTED_OS), Windows)
@flutter pub run build_runner build --delete-conflicting-outputs
else
@$(FLUTTER) pub run build_runner build --delete-conflicting-outputs
endif
# Define the env target for Unix-like systems
env:
ifeq ($(DETECTED_OS), Windows)
@echo "Using PowerShell script to create .env file."
@powershell -ExecutionPolicy Bypass -File generate_env.ps1
else
@echo "Using bash script to create .env file."
@bash generate_env.sh
endif