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