]>
Commit | Line | Data |
---|---|---|
947f0963 TL |
1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <!-- | |
3 | ********************************** DO NOT EDIT ********************************** | |
4 | ||
5 | This file will be replaced during upgrades so DO NOT EDIT this file. If you need to | |
6 | adjust the process, reading and understanding this file is the first step. | |
7 | ||
8 | In most cases, the adjustments can be achieved by setting properties or providing one | |
9 | of the "hooks" in the form of a "-before-" or "-after-" target. Whenever possible, look | |
10 | for one of these solutions. | |
11 | ||
12 | Failing that, you can copy whole targets to your build.xml file and it will overrride | |
13 | the target provided here. Doing that can create problems for upgrading to newer | |
14 | versions of Cmd so it is not recommended but it will be easier to manage than editing | |
15 | this file in most cases. | |
16 | --> | |
17 | <project name="cmd-test"> | |
18 | <target name="-before-test-init"/> | |
19 | <target name="-test-init"> | |
20 | <condition property="environment.dir" value="${app.dir}"> | |
21 | <isset property="${app.dir}"/> | |
22 | </condition> | |
23 | ||
24 | <property name="environment.dir" value="${package.dir}"/> | |
25 | <property name="cmd-test.specs.dir" value="${environment.dir}/test/specs"/> | |
26 | <property name="cmd-test.specs.test-json" value="${cmd-test.specs.dir}/test.json"/> | |
27 | </target> | |
28 | <target name="-after-test-init"/> | |
29 | <target name="test-init" | |
30 | depends="init,-before-test-init,-test-init,-after-test-init"/> | |
31 | ||
32 | <target name="-before-test-console"/> | |
33 | <target name="-test-console" depends="test-bootstrap"> | |
34 | <echo>Launching Sencha Test Console</echo> | |
35 | <echo>using cmd.dir : ${cmd.dir}</echo> | |
36 | <x-sencha-command | |
37 | dir="cmd-test.specs.dir"> | |
38 | <property name="cmd-test.run.launch-browser" | |
39 | value="${cmd-test.run.launch-browser}"/> | |
40 | test | |
41 | console | |
42 | -configFile | |
43 | ${cmd-test.specs.test-json} | |
44 | </x-sencha-command> | |
45 | </target> | |
46 | <target name="-after-test-console"/> | |
47 | <target name="test-console" | |
48 | depends="test-init,-before-test-console,-test-console,-after-test-console" | |
49 | description="Run tests"/> | |
50 | ||
51 | <target name="-before-test-run"/> | |
52 | <target name="-test-run" depends="test-bootstrap"> | |
53 | <echo>Launching Sencha Test Runner</echo> | |
54 | <echo>using cmd.dir : ${cmd.dir}</echo> | |
55 | <x-sencha-command | |
56 | dir="cmd-test.specs.dir"> | |
57 | test | |
58 | run | |
59 | -configFile | |
60 | ${cmd-test.specs.test-json} | |
61 | </x-sencha-command> | |
62 | </target> | |
63 | <target name="-after-test-run"/> | |
64 | <target name="test-run" | |
65 | depends="test-init,-before-test-run,-test-run,-after-test-run" | |
66 | description="Run tests"/> | |
67 | ||
68 | ||
69 | <target name="-before-test-bootstrap"/> | |
70 | <target name="-test-bootstrap"> | |
71 | <local name="local.runner.dir"/> | |
72 | <local name="console.runner.dir"/> | |
73 | <local name="specfiles.list"/> | |
74 | <local name="base.path"/> | |
75 | ||
76 | <property name="local.runner.dir" value="${environment.dir}/test/local"/> | |
77 | <property name="console.runner.dir" value="${environment.dir}/test/specs"/> | |
78 | ||
79 | <property name="base.path" value="${local.runner.dir}"/> | |
80 | <property name="bootstrap.specs.file" value="../bootstrap-specs.js"/> | |
81 | ||
82 | <x-bootstrap file="${base.path}/../bootstrap.js" | |
83 | basedir="${base.path}" | |
84 | coreFilesFile="${base.path}/../bootstrap-files.js" | |
85 | classMetadataFile="${base.path}/../bootstrap-data.js" | |
86 | overridesFile="${base.path}/../bootstrap-data.js" | |
87 | includeBoot="true" | |
88 | includeManifest="true" | |
89 | includeCoreFiles="true" | |
90 | appendCoreFiles="false" | |
91 | includeMetadata="false" | |
92 | appendClassMetadata="false" | |
93 | appendOverrides="true" | |
94 | overrideExcludeTags=""> | |
95 | <![CDATA[ | |
96 | Ext.Boot.loadSync([ | |
97 | "../bootstrap-files.js", | |
98 | "../bootstrap-data.js", | |
99 | "../bootstrap-launch.js" | |
100 | ]); | |
101 | ]]> | |
102 | </x-bootstrap> | |
103 | ||
104 | <!-- | |
105 | for the local runner, we also need to include all spec files in the bootstrap | |
106 | info | |
107 | --> | |
108 | <x-script-def name="x-load-specs"> | |
109 | <attribute name="base"/> | |
110 | <attribute name="property"/> | |
111 | <attribute name="configprop"/> | |
112 | <script src="${cmd.dir}/ant/ant-util.js"/> | |
113 | <![CDATA[ | |
114 | importPackage(com.sencha.util); | |
115 | importPackage(com.sencha.logging); | |
116 | var logger = SenchaLogManager.getLogger(), | |
117 | specDir = project.getProperty('cmd-test.specs.dir') + '', | |
118 | propName = attributes.get("property") + '', | |
119 | basePath = attributes.get("base") + '', | |
120 | configPropName = attributes.get("configprop"), | |
121 | config = readConfig(joinPath(specDir, 'test.json')), | |
122 | getScriptFiles = function(path, basePath) { | |
123 | var converted = [], | |
124 | files = FileUtil.getAllFilesByExtension(path, ".js"), | |
125 | length = files.size(), file, f, | |
126 | relPath; | |
127 | for(f = 0; f < length; f++) { | |
128 | file = files.get(f); | |
129 | logger.debug("getting relpath from {} to {}", basePath, file); | |
130 | relPath = PathUtil.getRelativePath(basePath, file); | |
131 | relPath = PathUtil.convertPathCharsToUnix(relPath); | |
132 | converted.push('"' + relPath + '"'); | |
133 | } | |
134 | return converted; | |
135 | }, | |
136 | files = config[configPropName] || [], | |
137 | len = files.length, file, f, | |
138 | relPath, | |
139 | converted = []; | |
140 | ||
141 | for(f = 0; f < len; f++) { | |
142 | file = files[f]; | |
143 | if(!PathUtil.isAbsolute(file)) { | |
144 | file = PathUtil.join(specDir, file); | |
145 | } | |
146 | file = PathUtil.getCanonicalPath(file); | |
147 | converted = converted.concat(getScriptFiles(file, basePath)); | |
148 | } | |
149 | project.setNewProperty(propName, StringUtil.join(converted, ',\n')); | |
150 | ]]> | |
151 | </x-script-def> | |
152 | <x-load-specs base="${local.runner.dir}" property="specfiles.list" configprop="specs"/> | |
153 | <echo file="${local.runner.dir}/${bootstrap.specs.file}"><![CDATA[ | |
154 | Ext.Boot.load({ | |
155 | charset: "UTF-8", | |
156 | url: [ | |
157 | ${specfiles.list} | |
158 | ], | |
159 | success: function() { | |
160 | Ext.Boot.load('../start-tests.js'); | |
161 | } | |
162 | }); | |
163 | ]]> | |
164 | </echo> | |
165 | </target> | |
166 | <target name="-after-test-bootstrap"/> | |
167 | <target name="test-bootstrap" | |
168 | depends="test-init,-before-test-bootstrap,-test-bootstrap,-after-test-bootstrap" | |
169 | description="Re-generate the bootstrap info for local and console test harnesses"/> | |
170 | ||
171 | </project> |