Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
141 lines (102 loc) · 3.32 KB
/
Copy pathMakefile
File metadata and controls
141 lines (102 loc) · 3.32 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
.PHONY: help get clean icons regen run run-ios run-macos \
apk apk-all appbundle ios ipa macos windows linux \
build-all package
PROJECT := .
DIST := dist
APK_UNIVERSAL_NAME := app-release.apk
AAB_NAME := app.aab
IPA_NAME := ios.ipa
IOS_APP_NAME := ios.app
MACOS_APP_NAME := mac.app
WINDOWS_DIR_NAME := windows
LINUX_DIR_NAME := linix
help:
@echo " get — install dependencies"
@echo " clean — clean and reinstall"
@echo " icons — generate app icons"
@echo " regen — run build_runner"
@echo " run — run debug"
@echo " apk — build APK"
@echo " appbundle — build AAB"
@echo " ios — build iOS"
@echo " ipa — build IPA"
@echo " macos — build macOS"
@echo " windows — build Windows"
@echo " linux — build Linux"
@echo " build-all — build everything"
@echo " package — pack artifacts"
get:
cd $(PROJECT) && flutter pub get
clean:
cd $(PROJECT) && flutter clean && flutter pub get
icons:
cd $(PROJECT) && dart run flutter_launcher_icons
regen:
cd $(PROJECT) && dart run build_runner build --delete-conflicting-outputs
run:
cd $(PROJECT) && flutter run
run-ios:
cd $(PROJECT) && flutter run -d iphone
run-macos:
cd $(PROJECT) && flutter run -d macos
apk:
@mkdir -p $(DIST)
cd $(PROJECT) && flutter build apk --release
@cp -f $(PROJECT)/build/app/outputs/flutter-apk/app-release.apk \
$(DIST)/$(APK_UNIVERSAL_NAME)
apk-all:
@mkdir -p $(DIST)
cd $(PROJECT) && flutter build apk --release --split-per-abi
@for file in $(PROJECT)/build/app/outputs/flutter-apk/*-release.apk; do \
[ -f "$$file" ] || continue; \
name=$$(basename "$$file"); \
cp -f "$$file" "$(DIST)/$$name"; \
done
appbundle:
@mkdir -p $(DIST)
cd $(PROJECT) && flutter build appbundle --release
@cp -f $(PROJECT)/build/app/outputs/bundle/release/app-release.aab \
$(DIST)/$(AAB_NAME)
ios:
@mkdir -p $(DIST)
cd $(PROJECT) && flutter build ios --release --no-codesign
@rm -rf "$(DIST)/$(IOS_APP_NAME)"
@cp -r "$(PROJECT)/build/ios/iphoneos/Runner.app" \
"$(DIST)/$(IOS_APP_NAME)"
ipa:
@mkdir -p $(DIST)
cd $(PROJECT) && flutter build ios --release --no-codesign
@rm -rf $(PROJECT)/build/ios/ipa_tmp
@mkdir -p $(PROJECT)/build/ios/ipa_tmp/Payload
@cp -r $(PROJECT)/build/ios/iphoneos/Runner.app \
$(PROJECT)/build/ios/ipa_tmp/Payload/
@cd $(PROJECT)/build/ios/ipa_tmp && \
zip -r -q $(IPA_NAME) Payload
@cp -f $(PROJECT)/build/ios/ipa_tmp/$(IPA_NAME) \
$(DIST)/$(IPA_NAME)
@rm -rf $(PROJECT)/build/ios/ipa_tmp
macos:
@mkdir -p $(DIST)
cd $(PROJECT) && flutter build macos --release
@rm -rf "$(DIST)/$(MACOS_APP_NAME)"
@cp -r "$(PROJECT)/build/macos/Build/Products/Release/"*.app \
"$(DIST)/$(MACOS_APP_NAME)"
windows:
@mkdir -p $(DIST)
cd $(PROJECT) && flutter build windows --release
@rm -rf "$(DIST)/$(WINDOWS_DIR_NAME)"
@cp -r "$(PROJECT)/build/windows/x64/runner/Release" \
"$(DIST)/$(WINDOWS_DIR_NAME)"
linux:
@mkdir -p $(DIST)
cd $(PROJECT) && flutter build linux --release
@rm -rf "$(DIST)/$(LINUX_DIR_NAME)"
@cp -r "$(PROJECT)/build/linux/x64/release/bundle" \
"$(DIST)/$(LINUX_DIR_NAME)"
build-all: icons regen apk appbundle ipa macos windows linux
build-mobile: icons regen apk-all ipa
package:
@mkdir -p $(DIST)
@tar -czf $(DIST)/artifacts.tar.gz \
-C $(DIST) . \
--exclude=artifacts.tar.gz