-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile
154 lines (131 loc) · 5.33 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
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# Define the version from pubspec.yaml
VERSION := $(shell yq eval '.version' pubspec.yaml)
# Define the output directory
OUTPUT_DIR := $(VERSION)
.DEFAULT_GOAL := all
OS := $(shell uname)
.PHONY: all
ifeq ($(OS),Darwin)
all: build_runner generate_icons ios_release ios_debug android_release android_debug app_bundle_release app_bundle_debug sha1_hashes
else
all: build_runner generate_icons android_release android_debug app_bundle_release app_bundle_debug sha1_hashes
endif
.PHONY: ios
ifeq ($(OS),Darwin)
ios: ios_release ios_debug
else
ios:
@echo "iOS builds only supported on macOS"
endif
.PHONY: android
android: android_release android_debug
.PHONY: app_bundle
app_bundle: app_bundle_release app_bundle_debug
.PHONY: release
ifeq ($(OS),Darwin)
release: ios_release android_release app_bundle_release
else
release: android_release app_bundle_release
endif
.PHONY: debug
ifeq ($(OS),Darwin)
debug: ios_debug android_debug app_bundle_debug
else
debug: android_debug app_bundle_debug
endif
.PHONY: ios_release
ios_release: create_output_dir
@echo "Building iOS release IPA..."
@flutter build ipa --release --dart-define-from-file=./sentry.json
@echo "Complete release IPA"
@mv build/ios/ipa/jellybook.ipa "$(OUTPUT_DIR)/JellyBook-Release.ipa"
.PHONY: ios_debug
ios_debug: create_output_dir
@echo "Building iOS debug IPA..."
@flutter build ipa --debug --dart-define-from-file=./sentry.json
@echo "Complete debug IPA"
@mv build/ios/ipa/jellybook.ipa "$(OUTPUT_DIR)/JellyBook-Debug.ipa"
.PHONY: android_release
android_release: create_output_dir
@echo "Building Android release APK..."
@flutter build apk --release --dart-define-from-file=./sentry.json
@echo "Complete release APK"
@mv build/app/outputs/flutter-apk/app-release.apk "$(OUTPUT_DIR)/JellyBook-Release.apk"
@echo "Building Android release APK (split by ABI)..."
@flutter build apk --split-per-abi --release --dart-define-from-file=./sentry.json
@echo "Complete release APK (split by ABI)"
@mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk "$(OUTPUT_DIR)/JellyBook-Release-arm32.apk"
@mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk "$(OUTPUT_DIR)/JellyBook-Release-arm64.apk"
@mv build/app/outputs/flutter-apk/app-x86_64-release.apk "$(OUTPUT_DIR)/JellyBook-Release-x86_64.apk"
.PHONY: android_debug
android_debug: create_output_dir
@echo "Building Android debug APK..."
@flutter build apk --debug --dart-define-from-file=./sentry.json
@echo "Complete debug APK"
@mv build/app/outputs/flutter-apk/app-debug.apk "$(OUTPUT_DIR)/JellyBook-Debug.apk"
@echo "Building Android debug APK (split by ABI)..."
@flutter build apk --split-per-abi --debug --dart-define-from-file=./sentry.json
@echo "Complete debug APK (split by ABI)"
@mv build/app/outputs/flutter-apk/app-armeabi-v7a-debug.apk "$(OUTPUT_DIR)/JellyBook-Debug-arm32.apk"
@mv build/app/outputs/flutter-apk/app-arm64-v8a-debug.apk "$(OUTPUT_DIR)/JellyBook-Debug-arm64.apk"
@mv build/app/outputs/flutter-apk/app-x86_64-debug.apk "$(OUTPUT_DIR)/JellyBook-Debug-x86_64.apk"
.PHONY: app_bundle_release
app_bundle_release: create_output_dir
@echo "Building Android release App Bundle..."
@flutter build appbundle --release --dart-define-from-file=./sentry.json
@echo "Complete release App Bundle"
@mv build/app/outputs/bundle/release/app-release.aab "$(OUTPUT_DIR)/JellyBook-Release.aab"
.PHONY: app_bundle_debug
app_bundle_debug: create_output_dir
@echo "Building Android debug App Bundle..."
@flutter build appbundle --debug --dart-define-from-file=./sentry.json
@echo "Complete debug App Bundle"
@mv build/app/outputs/bundle/debug/app-debug.aab "$(OUTPUT_DIR)/JellyBook-Debug.aab"
.PHONY: sha1_hashes
sha1_hashes:
@echo "\n<details>\n<summary>SHA1</summary>\n<ul>"
@for file in "$(OUTPUT_DIR)"/*; do \
hash=$$(sha1sum "$$file" | awk '{print $$1}'); \
file=$$(basename "$$file"); \
echo "<li><code>$${file}</code>: <code>$${hash}</code></li>"; \
done
@echo "</ul>\n</details>"
.PHONY: create_output_dir
create_output_dir:
@mkdir -p "$(OUTPUT_DIR)"
.PHONY: clean
clean:
@echo "Cleaning up..."
@rm -rf "$(OUTPUT_DIR)"
@echo "Cleaned up."
# Usage: make clean-all
.PHONY: clean-all
clean-all: clean
@echo "Cleaning build artifacts..."
@flutter clean
@echo "Cleaned build artifacts."
@echo removing the output directory
@rm -rf "$(OUTPUT_DIR)"
@echo "Cleaned up."
# Usage: flutter pub run build_runner build --delete-conflicting-outputs
.PHONY: build_runner
build_runner:
@flutter pub run build_runner build --delete-conflicting-outputs
# Usage: generate the icon files
.PHONY: generate_icons
@dart run icons_launcher:create
# Help target to display available targets and their descriptions
.PHONY: help
help:
@echo "Available targets:"
@echo " all : Build all (iOS and Android) releases and debugs"
@echo " ios : Build iOS releases and debugs"
@echo " android : Build Android releases and debugs"
@echo " app_bundle : Build Android App Bundles (release and debug)"
@echo " release : Build release versions (iOS, Android, and App Bundles)"
@echo " debug : Build debug versions (iOS, Android, and App Bundles)"
@echo " clean : Clean up the output directory"
@echo " clean-all : Clean up build artifacts and the output directory"
@echo " build_runner : Run the build runner to generate Isar models"
@echo " generate_icons : Generate the icon files"
@echo " help : Display this help message"