This repository has been archived by the owner on Mar 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
199 lines (178 loc) · 7.67 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
SONR_ROOT_DIR=/Users/prad/Sonr # Set this to Folder of Sonr
# Project Dirs
PROJECT_DIR=/Users/prad/Sonr/app
ANDROID_DIR=/Users/prad/Sonr/app/android
IOS_DIR=/Users/prad/Sonr/app/ios
# Mobile Actions
FLUTTER=flutter
RUN=$(FLUTTER) run -d all
BUILDIOS=$(FLUTTER) build ios --release --no-codesign
BUILDANDROID=$(FLUTTER) build appbundle --release
BUILDIOS_SKL=$(FLUTTER) build ios --bundle-sksl-path $(SKL_FILE) --release --no-codesign
BUILDANDROID_SKL=$(FLUTTER) build appbundle --bundle-sksl-path $(SKL_FILE) --release
CLEAN=$(FLUTTER) clean
APP_BUILD=`cider version | cut -d'+' -f 2`
APP_VERSION=`cider version | cut -d'+' -f 1`
# Result Dirs/Files
IOS_ARCHIVE_DIR=/Users/prad/Sonr/app/build/ios/archive/
ANDROID_ARCHIVE_DIR=/Users/prad/Sonr/app/build/app/outputs/bundle/release/
SKL_FILE=/Users/prad/Sonr/app/assets/data/flutter_01.sksl.json
# References
PLUGIN_DIR=/Users/prad/Sonr/plugin
IOS_FRAMEWORK_DIR=${PLUGIN_DIR}/ios/Frameworks
IOS_FRAMEWORK=${IOS_FRAMEWORK_DIR}/Core.framework
ANDROID_AAR_DIR=${PLUGIN_DIR}/android/libs
ANDROID_AAR=${ANDROID_AAR_DIR}/io.sonr.core.aar
# App References
APP_PLUGIN_DIR="/Users/prad/Sonr/app/plugin"
APP_IOS_FRAMEWORK=${APP_PLUGIN_DIR}/ios/Frameworks/Core.framework
APP_ANDROID_AAR=${APP_PLUGIN_DIR}/android/libs/io.sonr.core.aar
# Lists Options
all: Makefile
@figlet -f larry3d "Sonr App"
@echo ""
@sed -n 's/^##//p' $<
## build : Builds IPA and APB for Sonr App
build: build.ios build.android
@cd /System/Library/Sounds && afplay Hero.aiff
@echo ""
@echo ""
@echo "------------------------------------------------------------------"
@echo "-------- ✅ ✅ ✅ FINISHED FLUTTER BUILD ✅ ✅ ✅ --------------"
@echo "------------------------------------------------------------------"
## └─ ios - IPA for iOS
build.ios:
@cd $(PROJECT_DIR) && $(CLEAN)
cd $(PROJECT_DIR) && $(BUILDIOS)
@echo '--------------------------------------------------'
@echo "✅ Finished Building iOS ➡ " && date
## └─ android - APB for Android
build.android:
@cd $(PROJECT_DIR) && $(CLEAN)
cd $(PROJECT_DIR) && $(BUILDANDROID)
cd android && fastlane internal
@echo '--------------------------------------------------'
@echo "✅ Finished Building Android ➡ " && date
## build-skl : Builds IPA and APB for Sonr App with SKL Embedding
build-skl: build-skl.ios build.android
@cd /System/Library/Sounds && afplay Hero.aiff
@echo ""
@echo ""
@echo "------------------------------------------------------------------"
@echo "-------- ✅ ✅ ✅ FINISHED FLUTTER BUILD ✅ ✅ ✅ --------------"
@echo "------------------------------------------------------------------"
## └─ ios - IPA for iOS with SKL Embedding
build-skl.ios:
@cd $(PROJECT_DIR) && $(CLEAN)
cd $(PROJECT_DIR) && $(BUILDIOS_SKL)
@echo '--------------------------------------------------'
@echo "✅ Finished Building iOS ➡ " && date
## └─ android - APB for Android with SKL Embedding
build-skl.android:
@cd $(PROJECT_DIR) && $(CLEAN)
cd $(PROJECT_DIR) && $(BUILDANDROID_SKL)
cd android && fastlane internal
@echo '--------------------------------------------------'
@echo "✅ Finished Building Android ➡ " && date
## bump : Bumps the version number for iOS/Android (including Targets)
bump:
@echo "Bumping Version"
@cd $(PROJECT_DIR) && cider bump build
@echo "--------------------------------------------------"
@echo "Build: ${APP_BUILD}"
@echo "Version: $(APP_VERSION)"
@cd ios && agvtool new-version -all ${APP_BUILD}
@cd ios && agvtool new-marketing-version ${APP_VERSION}
@echo "--------------------------------------------------"
@echo "✅ Finished Bumping Version ➡ " && date
## deploy : Builds AppBundle/iOS Archive and Uploads to PlayStore/AppStore
deploy: fetch bump deploy.ios deploy.android
@echo 'Cleaning Builds'
cd $(PROJECT_DIR) && rm -rf build
cd $(PROJECT_DIR) && $(CLEAN)
@echo 'Cleaning iOS Fastlane Cache'
@cd $(PROJECT_DIR)/ios && find . -name "*.zip" -type f -delete && find . -name "*.ipa" -type f -delete
@cd $(PROJECT_DIR)/ios/fastlane && find . -name "report.xml" -type f -delete
@cd $(PROJECT_DIR)/android/fastlane && find . -name "report.xml" -type f -delete
@cd $(PROJECT_DIR) && flutter pub get
@cd /System/Library/Sounds && afplay Hero.aiff
@echo ""
@echo ""
@echo "--------------------------------------------------------------"
@echo "-------- ✅ ✅ ✅ FINISHED DEPLOYING ✅ ✅ ✅ --------------"
@echo "--------------------------------------------------------------"
## └─ ios - IPA for AppStore Connect
deploy.ios:
cd $(IOS_DIR) && fastlane ios assemble
cd $(IOS_DIR) && pod install
cd $(IOS_DIR) && fastlane ios build
cd $(IOS_DIR) && fastlane ios deploy_internal
@cd /System/Library/Sounds && afplay Glass.aiff
@echo '--------------------------------------------------'
@echo "Finished Uploading Sonr iOS to AppStore Connect ➡ " && date
## └─ android - APB for PlayStore
deploy.android:
cd $(ANDROID_DIR) && fastlane android assemble
cd $(ANDROID_DIR) && fastlane android build
cd $(ANDROID_DIR) && fastlane android deploy_internal
@cd /System/Library/Sounds && afplay Glass.aiff
@echo '--------------------------------------------------'
@echo "Finished Uploading Sonr Android to PlayStore ➡ " && date
##
## [fetch] : Fetch latest version of frameworks
fetch:
@echo "🔹 Fetching Sonr Frameworks"
@echo ' 1. Setup Directories...'
@rm -rf ${IOS_FRAMEWORK_DIR}
@rm -rf ${ANDROID_AAR_DIR}
@mkdir -p ${IOS_FRAMEWORK_DIR}
@mkdir -p ${ANDROID_AAR_DIR}
@echo ' 2. Fetching Frameworks...'
@gh release download --repo 'sonr-io/core' --pattern *_android.zip --dir ${ANDROID_AAR_DIR}
@gh release download --repo 'sonr-io/core' --pattern *_ios.zip --dir ${IOS_FRAMEWORK_DIR}
@echo ' 3. Unzipping Frameworks...'
@unzip ${ANDROID_AAR_DIR}/*_android.zip -d ${ANDROID_AAR_DIR}
@unzip ${IOS_FRAMEWORK_DIR}/*_ios.zip -d ${IOS_FRAMEWORK_DIR}
@echo ' 4. Cleaning Up...'
@cd ${ANDROID_AAR_DIR} && find . -name "*.zip" -type f -delete
@cd ${IOS_FRAMEWORK_DIR} && find . -name "*.zip" -type f -delete
@cd /System/Library/Sounds && afplay Hero.aiff
@echo '✅ Done!'
## [profile] : Run App for Profiling and Save SKSL File
profile:
@echo '-----------------------------------------------'
@echo 'Hit Shift+M during Run to Save Profiling Result'
@echo '-----------------------------------------------'
@echo ''
cd $(PROJECT_DIR) && $(RUN) --profile --cache-sksl
## [update] : Fetch Plugin Submodule, and Upgrade Dependencies
update:
@echo '🔹 Cleaning Project...'
@cd $(PROJECT_DIR) && rm -rf build
@cd $(PROJECT_DIR) && $(CLEAN)
@rm -rf $(APP_IOS_FRAMEWORK)
@rm -rf $(APP_ANDROID_AAR)
@echo '🔹 Updating Submodules...'
@cd $(PLUGIN_DIR) && make update
@cd $(PROJECT_DIR) && git submodule update --remote plugin
@echo '🔹 Copying Frameworks to App...'
@cp -R ${IOS_FRAMEWORK} ${APP_IOS_FRAMEWORK}
@cp -R ${ANDROID_AAR} ${APP_ANDROID_AAR}
@echo '🔹 Fetch Packages...'
@cd $(PROJECT_DIR) && flutter pub upgrade
@cd /System/Library/Sounds && afplay Hero.aiff
@echo "✅ Finished Updating Binary ➡ " && date
## [clean] : Cleans App Build Cache
clean:
@echo '-- Removing Build Folders --'
@cd $(PROJECT_DIR)/ios && rm -rf build
@cd $(PROJECT_DIR) && rm -rf build
@cd $(PROJECT_DIR) && rm -rf dist
@echo 'Cleaning iOS Fastlane Cache'
@cd $(PROJECT_DIR)/ios && find . -name "*.zip" -type f -delete && find . -name "*.ipa" -type f -delete
@cd $(PROJECT_DIR)/ios/fastlane && find . -name "report.xml" -type f -delete
@cd $(PROJECT_DIR)/android/fastlane && find . -name "report.xml" -type f -delete
@cd $(PROJECT_DIR) && flutter pub get
pub global activate cider
pub global activate protoc_plugin
pub global activate devtools