| 1 | <?xml version="1.0"?> |
|---|
| 2 | <project name="jwplayer" basedir="../" default="build-release-player"> |
|---|
| 3 | <!-- Define variables/paths used in this build script --> |
|---|
| 4 | <property file="./build/build.properties" /> |
|---|
| 5 | |
|---|
| 6 | <!-- |
|---|
| 7 | Have you edit the properties file to make sure the paths are right oo your system? |
|---|
| 8 | --> |
|---|
| 9 | <target name="check-properties"> |
|---|
| 10 | <fail unless="asdoc.exe">The "asdoc.exe" property must be set in ${build.dir}/build.properties.</fail> |
|---|
| 11 | <fail unless="compc.exe">The "compc.exe" property must be set in ${build.dir}/build.properties.</fail> |
|---|
| 12 | <fail unless="mxmlc.exe">The "mxmlc.exe" property must be set in ${build.dir}/build.properties.</fail> |
|---|
| 13 | <fail unless="flexunit.lib.dir">The "flexunit.lib.dir" property must be set in ${build.dir}/build.properties.</fail> |
|---|
| 14 | </target> |
|---|
| 15 | |
|---|
| 16 | <!-- Clean out a directory --> |
|---|
| 17 | <target name="clean-dir"> |
|---|
| 18 | <delete dir="${clean-directory}" /> |
|---|
| 19 | <mkdir dir="${clean-directory}" /> |
|---|
| 20 | </target> |
|---|
| 21 | |
|---|
| 22 | <!-- |
|---|
| 23 | Clean out the debug folder |
|---|
| 24 | --> |
|---|
| 25 | <target name="clean-debug"> |
|---|
| 26 | <delete dir="${debug.dir}"> |
|---|
| 27 | <include name="*.swf" /> |
|---|
| 28 | </delete> |
|---|
| 29 | </target> |
|---|
| 30 | |
|---|
| 31 | <!-- |
|---|
| 32 | Clean out the test folder |
|---|
| 33 | --> |
|---|
| 34 | <target name="clean-test"> |
|---|
| 35 | <delete dir="${test.bin.dir}"> |
|---|
| 36 | <include name="*.swf" /> |
|---|
| 37 | </delete> |
|---|
| 38 | </target> |
|---|
| 39 | |
|---|
| 40 | <!-- |
|---|
| 41 | Clean out the release folder |
|---|
| 42 | --> |
|---|
| 43 | <target name="clean-release"> |
|---|
| 44 | <delete dir="${release.dir}" /> |
|---|
| 45 | </target> |
|---|
| 46 | |
|---|
| 47 | <!-- |
|---|
| 48 | Generate ASDoc output for the library |
|---|
| 49 | --> |
|---|
| 50 | <target name="asdoc-all" depends="check-properties"> |
|---|
| 51 | <!-- Clean out the contents of the doc directory, without delete "docs" --> |
|---|
| 52 | <!-- |
|---|
| 53 | <delete includeemptydirs="true"> |
|---|
| 54 | <fileset dir="${docs.dir}" includes="**/*" /> |
|---|
| 55 | </delete> |
|---|
| 56 | --> |
|---|
| 57 | |
|---|
| 58 | <exec executable="${asdoc.exe}" spawn="no"> |
|---|
| 59 | <!-- Place the documentation in the "docs" directory --> |
|---|
| 60 | <arg line="-output '${docs.dir}'" /> |
|---|
| 61 | |
|---|
| 62 | <!-- Specify the main source path as "src" --> |
|---|
| 63 | <arg line="-compiler.source-path '${src.dir}'" /> |
|---|
| 64 | |
|---|
| 65 | <!-- Include the necessary framework libraries in the class path --> |
|---|
| 66 | <arg line="-compiler.library-path '${flexsdk.lib.dir}'" /> |
|---|
| 67 | <arg line="-compiler.library-path '${flexunit.lib.dir}'" /> |
|---|
| 68 | <arg line="-compiler.library-path '${lib.dir}'" /> |
|---|
| 69 | |
|---|
| 70 | <!-- Document all of the classes in the "src" tree --> |
|---|
| 71 | <arg line="-doc-sources '${src.dir}' " /> |
|---|
| 72 | |
|---|
| 73 | <!-- Include the library name in the window title --> |
|---|
| 74 | <arg line="-window-title 'JW Player' " /> |
|---|
| 75 | |
|---|
| 76 | <!-- Ignore missing type declarations --> |
|---|
| 77 | <arg line="-warnings=false" /> |
|---|
| 78 | </exec> |
|---|
| 79 | |
|---|
| 80 | <exec executable="${browser}" spawn="yes"> |
|---|
| 81 | <arg line="'file://${docs.dir}/index.html'" /> |
|---|
| 82 | </exec> |
|---|
| 83 | </target> |
|---|
| 84 | |
|---|
| 85 | <target name="build-test"> |
|---|
| 86 | <exec executable="${amxmlc.exe}" dir="${basedir}" failonerror="true"> |
|---|
| 87 | <!-- Point to the main class .as file --> |
|---|
| 88 | <arg line="'${test.src.dir}/PlayerTest.mxml'" /> |
|---|
| 89 | |
|---|
| 90 | <!-- Place the built .swf file in the "bin" directory --> |
|---|
| 91 | <arg line="-output '${test.bin.dir}/PlayerTestLauncher.swf'" /> |
|---|
| 92 | |
|---|
| 93 | <!-- Define source directories for "src" and "tests" --> |
|---|
| 94 | <arg line="-compiler.source-path '${test.src.dir}'" /> |
|---|
| 95 | <arg line="-compiler.source-path '${src.dir}'" /> |
|---|
| 96 | |
|---|
| 97 | <!-- Include the necessary framework libraries in the class path --> |
|---|
| 98 | <arg line="-compiler.library-path '${flexsdk.lib.dir}'" /> |
|---|
| 99 | <arg line="-compiler.library-path '${airsdk.lib.dir}'" /> |
|---|
| 100 | <arg line="-compiler.library-path '${flexunit.lib.dir}'" /> |
|---|
| 101 | <arg line="-compiler.library-path '${lib.dir}'" /> |
|---|
| 102 | |
|---|
| 103 | <!-- Include locale-specific items in the path --> |
|---|
| 104 | <arg line="-locale ${flexsdk.locale}" /> |
|---|
| 105 | <arg line="-compiler.library-path '${flexsdk.locale.dir}'" /> |
|---|
| 106 | |
|---|
| 107 | <!-- Enable incremental compilation --> |
|---|
| 108 | <arg line="-incremental=true" /> |
|---|
| 109 | |
|---|
| 110 | <!-- Compile with network sandbox --> |
|---|
| 111 | <arg line="-use-network=true" /> |
|---|
| 112 | |
|---|
| 113 | <!-- Ignore missing type definitions --> |
|---|
| 114 | <arg line="-warnings=false" /> |
|---|
| 115 | </exec> |
|---|
| 116 | <copy file="${test.src.dir}/PlayerTestLauncher-app.xml" tofile="${test.bin.dir}/PlayerTestLauncher-app.xml" /> |
|---|
| 117 | <copy todir="${basedir}/bin-test/assets"> |
|---|
| 118 | <fileset dir="${test.src.dir}/assets" /> |
|---|
| 119 | </copy> |
|---|
| 120 | </target> |
|---|
| 121 | |
|---|
| 122 | <target name="test-unit-windowless"> |
|---|
| 123 | <antcall target="test-unit"> |
|---|
| 124 | <param name="windowless" value="true"/> |
|---|
| 125 | <param name="outputPath" value="${test.bin.dir}/test-results.xml"/> |
|---|
| 126 | </antcall> |
|---|
| 127 | </target> |
|---|
| 128 | |
|---|
| 129 | <target name="test-unit" depends="clean-test,check-properties,build-debug-player,build-test"> |
|---|
| 130 | <copy file="${debug.dir}/player.swf" tofile="${test.bin.dir}/player.swf" /> |
|---|
| 131 | <condition property="windowlessLine" value="-- windowless" else=""> |
|---|
| 132 | <isset property="windowless" /> |
|---|
| 133 | </condition> |
|---|
| 134 | <condition property="outputLine" value="-- 'outputpath=${outputPath}'" else=""> |
|---|
| 135 | <isset property="outputPath" /> |
|---|
| 136 | </condition> |
|---|
| 137 | <exec executable="${airDebugLauncher.exe}" failonerror="true"> |
|---|
| 138 | <arg line="'${test.bin.dir}/PlayerTestLauncher-app.xml'" /> |
|---|
| 139 | |
|---|
| 140 | <!-- Enable windowless run --> |
|---|
| 141 | <arg line="${windowlessLine}" /> |
|---|
| 142 | |
|---|
| 143 | <!-- Set output path --> |
|---|
| 144 | <arg line="${outputLine}" /> |
|---|
| 145 | </exec> |
|---|
| 146 | </target> |
|---|
| 147 | |
|---|
| 148 | <target name="test-all"> |
|---|
| 149 | <exec executable="${flashDebugPlayer.exe}" spawn="yes"> |
|---|
| 150 | <arg line="'${debug.dir}/player.swf'" /> |
|---|
| 151 | </exec> |
|---|
| 152 | </target> |
|---|
| 153 | |
|---|
| 154 | <target name="build-swf"> |
|---|
| 155 | <condition property="debugLine" value="-debug=true" else=""> |
|---|
| 156 | <isset property="debug" /> |
|---|
| 157 | </condition> |
|---|
| 158 | <condition property="optimizeLine" value="-optimize=true" else=""> |
|---|
| 159 | <isset property="optimize" /> |
|---|
| 160 | </condition> |
|---|
| 161 | <condition property="incrementLine" value="-incremental=true" else=""> |
|---|
| 162 | <isset property="increment" /> |
|---|
| 163 | </condition> |
|---|
| 164 | <condition property="additionalArgLine" value="${additionalArgs}" else=""> |
|---|
| 165 | <isset property="additionalArgs" /> |
|---|
| 166 | </condition> |
|---|
| 167 | |
|---|
| 168 | <exec executable="${mxmlc.exe}" dir="${basedir}"> |
|---|
| 169 | <!-- Point to the main class .as file --> |
|---|
| 170 | <arg line="'${src.dir}/${package}/${class}.as'" /> |
|---|
| 171 | |
|---|
| 172 | <!-- Place the built .swf file in the "bin" directory --> |
|---|
| 173 | <arg line="-output '${outputPath}/${swf}.swf'" /> |
|---|
| 174 | |
|---|
| 175 | <!-- Define source directories for "src" and "tests" --> |
|---|
| 176 | <arg line="-compiler.source-path '${src.dir}'" /> |
|---|
| 177 | |
|---|
| 178 | <!-- Include the necessary framework libraries in the class path --> |
|---|
| 179 | <arg line="-compiler.library-path '${flexsdk.lib.dir}'" /> |
|---|
| 180 | <arg line="-compiler.library-path '${flexunit.lib.dir}'" /> |
|---|
| 181 | <arg line="-compiler.library-path '${lib.dir}'" /> |
|---|
| 182 | |
|---|
| 183 | <!-- Include locale-specific items in the path --> |
|---|
| 184 | <arg line="-locale ${flexsdk.locale}" /> |
|---|
| 185 | <arg line="-compiler.library-path '${flexsdk.locale.dir}'" /> |
|---|
| 186 | |
|---|
| 187 | <!-- Enable incremental compilation --> |
|---|
| 188 | <arg line="${incrementLine}" /> |
|---|
| 189 | |
|---|
| 190 | <!-- Optimize for size --> |
|---|
| 191 | <arg line="${optimizeLine}" /> |
|---|
| 192 | |
|---|
| 193 | <!-- Compile with network sandbox --> |
|---|
| 194 | <arg line="-use-network=true" /> |
|---|
| 195 | |
|---|
| 196 | <!-- Ignore missing type definitions --> |
|---|
| 197 | <arg line="-warnings=false" /> |
|---|
| 198 | |
|---|
| 199 | <!-- Allow additional arguments to be passed in as parameters --> |
|---|
| 200 | <arg value="${additionalArgLine}" /> |
|---|
| 201 | |
|---|
| 202 | <!-- Enable debugging --> |
|---|
| 203 | <arg line="${debugLine}" /> |
|---|
| 204 | |
|---|
| 205 | </exec> |
|---|
| 206 | </target> |
|---|
| 207 | |
|---|
| 208 | |
|---|
| 209 | <!-- |
|---|
| 210 | Compile the player in debug mode. |
|---|
| 211 | --> |
|---|
| 212 | <target name="debug-swf"> |
|---|
| 213 | <antcall target="build-swf"> |
|---|
| 214 | <param name="swf" value="${swf}" /> |
|---|
| 215 | <param name="class" value="${class}" /> |
|---|
| 216 | <param name="package" value="${package}" /> |
|---|
| 217 | <param name="debug" value="true" /> |
|---|
| 218 | <param name="increment" value="true"/> |
|---|
| 219 | <param name="outputPath" value="${debug.dir}"/> |
|---|
| 220 | </antcall> |
|---|
| 221 | |
|---|
| 222 | </target> |
|---|
| 223 | |
|---|
| 224 | <target name="release-swf"> |
|---|
| 225 | <condition property="additionalArgs" value="${additionalArgs}" else=""> |
|---|
| 226 | <isset property="additionalArgs" /> |
|---|
| 227 | </condition> |
|---|
| 228 | <antcall target="build-swf"> |
|---|
| 229 | <param name="swf" value="${swf}" /> |
|---|
| 230 | <param name="class" value="${class}" /> |
|---|
| 231 | <param name="package" value="${package}" /> |
|---|
| 232 | <param name="optimize" value="true" /> |
|---|
| 233 | <param name="outputPath" value="${release.dir}"/> |
|---|
| 234 | </antcall> |
|---|
| 235 | </target> |
|---|
| 236 | |
|---|
| 237 | <target name="build-debug-player" depends="check-properties"> |
|---|
| 238 | <antcall target="debug-swf"> |
|---|
| 239 | <param name="package" value="${application.package}" /> |
|---|
| 240 | <param name="class" value="${application.class}" /> |
|---|
| 241 | <param name="swf" value="player" /> |
|---|
| 242 | </antcall> |
|---|
| 243 | </target> |
|---|
| 244 | |
|---|
| 245 | <target name="build-release-player" depends="check-properties, clean-release"> |
|---|
| 246 | <antcall target="release-swf"> |
|---|
| 247 | <param name="package" value="${application.package}" /> |
|---|
| 248 | <param name="class" value="${application.class}" /> |
|---|
| 249 | <param name="swf" value="player" /> |
|---|
| 250 | </antcall> |
|---|
| 251 | </target> |
|---|
| 252 | |
|---|
| 253 | </project> |
|---|