-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
170 lines (154 loc) · 7.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
export PROJECT_ROOT=$(shell pwd)
export TMP_DIR=$(PROJECT_ROOT)/tmp/
export SVN_DIR=$(TMP_DIR)/$(PROJECT_NAME)_trunk/
run:
@mkdir -p ${PROJECT_ROOT}/src/Resources/test/
@mkdir -p ${PROJECT_ROOT}/src/build/iphone/
@echo "" > ${PROJECT_ROOT}/src/Resources/test/enabled.js
@make launch-titanium
test:
@mkdir -p ${PROJECT_ROOT}/src/Resources/test/
@mkdir -p ${PROJECT_ROOT}/src/build/iphone/
@echo "meme.config.tests_enabled = true;" > ${PROJECT_ROOT}/src/Resources/test/enabled.js
@make launch-titanium
clean: clean-languages
@rm -rf ${PROJECT_ROOT}/src/build/iphone/*
@mkdir -p ${PROJECT_ROOT}/src/build/iphone/
@echo "Deleted: ${PROJECT_ROOT}/src/build/iphone/*"
clean-languages:
@PROJECT_ROOT=${PROJECT_ROOT} bash ${PROJECT_ROOT}/bin/i18n.sh clean
languages:
@PROJECT_ROOT=${PROJECT_ROOT} bash ${PROJECT_ROOT}/bin/i18n.sh
launch-titanium:
@echo "Building with Titanium..."
@mkdir -p ${PROJECT_ROOT}/src/build/iphone/
@PROJECT_ROOT=${PROJECT_ROOT} bash ${PROJECT_ROOT}/bin/titanium.sh
build-verification:
@if [ "`find ${PROJECT_ROOT}/src/build/iphone/ -type f | wc -l | sed 's/ //g'`" == "0" ]; then\
echo "[ERROR] Please execute \"make run\" and run the application on simulator before publishing, so the compiled files can be generated.";\
exit 1;\
fi
svn-verification:
@if [ "${SVN_USER}" == "" ]; then\
echo "[ERROR] SVN_USER env variable is required for this make target";\
echo "Please use: \"SVN_USER=username make [target]\"";\
exit 1;\
fi
project-name-verification:
@if [ "${PROJECT_NAME}" != "MemeiPhone" ] && [ "${PROJECT_NAME}" != "MimiPhone" ]; then\
echo "[ERROR] PROJECT_NAME env variable is required for this make target";\
echo "Please use one of the following:";\
echo "- \"PROJECT_NAME=MemeiPhone ... make [target]\"";\
echo "- \"PROJECT_NAME=MimiPhone ... make [target]\"";\
exit 1;\
fi
svn-checkout: svn-verification
@echo "Downloading project from SVN..."
@echo "SVN_USER: ${SVN_USER}"
@echo "SVN_DIR: ${SVN_DIR}"
@rm -rf ${SVN_DIR}
@mkdir -p ${SVN_DIR}
@svn co svn+ssh://${SVN_USER}@svn.corp.yahoo.com/yahoo/brickhouse/iwasay/etc/${PROJECT_NAME}/trunk ${SVN_DIR}
svn-checkin: svn-verification
@echo "Checking in files on SVN..."
@SVN_DIR=${SVN_DIR} bash ${PROJECT_ROOT}/bin/svn_checkin.sh
svn-commit: svn-verification
@echo "Commiting changes to SVN..."
@echo ">>> Please type your commit message (press Ctrl+D __ONLY ONCE__ and wait to finish):"
@svn ci -m "`python -c "import sys; data = sys.stdin.read(); print data;"`" ${SVN_DIR}
@rm -rf ${SVN_DIR}
@echo "Done."
# This target only makes sense for us at Yahoo!
# We use it to publish the app to AppStore
#
# TODO: patch main.m to put correct TI_APPLICATION_RESOURCE_DIR
publish: project-name-verification build-verification
@echo "Start publishing project: ${PROJECT_NAME}"
@make svn-checkout
@make languages
@echo "Deleting destination files..."
@for FILE in `find ${SVN_DIR} | grep -v .svn | grep -v ${PROJECT_NAME}.xcodeproj | grep -v Entitlements.plist | grep -v libTiCore.a | grep -v libtiverify.a`;\
do\
if [ -f $$FILE ]; then rm -rf $$FILE; fi;\
done
@echo "Copying root files..."
@cp -prf ${PROJECT_ROOT}/src/CHANGELOG.txt ${SVN_DIR}
@cp -prf ${PROJECT_ROOT}/src/Info.plist ${SVN_DIR}
@cp -prf ${PROJECT_ROOT}/src/LICENSE* ${SVN_DIR}
@cp -prf ${PROJECT_ROOT}/src/manifest ${SVN_DIR}
@cp -prf ${PROJECT_ROOT}/src/tiapp.xml ${SVN_DIR}
@echo "Copying Resources..."
@mkdir -p ${SVN_DIR}/Resources/
@cp -prf ${PROJECT_ROOT}/src/Resources/images ${SVN_DIR}/Resources/
@cp -prf ${PROJECT_ROOT}/src/Resources/meme ${SVN_DIR}/Resources/
@cp -prf ${PROJECT_ROOT}/src/Resources/*.js ${SVN_DIR}/Resources/
@cp -prf ${PROJECT_ROOT}/src/Resources/*.png ${SVN_DIR}/Resources/
@echo "Copying Languages..."
@cp -prf ${PROJECT_ROOT}/src/Resources/*.lproj ${SVN_DIR}/Resources/
@echo "Disabling tests in destination..."
@mkdir -p ${SVN_DIR}/Resources/test/
@echo "" > ${SVN_DIR}/Resources/test/enabled.js
@echo "" > ${SVN_DIR}/Resources/test/tests.js
@echo "Copying fonts..."
@for FONT in `find . -type f -name "GothamRnd-*.otf"`;\
do\
cp -prf $$FONT ${SVN_DIR}/Resources/;\
done
@echo "Copying production secrets..."
@if [ -f ${PROJECT_ROOT}/src/Resources/meme/config/PROD_secrets.js ]; then\
rm -rf ${SVN_DIR}/Resources/meme/config/*secrets.js;\
cp -prvf ${PROJECT_ROOT}/src/Resources/meme/config/PROD_secrets.js ${SVN_DIR}/Resources/meme/config/secrets.js;\
fi
@echo "Copying Titanium build directory..."
@mkdir -p ${SVN_DIR}/build/iphone/
@cp -prf ${PROJECT_ROOT}/src/build/iphone/Classes ${SVN_DIR}/build/iphone/
@cp -prf ${PROJECT_ROOT}/src/build/iphone/headers ${SVN_DIR}/build/iphone/
@#cp -prf ${PROJECT_ROOT}/src/build/iphone/lib ${SVN_DIR}/build/iphone/
@cp -prf ${PROJECT_ROOT}/src/build/iphone/Resources ${SVN_DIR}/build/iphone/
@cp -prf ${PROJECT_ROOT}/src/build/iphone/Info.plist ${SVN_DIR}/build/iphone/
@cp -prf ${PROJECT_ROOT}/src/build/iphone/${PROJECT_NAME}_Prefix.pch ${SVN_DIR}/build/iphone/
@cp -prf ${PROJECT_ROOT}/src/build/iphone/module.xcconfig ${SVN_DIR}/build/iphone/
@cp -prf ${PROJECT_ROOT}/src/build/iphone/project.xcconfig ${SVN_DIR}/build/iphone/
@echo "Replacing Titanium default images..."
@cp -prf ${PROJECT_ROOT}/src/Resources/en.lproj/*.png ${SVN_DIR}/build/iphone/Resources/
@cp -prf ${PROJECT_ROOT}/src/Resources/meme_appicon.png ${SVN_DIR}/build/iphone/Resources/appicon.png
@echo "**************************************************"
@echo "Please remember that the following file:"
@echo "- '${PROJECT_ROOT}/src/build/iphone/${PROJECT_NAME}.xcodeproj/project.pbxproj'"
@echo "Needs to be published manually (to avoid SVN conflicts)."
@echo "**************************************************"
@echo "Done."
@make svn-checkin
@make svn-commit
check-no-changes-on-git:
@if [ "`git st | grep -v '#'`" != "nothing to commit (working directory clean)" ]; then\
echo "[ERROR] There are uncommitted changes in your repository. Please commit files and try again.";\
exit 1;\
fi
mim: check-no-changes-on-git clean
@echo "Deleting uneeded languages..."
@rm -rvf ${PROJECT_ROOT}/src/i18n/en
@rm -rvf ${PROJECT_ROOT}/src/i18n/es
@rm -rvf ${PROJECT_ROOT}/src/i18n/pt
@rm -rvf ${PROJECT_ROOT}/src/i18n/zh-Hant
@rm -rvf ${PROJECT_ROOT}/src/Resources/en.lproj
@rm -rvf ${PROJECT_ROOT}/src/Resources/es.lproj
@rm -rvf ${PROJECT_ROOT}/src/Resources/pt.lproj
@rm -rvf ${PROJECT_ROOT}/src/Resources/zh-Hant.lproj
@echo "Deleting uneeded images..."
@rm -rvf ${PROJECT_ROOT}/src/Resources/images/es
@rm -rvf ${PROJECT_ROOT}/src/Resources/images/en
@rm -rvf ${PROJECT_ROOT}/src/Resources/images/pt
@rm -rvf ${PROJECT_ROOT}/src/Resources/images/zh-Hant
@echo "Replace Meme files for Mim files..."
@mv -v ${PROJECT_ROOT}/src/Info_mim.plist ${PROJECT_ROOT}/src/Info.plist
@mv -v ${PROJECT_ROOT}/src/manifest_mim ${PROJECT_ROOT}/src/manifest
@mv -v ${PROJECT_ROOT}/src/tiapp_mim.xml ${PROJECT_ROOT}/src/tiapp.xml
@echo "Replace CFBundleName..."
@mv ${PROJECT_ROOT}/src/Resources/id.lproj/InfoPlist.strings ${PROJECT_ROOT}/src/Resources/id.lproj/InfoPlist.strings.old
@cat ${PROJECT_ROOT}/src/Resources/id.lproj/InfoPlist.strings.old | sed -e "s/MemeiPhone/MimiPhone/g" > ${PROJECT_ROOT}/src/Resources/id.lproj/InfoPlist.strings
@rm -rf ${PROJECT_ROOT}/src/Resources/id.lproj/InfoPlist.strings.old
@echo "\"Berhasil\" :)"
@echo "* Don't forget to run the application before publishing it."
log:
@tail -n100 -f ${PROJECT_ROOT}/src/build/iphone/build/build.log