Makefile 6.08 KB
Newer Older
1 2
#PLATFORM=ios
PLATFORM=android
3
APP_VERSION=$(shell grep 'change version here' www/js/bishop.js |cut -f2 -d\')
4
ADB=/usr/bin/adb
5

6
all: release
Troy A. Griffitts's avatar
Troy A. Griffitts committed
7 8 9

rinstall: release uninstall install

10 11 12 13 14 15 16 17 18 19

run: run${PLATFORM}

runios:
	cordova emulate ios

runandroid:
	cordova emulate android


20
debug: refreshplugins copysourcefromplatform${PLATFORM} builddebug${PLATFORM} copydebug${PLATFORM}
21
release: refreshplugins copysourcefromplatform${PLATFORM} buildrelease${PLATFORM} copyrelease${PLATFORM}
22 23

build:
Troy A. Griffitts's avatar
Troy A. Griffitts committed
24 25
	cordova build

26
buildreleaseandroid:
27
	find platforms/android/ -name screen.png -exec rm {} \;
28 29 30 31 32
	cordova build android --release

buildreleaseios:
	cordova build --device --release ios

33
builddebugandroid:
34
	find platforms/android/ -name screen.png -exec rm {} \;
35 36 37 38 39
	cordova build android --debug

builddebugios:
	cordova build --device --debug ios

40
copydebugandroid:
41
	cp platforms/android/app/build/outputs/apk/debug/app-debug.apk bishop.apk || true
42 43 44 45 46 47

copydebugios:
	echo should copy ios debug app to root folder


copyreleaseandroid:
48
	#try both unsigned and signed, old and new paths; prefer signed new path if available
49
	cp platforms/android/app/build/outputs/apk/release/app-release.apk bishop.apk || true
Troy A. Griffitts's avatar
Troy A. Griffitts committed
50

51 52 53 54 55
copyreleaseios:
	echo should copy ios release to root folder

install: install${PLATFORM}

56 57 58
deploy: deploy${PLATFORM}


59
installandroid:
60
	$(ADB) install -r bishop.apk
Troy A. Griffitts's avatar
Troy A. Griffitts committed
61

62 63
deployandroid:
	scp bishop.apk scribe@crosswire.org:/home/crosswire/html/
64 65 66
	scp bishop.apk scribe@crosswire.org:public_html/bishop-${APP_VERSION}.apk
	@echo "http://crosswire.org/~scribe/bishop-${APP_VERSION}.apk"
	@echo "bishop-${APP_VERSION}.apk size: $(shell ls -l bishop.apk|cut -d' ' -f5) md5: $(shell md5sum bishop.apk|cut -f1 -d' ')"
67

68 69 70
deployios:
	scp "$(shell ls -td ~/Desktop/Bishop*|head -1)"/Bishop.ipa crosswire.org:/home/crosswire/html/
	scp "$(shell ls -td ~/Desktop/Bishop*|head -1)"/manifest.plist crosswire.org:/home/crosswire/html/bishop/
71

72
uninstall: uninstall${PLATFORM}
73 74

uninstallandroid:
75
	$(ADB) uninstall org.crosswire.bishop
Troy A. Griffitts's avatar
Troy A. Griffitts committed
76

77 78 79
uninstallios:
	echo uninstall app from iphone

Troy A. Griffitts's avatar
Troy A. Griffitts committed
80
refreshplugins:
81
####	Only do this if we are working on local plugin regularly
82 83
#	cordova plugin remove cordova-plugin-crosswire-sword || true
#	cordova plugin add ../sword/bindings/cordova/cordova-plugin-crosswire-sword/ --nofetch -verbose
84 85
# To easily switch back to published plugin without a full setup
#	cordova plugin add cordova-plugin-crosswire-sword || true
Troy A. Griffitts's avatar
Troy A. Griffitts committed
86

87
copysourcefromplatformandroid:
88
	echo "do nothing for now"; #cp -a platforms/android/assets/www/index.html platforms/android/assets/www/img platforms/android/assets/www/css platforms/android/assets/www/js www/ || true
Troy A. Griffitts's avatar
Troy A. Griffitts committed
89

90
copysourcefromplatformios:
91
	echo nothing to do because xcode somehow edits files at top level www/
92

93 94 95 96 97
refreshplatform: removeplatforms refreshplatform${PLATFORM}

removeplatforms:
	cordova platform remove android || true
	cordova platform remove ios || true
98 99

refreshplatformandroid:
100
	cordova platform remove android || true
101
	cordova platform add android || true
102 103

refreshplatformios:
104
	cordova platform remove ios || true
105
	cordova platform add ios || true
106 107 108 109

refreshiosimages:
	cordova-icon --icon=res/swordlogo-1024.png
	cordova-splash --splash=res/swordlogo-1024.png
110

111
setup: clearplugins refreshplatform addplugins refreshlocales
112 113
	# one last refresh platform to get the plugin patches deployed
	make refreshplatform
114

115 116 117 118
###
# Plugins should not be committed to config.xml
# make setup adds them in the right order after platform
#
119
addplugins:
120
	cordova plugin add cordova-plugin-inappbrowser || true
121
	cordova plugin add cordova-plugin-android-permissions || true
122
	cordova plugin add cordova-plugin-file || true
123
	cordova plugin add cordova-plugin-globalization || true
124
	cordova plugin add cordova-custom-config || true
125
	cordova plugin add cordova-plugin-whitelist || true
126
	cordova plugin add cordova-plugin-fonts || true
127
	cordova plugin add com-darryncampbell-cordova-plugin-intent || true
128
	cordova plugin add cordova-plugin-add-swift-support || true
129
####	Local dev SWORD plugin or published version of SWORD plugin
130
#	cordova plugin add ../sword/bindings/cordova/cordova-plugin-crosswire-sword/ --nofetch -verbose || true
131 132
	cordova plugin add cordova-plugin-crosswire-sword || true
	cordova plugin add cordova-plugin-splashscreen || true
133
	cordova plugin add https://github.com/phonegap/phonegap-mobile-accessibility.git || true
134
####	Trying photoviewer instead of fullscreenimage, which stopped working on newer Android
135 136
#	cordova plugin add es.keensoft.fullscreenimage || true
	cordova plugin add com-sarriaroman-photoviewer || true
137
	cordova plugin add cordova-plugin-x-toast || true
138
#	patch -p0 < patches/cordova-plugin-intent.patch
139 140

clearplugins:
141
	cordova plugin remove cordova-plugin-inappbrowser || true
142
	cordova plugin remove cordova-plugin-file || true
143
	cordova plugin remove cordova-plugin-android-permissions || true
144
	cordova plugin remove cordova-plugin-globalization || true
145
	cordova plugin remove cordova-plugin-fonts || true
146
	cordova plugin remove cordova-plugin-whitelist || true
147
	cordova plugin remove cordova-custom-config || true
148
	cordova plugin remove com-darryncampbell-cordova-plugin-intent || true
149
	cordova plugin remove cordova-plugin-crosswire-sword || true
150
	cordova plugin remove cordova-plugin-splashscreen || true
151
	cordova plugin remove cordova-plugin-add-swift-support || true
152
	cordova plugin remove phonegap-plugin-mobile-accessibility || true
153 154
#	cordova plugin remove es.keensoft.fullscreenimage || true
	cordova plugin remove com-sarriaroman-photoviewer || true
155
	cordova plugin remove cordova-plugin-x-toast || true
156

157
refreshlocales:
158 159 160 161 162
	rm -rf www/bundledResources/locales.d
	mkdir -p www/bundledResources/locales.d
	cd www/bundledResources/uilocales.d/; for i in $$(ls); do cp -f ../../../../sword/locales.d/$$i ../locales.d/; done || true
	cp ../sword/locales.d/locales.conf www/bundledResources/locales.d/

163
#copy any changes made to plugin via xcode
164
back:
165 166
	cp platforms/ios/Bishop/Plugins/cordova-plugin-crosswire-sword/SWORD.swift ../sword/bindings/cordova/cordova-plugin-crosswire-sword/src/ios/SWORD.swift 
	cp platforms/ios/Bishop/Plugins/cordova-plugin-crosswire-sword/flatapi.h ../sword/include/
Troy A. Griffitts's avatar
Troy A. Griffitts committed
167 168 169

clean:
	rm -rf node_modules package.json package-lock.json platforms plugins