]>
Commit | Line | Data |
---|---|---|
c4685c84 TL |
1 | <project name="packager-impl"> |
2 | <macrodef name="x-run-mobile-packager"> | |
3 | <attribute name="configfile"/> | |
4 | <attribute name="action"/> | |
5 | <sequential> | |
6 | <echo>Running mobile packager action @{action} on file @{configFile}</echo> | |
7 | <x-sencha-command dir="${app.dir}" inheritall="true"> | |
8 | <![CDATA[ | |
9 | app | |
10 | package | |
11 | @{action} | |
12 | -path=@{configfile} | |
13 | ]]> | |
14 | </x-sencha-command> | |
15 | </sequential> | |
16 | </macrodef> | |
17 | ||
18 | ||
19 | <macrodef name="x-run-mobile-packager-config"> | |
20 | <attribute name="config"/> | |
21 | <attribute name="run" default="${args.autorun}"/> | |
22 | <sequential> | |
23 | <if> | |
24 | <not> | |
25 | <available file="@{config}"/> | |
26 | </not> | |
27 | <then> | |
28 | <!-- | |
29 | if the input packager config file for stbuild is | |
30 | not available, then create it | |
31 | --> | |
32 | <echo><![CDATA[ | |
33 | Creating default mobile packager config file at : | |
34 | @{config} | |
35 | ]]></echo> | |
36 | <x-run-mobile-packager | |
37 | configfile="@{config}" | |
38 | action="generate"/> | |
39 | </then> | |
40 | </if> | |
41 | ||
42 | <local name="local.build.mobile.out.dir"/> | |
43 | <local name="local.build.mobile.config.name"/> | |
44 | ||
45 | <!-- | |
46 | append the current config file name to the output directory | |
47 | for mobile packages. this allows multiple config outputs to | |
48 | be sandboxed by the name of the config file in the mobile | |
49 | package output directory. | |
50 | --> | |
51 | <basename file="@{config}" property="local.build.mobile.config.name"/> | |
52 | <property name="local.build.mobile.out.dir" | |
53 | value="${build.mobile.packager.out.dir}/${local.build.mobile.config.name}"/> | |
54 | ||
55 | <!-- | |
56 | duplicate the config file, so that we can set the | |
57 | input and output properties w/o losing comment blocks | |
58 | --> | |
59 | <x-set-json-property file="@{config}" | |
60 | tofile="${build.mobile.packager.temp.file}"> | |
61 | <property name="inputPath" | |
62 | value="${build.mobile.packager.in.dir}"/> | |
63 | <property name="outputPath" | |
64 | value="${local.build.mobile.out.dir}"/> | |
65 | </x-set-json-property> | |
66 | ||
67 | <echo><![CDATA[ | |
68 | Processing Mobile Packager config file | |
69 | config: @{config} | |
70 | inputPath: ${build.mobile.packager.in.dir} | |
71 | outputPath: ${local.build.mobile.out.dir} | |
72 | ]]></echo> | |
73 | ||
74 | <local name="mobile.packager.platform"/> | |
75 | ||
76 | <x-load-properties file="${build.mobile.packager.temp.file}" | |
77 | prefix="mobile.packager" | |
78 | required="true"/> | |
79 | ||
80 | <if> | |
81 | <contains string="${mobile.packager.platform}" substring="iOS"/> | |
82 | <then> | |
83 | <copy todir="${build.dir}"> | |
84 | <fileset dir="${app.dir}/resources/icons" includes="**/*"/> | |
85 | <fileset dir="${app.dir}/resources/loading" includes="**/*"/> | |
86 | </copy> | |
87 | </then> | |
88 | </if> | |
89 | ||
90 | <local name="build.mobile.action"/> | |
91 | <condition property="build.mobile.action" value="run"> | |
92 | <x-is-true value="@{run}"/> | |
93 | </condition> | |
94 | <property name="build.mobile.action" value="build"/> | |
95 | ||
96 | <x-run-mobile-packager | |
97 | configFile="${build.mobile.packager.temp.file}" | |
98 | action="${build.mobile.action}"/> | |
99 | </sequential> | |
100 | </macrodef> | |
101 | ||
102 | <target name="-native-package-mobile"> | |
103 | <if> | |
104 | <x-is-true value="${args.autorun}"/> | |
105 | <then> | |
106 | <echo>Running default mobile packager config.</echo> | |
107 | <x-run-mobile-packager-config config="${build.mobile.packager.default.file}" | |
108 | run="true"/> | |
109 | </then> | |
110 | <else> | |
111 | <echo>Building all specified mobile packager configs.</echo> | |
112 | <for param="configfile" list="${build.mobile.packager.file}"> | |
113 | <sequential> | |
114 | <x-run-mobile-packager-config config="@{configfile}" run="false"/> | |
115 | </sequential> | |
116 | </for> | |
117 | </else> | |
118 | </if> | |
119 | </target> | |
120 | ||
121 | <target name="-before-native-package"/> | |
122 | <target name="-native-package" | |
123 | depends="-native-package-mobile"> | |
124 | </target> | |
125 | <target name="-after-native-package"/> | |
126 | ||
127 | </project> |