]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | <project name="x-init-impl">\r |
2 | <!--\r | |
3 | Init-Local\r | |
4 | -->\r | |
5 | <target name="-before-init-local"/>\r | |
6 | <target name="-init-local">\r | |
7 | <!--\r | |
8 | ${basedir} is actually the basedir of build.xml, in the app root\r | |
9 | so this imports ${app.dir}/local.properties, if present\r | |
10 | -->\r | |
11 | <property file="${basedir}/local.properties"/>\r | |
12 | \r | |
13 | <!--\r | |
14 | This will traverse upwards in the file system, starting at the\r | |
15 | app root directory, looking for the workspace. Once found, \r | |
16 | ${workspace.dir}/local.properties will be imported into this\r | |
17 | project\r | |
18 | -->\r | |
19 | <script language="javascript">\r | |
20 | <![CDATA[\r | |
21 | var f = new java.io.File(project.getProperty("basedir"));\r | |
22 | var sub = ".sencha/workspace/sencha.cfg";\r | |
23 | \r | |
24 | for (var p = f; p; p = p.getParentFile()) {\r | |
25 | var t = new java.io.File(p, sub);\r | |
26 | if (t.exists()) {\r | |
27 | // we found the workspace folder!\r | |
28 | \r | |
29 | t = new java.io.File(p, "local.properties");\r | |
30 | if (t.exists()) {\r | |
31 | var loader = project.createTask("property");\r | |
32 | loader.setFile(new java.io.File(t.getCanonicalPath()));\r | |
33 | loader.execute();\r | |
34 | }\r | |
35 | \r | |
36 | break;\r | |
37 | }\r | |
38 | }\r | |
39 | ]]>\r | |
40 | </script>\r | |
41 | \r | |
42 | </target>\r | |
43 | <target name="-after-init-local"/>\r | |
44 | <target name="init-local"\r | |
45 | depends="-before-init-local,-init-local,-after-init-local"/>\r | |
46 | \r | |
47 | <!--\r | |
48 | Apply Version\r | |
49 | -->\r | |
50 | <target name="-before-apply-version"/>\r | |
51 | <target name="-after-apply-version"/>\r | |
52 | <target name="apply-version" if="build.version">\r | |
53 | <echo>Switch package version to ${build.version}</echo>\r | |
54 | <antcall target="-before-apply-version"/>\r | |
55 | \r | |
56 | <x-set-json-version file="${basedir}/package.json"\r | |
57 | version="${build.version}"/>\r | |
58 | \r | |
59 | <antcall target="-after-apply-version"/>\r | |
60 | </target>\r | |
61 | \r | |
62 | <target name="-before-init"/>\r | |
63 | <target name="-init" unless="internal.x-sencha-initialized">\r | |
64 | <antcall target="apply-version"/>\r | |
65 | \r | |
66 | <!--\r | |
67 | Now, apply various project updates, such as ant class loader path\r | |
68 | updates, as well as loading Sencha Cmd config system properties\r | |
69 | into ant property space\r | |
70 | -->\r | |
71 | <x-sencha-init prefix=""/>\r | |
72 | \r | |
73 | <!-- \r | |
74 | default the build environment to production if it is unset by this point \r | |
75 | -->\r | |
76 | <property name="build.environment" value="production"/>\r | |
77 | <property name="CR" value=" "/>\r | |
78 | <property name="build.version" value="${package.version}"/>\r | |
79 | \r | |
80 | <x-load-properties>\r | |
81 | <file path="${package.config.dir}/${build.environment}.properties" required="false"/>\r | |
82 | <file path="${package.config.dir}/build.properties" required="false"/>\r | |
83 | <file path="${package.config.dir}/defaults.properties" required="true"/>\r | |
84 | </x-load-properties>\r | |
85 | \r | |
86 | <!--\r | |
87 | See if there is a ./resources subfolder\r | |
88 | -->\r | |
89 | <if>\r | |
90 | <not>\r | |
91 | <available file="${package.resources.dir}" type="dir"/>\r | |
92 | </not>\r | |
93 | <then>\r | |
94 | <property name="skip.resources" value="1"/>\r | |
95 | <property name="skip.slice" value="1"/>\r | |
96 | </then>\r | |
97 | </if>\r | |
98 | \r | |
99 | \r | |
100 | <!--\r | |
101 | See if there is a ./sass subfolder\r | |
102 | -->\r | |
103 | <if>\r | |
104 | <not>\r | |
105 | <available file="${package.sass.dir}" type="dir"/>\r | |
106 | </not>\r | |
107 | <then>\r | |
108 | <property name="skip.sass" value="1"/>\r | |
109 | </then>\r | |
110 | </if>\r | |
111 | \r | |
112 | <!-- \r | |
113 | Slicing operations are not needed when using the touch framework\r | |
114 | or for non-theme packages\r | |
115 | -->\r | |
116 | <if>\r | |
117 | <or>\r | |
118 | <not>\r | |
119 | <equals arg1="theme" arg2="${package.type}"/>\r | |
120 | </not>\r | |
121 | <equals arg1="touch" arg2="${framework.name}"/>\r | |
122 | </or>\r | |
123 | <then>\r | |
124 | <property name="skip.slice" value="1"/>\r | |
125 | </then>\r | |
126 | </if>\r | |
127 | \r | |
128 | <!--\r | |
129 | See if there is an ./examples subfolder full of example applications.\r | |
130 | -->\r | |
131 | <if>\r | |
132 | <and>\r | |
133 | <not>\r | |
134 | <available file="${package.examples.dir}" type="dir"/>\r | |
135 | </not>\r | |
136 | <not>\r | |
137 | <isset property="package.example.path"/>\r | |
138 | </not>\r | |
139 | </and>\r | |
140 | <then>\r | |
141 | <property name="skip.examples" value="1"/>\r | |
142 | </then>\r | |
143 | </if>\r | |
144 | \r | |
145 | <!--\r | |
146 | See if there is a ./packages subfolder full of packages. This is only allowed\r | |
147 | for framework packages.\r | |
148 | -->\r | |
149 | <if>\r | |
150 | <not>\r | |
151 | <and>\r | |
152 | <or>\r | |
153 | <equals arg1="${package.type}" arg2="framework"/>\r | |
154 | <equals arg1="${package.type}" arg2="toolkit"/>\r | |
155 | </or>\r | |
156 | <available file="${package.subpkgs.dir}" type="dir"/>\r | |
157 | </and>\r | |
158 | </not>\r | |
159 | <then>\r | |
160 | <property name="skip.subpkgs" value="1"/>\r | |
161 | </then>\r | |
162 | </if>\r | |
163 | \r | |
164 | <if>\r | |
165 | <not>\r | |
166 | <isset property="package.framework"/>\r | |
167 | </not>\r | |
168 | <then>\r | |
169 | <property name="skip.style" value="1"/>\r | |
170 | </then>\r | |
171 | </if>\r | |
172 | \r | |
173 | <if>\r | |
174 | <isset property="skip.style"/>\r | |
175 | <then>\r | |
176 | <property name="skip.sass" value="1"/>\r | |
177 | <property name="skip.capture" value="1"/>\r | |
178 | <property name="skip.slice" value="1"/>\r | |
179 | </then>\r | |
180 | </if>\r | |
181 | \r | |
182 | <if>\r | |
183 | <not>\r | |
184 | <isset property="package.base.names"/>\r | |
185 | </not>\r | |
186 | <then>\r | |
187 | <property name="skip.inherit" value="1"/>\r | |
188 | </then>\r | |
189 | </if>\r | |
190 | \r | |
191 | <!--\r | |
192 | this id string is used to share a common compiler instance\r | |
193 | for all x-compile calls in this project\r | |
194 | -->\r | |
195 | <property name="compiler.ref.id" value="package-compiler"/>\r | |
196 | \r | |
197 | <fileset id="pkg.files" \r | |
198 | dir="${package.dir}" \r | |
199 | includes="${pkg.includes}"\r | |
200 | excludes="${pkg.excludes}">\r | |
201 | <exclude name="**/.sass-cache/**/*"/>\r | |
202 | <exclude name="**/.sass-cache"/>\r | |
203 | <exclude name="**/theme-capture.*"/>\r | |
204 | </fileset>\r | |
205 | \r | |
206 | \r | |
207 | <if>\r | |
208 | <isset property="package.toolkit"/>\r | |
209 | <then>\r | |
210 | <property name="package.sass.fashion" value="true"/>\r | |
211 | </then>\r | |
212 | </if>\r | |
213 | \r | |
214 | <property name="package.sass.fashion" value="false"/>\r | |
215 | <property name="package.sass.rhino" value="false"/>\r | |
216 | <property name="package.sass.dynamic" value="false"/>\r | |
217 | \r | |
218 | <!--\r | |
219 | this property is set indicating we've reached the end of the\r | |
220 | core init phase. it's presence will indicate that we've already\r | |
221 | executed this target, and will bypass firing the init code\r | |
222 | repeatedly in sub projects (antcall, x-ant-call)\r | |
223 | See the above 'unless' attribute on the -init target\r | |
224 | -->\r | |
225 | <property name="internal.x-sencha-initialized" value="true"/>\r | |
226 | </target>\r | |
227 | <target name="-after-init"/>\r | |
228 | \r | |
229 | <target name="-before-init-defaults"/>\r | |
230 | <target name="-init-defaults">\r | |
231 | <!--\r | |
232 | This property can be modified to change general build options\r | |
233 | such as excluding files from the set. The format expects newlines\r | |
234 | for each argument, for example:\r | |
235 | \r | |
236 | <property name="build.operations"/>\r | |
237 | exclude\r | |
238 | -namespace=Ext\r | |
239 | </property>\r | |
240 | -->\r | |
241 | <property name="build.operations" value=""/>\r | |
242 | \r | |
243 | <!--\r | |
244 | This property can be modified to change concatenation\r | |
245 | specific options\r | |
246 | \r | |
247 | -strip-comments: comment suppression\r | |
248 | -remove-text-references: transform string literal class references to objects\r | |
249 | -beautify: unpack the source\r | |
250 | \r | |
251 | <property name="build.concat.options"/>\r | |
252 | -strip-comments\r | |
253 | -remove-text-references\r | |
254 | -beautify\r | |
255 | </property>\r | |
256 | -->\r | |
257 | <property name="build.concat.options" value=""/>\r | |
258 | <property name="build.concat.debug.options" value=""/>\r | |
259 | \r | |
260 | <property name="build.pkg.manifest" value="pkg.files"/>\r | |
261 | </target>\r | |
262 | <target name="-after-init-defaults"/>\r | |
263 | \r | |
264 | <!--\r | |
265 | Initializes the compiler instances, reading in the app.json and package.json\r | |
266 | definitions, as well as scanning and parsing all js files found on the\r | |
267 | various classpath entries for the framework, workspace, packages, and app\r | |
268 | -->\r | |
269 | <target name="-init-compiler" depends="-init">\r | |
270 | <x-compile refid="${compiler.ref.id}" \r | |
271 | dir="${package.dir}" \r | |
272 | initOnly="true" \r | |
273 | inheritAll="true">\r | |
274 | <![CDATA[\r | |
275 | # base build command\r | |
276 | -tempDir=${build.compile.temp.dir}\r | |
277 | -keepTempDir=${build.compile.temp.dir.keep}\r | |
278 | include\r | |
279 | -all\r | |
280 | and\r | |
281 | save\r | |
282 | package-${package.name}-all\r | |
283 | ]]>\r | |
284 | </x-compile>\r | |
285 | </target>\r | |
286 | \r | |
287 | <target name="-init-web-server">\r | |
288 | <x-server port="${build.web.port}"\r | |
289 | portPropertyName="build.web.port"\r | |
290 | defaultSassFile="${package.example.scss}"\r | |
291 | defaultCssFile="${package.example.css}"\r | |
292 | refid="package.web.server">\r | |
293 | <mapping name="~cmd" path="${cmd.dir}"/>\r | |
294 | <mapping name="" path="${build.web.root}"/>\r | |
295 | </x-server>\r | |
296 | <x-echo>Package web server available at http://localhost:${build.web.port}</x-echo>\r | |
297 | </target>\r | |
298 | \r | |
299 | </project> |