]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | <?xml version="1.0" encoding="UTF-8"?>\r |
2 | <project name="PhoneGap" default="phonegap-help">\r | |
3 | <!--Legacy properties file support-->\r | |
4 | <property file="${app.dir}/phonegap.local.properties"/>\r | |
5 | \r | |
6 | <!--Init for All PhoneGap Tasks-->\r | |
7 | <target name="-before-phonegap-init"/>\r | |
8 | <target name="-phonegap-init">\r | |
9 | <if>\r | |
10 | <or>\r | |
11 | <x-is-true value="${args.emulate}"/>\r | |
12 | <x-is-true value="${args.autorun}"/>\r | |
13 | </or>\r | |
14 | <then>\r | |
15 | <property name="phonegap.skip.build" value="true"/>\r | |
16 | </then>\r | |
17 | </if>\r | |
18 | \r | |
19 | <!--Check for verbose output config from the user-->\r | |
20 | <if>\r | |
21 | <x-is-true value="app.phonegap.config.verbose"/>\r | |
22 | <then>\r | |
23 | <property name="phonegap.cli.options" value="-d"/>\r | |
24 | </then>\r | |
25 | <else>\r | |
26 | <property name="phonegap.cli.options" value=""/>\r | |
27 | </else>\r | |
28 | </if>\r | |
29 | </target>\r | |
30 | <target name="-after-phonegap-init"/>\r | |
31 | <target name="phonegap-init"\r | |
32 | depends="-init, -before-phonegap-init, -phonegap-init, -after-phonegap-init"/>\r | |
33 | \r | |
34 | <!--Default target outputs help information-->\r | |
35 | <target name="phonegap-help"/>\r | |
36 | \r | |
37 | <!-- Create Phonegap Application-->\r | |
38 | <target name="phonegap-create" depends="phonegap-init">\r | |
39 | <if>\r | |
40 | <not>\r | |
41 | <available file="${app.phonegap.config.path}" type="dir"/>\r | |
42 | </not>\r | |
43 | <then>\r | |
44 | <phonegap-echo message="Creating Phonegap Application with ID "${app.phonegap.config.id}" and Name "${app.phonegap.config.name}""/>\r | |
45 | <x-shell reloadprofile="true" dir="${app.dir}">\r | |
46 | phonegap ${phonegap.cli.options} create "${app.phonegap.config.path}" ${app.phonegap.config.id} ${app.phonegap.config.name}\r | |
47 | </x-shell>\r | |
48 | <!--\r | |
49 | Phonegap puts config.xml in the www root folder, this is dangerous due to how we clean this folder out\r | |
50 | we will move it up to the phonegap root in order to keep parity with cordova.\r | |
51 | Later we will copy this file back into www during remote builds\r | |
52 | -->\r | |
53 | <move file="${build.out.base.path}/config.xml" todir="${app.phonegap.config.path}" failonerror="false" overwrite="false" />\r | |
54 | </then>\r | |
55 | </if>\r | |
56 | </target>\r | |
57 | \r | |
58 | <!-- Prepares application for specified platform -->\r | |
59 | <target name="-before-phonegap-prepare"/>\r | |
60 | <target name="-phonegap-prepare" if="args.prepare">\r | |
61 | <fail status="0" message="Phonegap does not currently support prepare command, if this is required for your workflow please try Apache Cordova "/>\r | |
62 | </target>\r | |
63 | <target name="-after-phonegap-prepare"/>\r | |
64 | <target name="phonegap-prepare" depends="phonegap-init, -before-phonegap-prepare, -phonegap-prepare, -after-phonegap-prepare"/>\r | |
65 | \r | |
66 | <!-- Emulates application for the specified platform -->\r | |
67 | <target name="-before-phonegap-emulate"/>\r | |
68 | <target name="-phonegap-emulate" depends="-phonegap-check-platform, -phonegap-check-config-xml" if="args.emulate">\r | |
69 | <if>\r | |
70 | <x-is-true value="${phonegap.build.remote}"/>\r | |
71 | <then>\r | |
72 | <x-ant-call target="-phonegap-remote-emulate"/>\r | |
73 | </then>\r | |
74 | <else>\r | |
75 | <x-ant-call target="-phonegap-local-emulate"/>\r | |
76 | </else>\r | |
77 | </if>\r | |
78 | </target>\r | |
79 | <target name="-after-phonegap-emulate"/>\r | |
80 | <target name="phonegap-emulate" depends="phonegap-init, -before-phonegap-emulate, -phonegap-emulate, -after-phonegap-emulate"/>\r | |
81 | \r | |
82 | \r | |
83 | <!-- Runs application on a device for the specified platform -->\r | |
84 | <target name="-before-phonegap-run"/>\r | |
85 | <target name="-phonegap-run" depends="-phonegap-check-platform, -phonegap-check-config-xml" if="args.autorun">\r | |
86 | <if>\r | |
87 | <x-is-true value="${phonegap.build.remote}"/>\r | |
88 | <then>\r | |
89 | <x-ant-call target="-phonegap-remote-run"/>\r | |
90 | </then>\r | |
91 | <else>\r | |
92 | <x-ant-call target="-phonegap-local-run"/>\r | |
93 | </else>\r | |
94 | </if>\r | |
95 | </target>\r | |
96 | <target name="-after-phonegap-run"/>\r | |
97 | <target name="phonegap-run" depends="phonegap-init, -before-phonegap-run, -phonegap-run, -after-phonegap-run"/>\r | |
98 | \r | |
99 | \r | |
100 | <!-- Overall Phonegap Build Target. Determines type of build to use -->\r | |
101 | <target name="-before-phonegap-build"/>\r | |
102 | <target name="-phonegap-build" depends="-phonegap-check-platform, -phonegap-check-config-xml" unless="phonegap.skip.build">\r | |
103 | <if>\r | |
104 | <x-is-true value="${phonegap.build.remote}"/>\r | |
105 | <then>\r | |
106 | <x-ant-call target="-phonegap-remote-build"/>\r | |
107 | </then>\r | |
108 | <else>\r | |
109 | <x-ant-call target="-phonegap-local-build"/>\r | |
110 | </else>\r | |
111 | </if>\r | |
112 | </target>\r | |
113 | <target name="-after-phonegap-build"/>\r | |
114 | <target name="phonegap-build" depends="phonegap-init, -before-phonegap-build, -phonegap-build, -after-phonegap-build" />\r | |
115 | \r | |
116 | <!-- Private Utility Target to make sure users have declared a platform to take action on -->\r | |
117 | <target name="-phonegap-check-platform">\r | |
118 | <fail status="0" message="No platforms were specified, add a platform to ${build.name}'s -> phonegap -> config -> platform property in app.json">\r | |
119 | <condition>\r | |
120 | <or>\r | |
121 | <not>\r | |
122 | <isset property="phonegap.platform"/>\r | |
123 | </not>\r | |
124 | <contains string="${phonegap.platform}" substring="$"/>\r | |
125 | </or>\r | |
126 | </condition>\r | |
127 | </fail>\r | |
128 | \r | |
129 | \r | |
130 | \r | |
131 | </target>\r | |
132 | \r | |
133 | <!-- Private Utility target to copy the config.xml file back into the WWW folder -->\r | |
134 | <target name="-phonegap-check-config-xml">\r | |
135 | <copy todir="${build.out.base.path}" file="${app.phonegap.config.path}/config.xml" failonerror="false" overwrite="true" quiet="true"/>\r | |
136 | </target>\r | |
137 | \r | |
138 | <!-- Private Remote Build Targets-->\r | |
139 | <target name="-phonegap-remote-login">\r | |
140 | <phonegap-echo message="Attempting login to PhoneGap Build"/>\r | |
141 | <if>\r | |
142 | <not>\r | |
143 | <and>\r | |
144 | <isset property="phonegap.build.remote.username"/>\r | |
145 | <isset property="phonegap.build.remote.password"/>\r | |
146 | </and>\r | |
147 | </not>\r | |
148 | <then>\r | |
149 | <phonegap-echo level="warning">\r | |
150 | Phonegap Build login credentials were was not found. If you have not logged in prior to running this command.\r | |
151 | Please either login via "phonegap remote login" or edit your [APP_ROOT]/local.properties and set "phonegap.username" and "phonegap.password" appropriately\r | |
152 | </phonegap-echo>\r | |
153 | </then>\r | |
154 | </if>\r | |
155 | \r | |
156 | <x-shell reloadprofile="true" dir="${app.phonegap.config.path}">\r | |
157 | phonegap ${phonegap.cli.options} remote login --username="${phonegap.build.remote.username}" --password="${phonegap.build.remote.password}"\r | |
158 | </x-shell>\r | |
159 | </target>\r | |
160 | \r | |
161 | <target name="-phonegap-remote-build" depends="-phonegap-remote-login">\r | |
162 | <phonegap-echo message="Attempting PhoneGap remote build for ${phonegap.platform}"/>\r | |
163 | <x-shell reloadprofile="true" dir="${app.phonegap.config.path}">\r | |
164 | phonegap ${phonegap.cli.options} remote build ${phonegap.platform}\r | |
165 | </x-shell>\r | |
166 | </target>\r | |
167 | \r | |
168 | <target name="-phonegap-remote-run" depends="-phonegap-remote-login">\r | |
169 | <phonegap-echo message="Attempting PhoneGap remote run for ${phonegap.platform}"/>\r | |
170 | <x-shell reloadprofile="true" dir="${app.phonegap.config.path}">\r | |
171 | phonegap ${phonegap.cli.options} remote run ${phonegap.platform}\r | |
172 | </x-shell>\r | |
173 | </target>\r | |
174 | \r | |
175 | <target name="-phonegap-remote-emulate" depends="-phonegap-remote-login">\r | |
176 | <phonegap-echo message="Attempting PhoneGap remote emulate for ${phonegap.platform}"/>\r | |
177 | <x-shell reloadprofile="true" dir="${app.phonegap.config.path}">\r | |
178 | phonegap ${phonegap.cli.options} remote run ${phonegap.platform} --emulator\r | |
179 | </x-shell>\r | |
180 | </target>\r | |
181 | \r | |
182 | <!-- Private Local Build Targets-->\r | |
183 | <target name="-phonegap-local-build">\r | |
184 | <phonegap-echo message="Attempting PhoneGap local build for ${phonegap.platform}"/>\r | |
185 | <x-shell reloadprofile="true" dir="${app.phonegap.config.path}">\r | |
186 | phonegap ${phonegap.cli.options} local build ${phonegap.platform}\r | |
187 | </x-shell>\r | |
188 | </target>\r | |
189 | \r | |
190 | <target name="-phonegap-local-run">\r | |
191 | <phonegap-echo message="Attempting PhoneGap local run for ${phonegap.platform}"/>\r | |
192 | <x-shell reloadprofile="true" dir="${app.phonegap.config.path}">\r | |
193 | phonegap ${phonegap.cli.options} local run ${phonegap.platform}\r | |
194 | </x-shell>\r | |
195 | </target>\r | |
196 | \r | |
197 | <target name="-phonegap-local-emulate">\r | |
198 | <phonegap-echo message="Attempting PhoneGap local emulate for ${phonegap.platform}"/>\r | |
199 | <x-shell reloadprofile="true" dir="${app.phonegap.config.path}">\r | |
200 | phonegap ${phonegap.cli.options} local run ${phonegap.platform} --emulator\r | |
201 | </x-shell>\r | |
202 | </target>\r | |
203 | \r | |
204 | <!-- Internal Packager Hooks -->\r | |
205 | <target name="-before-phonegap-init-native-package"/>\r | |
206 | <target name="-phonegap-init-native-package" depends="phonegap-init, phonegap-create"/>\r | |
207 | <target name="-after-phonegap-init-native-package"/>\r | |
208 | <target name="phonegap-init-native-package" depends="-before-phonegap-init-native-package, -phonegap-init-native-package, -after-phonegap-init-native-package"/>\r | |
209 | \r | |
210 | <target name="-before-phonegap-native-package"/>\r | |
211 | <target name="-phonegap-native-package" depends="phonegap-build, phonegap-emulate, phonegap-run"/>\r | |
212 | <target name="-after-phonegap-native-package"/>\r | |
213 | <target name="phonegap-native-package" depends="phonegap-init, -before-phonegap-native-package, -phonegap-native-package, -after-phonegap-native-package"/>\r | |
214 | \r | |
215 | <macrodef name="phonegap-echo">\r | |
216 | <text name="text" optional="true"/>\r | |
217 | <attribute name="message" default=""/>\r | |
218 | <attribute name="level" default="info"/>\r | |
219 | <sequential>\r | |
220 | <if>\r | |
221 | <equals arg1="@{message}" arg2=""/>\r | |
222 | <then>\r | |
223 | <x-echo message="[Phonegap] @{text}" level="@{level}"/>\r | |
224 | </then>\r | |
225 | <else>\r | |
226 | <x-echo message="[Phonegap] @{message}" level="@{level}"/>\r | |
227 | </else>\r | |
228 | </if>\r | |
229 | </sequential>\r | |
230 | </macrodef>\r | |
231 | </project> |