| 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 release folder |
|---|
| 33 | --> |
|---|
| 34 | <target name="clean-release"> |
|---|
| 35 | <delete dir="${release.dir}" /> |
|---|
| 36 | </target> |
|---|
| 37 | |
|---|
| 38 | <!-- |
|---|
| 39 | Generate ASDoc output for the library |
|---|
| 40 | --> |
|---|
| 41 | <target name="asdoc-all" depends="check-properties"> |
|---|
| 42 | <!-- Clean out the contents of the doc directory, without delete "docs" --> |
|---|
| 43 | <!-- |
|---|
| 44 | <delete includeemptydirs="true"> |
|---|
| 45 | <fileset dir="${docs.dir}" includes="**/*" /> |
|---|
| 46 | </delete> |
|---|
| 47 | --> |
|---|
| 48 | |
|---|
| 49 | <exec executable="${asdoc.exe}" spawn="no"> |
|---|
| 50 | <!-- Place the documentation in the "docs" directory --> |
|---|
| 51 | <arg line="-output '${docs.dir}'" /> |
|---|
| 52 | |
|---|
| 53 | <!-- Specify the main source path as "src" --> |
|---|
| 54 | <arg line="-compiler.source-path '${src.dir}'" /> |
|---|
| 55 | |
|---|
| 56 | <!-- Include the necessary framework libraries in the class path --> |
|---|
| 57 | <arg line="-compiler.library-path '${flexsdk.lib.dir}'" /> |
|---|
| 58 | <arg line="-compiler.library-path '${flexunit.lib.dir}'" /> |
|---|
| 59 | <arg line="-compiler.library-path '${lib.dir}'" /> |
|---|
| 60 | |
|---|
| 61 | <!-- Document all of the classes in the "src" tree --> |
|---|
| 62 | <arg line="-doc-sources '${src.dir}' " /> |
|---|
| 63 | |
|---|
| 64 | <!-- Include the library name in the window title --> |
|---|
| 65 | <arg line="-window-title 'JW Player' " /> |
|---|
| 66 | |
|---|
| 67 | <!-- Ignore missing type declarations --> |
|---|
| 68 | <arg line="-warnings=false" /> |
|---|
| 69 | </exec> |
|---|
| 70 | |
|---|
| 71 | <exec executable="${browser}" spawn="yes"> |
|---|
| 72 | <arg line="'file://${docs.dir}/index.html'" /> |
|---|
| 73 | </exec> |
|---|
| 74 | </target> |
|---|
| 75 | |
|---|
| 76 | <target name="build-test"> |
|---|
| 77 | <exec executable="${amxmlc.exe}" dir="${basedir}"> |
|---|
| 78 | <!-- Point to the main class .as file --> |
|---|
| 79 | <arg line="'${test.dir}/PlayerTestLauncher.as'" /> |
|---|
| 80 | |
|---|
| 81 | <!-- Place the built .swf file in the "bin" directory --> |
|---|
| 82 | <arg line="-output '${basedir}/bin-test/PlayerTestLauncher.swf'" /> |
|---|
| 83 | |
|---|
| 84 | <!-- Define source directories for "src" and "tests" --> |
|---|
| 85 | <arg line="-compiler.source-path '${test.dir}'" /> |
|---|
| 86 | <arg line="-compiler.source-path '${src.dir}'" /> |
|---|
| 87 | |
|---|
| 88 | <!-- Include the necessary framework libraries in the class path --> |
|---|
| 89 | <arg line="-compiler.library-path '${flexsdk.lib.dir}'" /> |
|---|
| 90 | <arg line="-compiler.library-path '${flexunit.lib.dir}'" /> |
|---|
| 91 | <arg line="-compiler.library-path '${lib.dir}'" /> |
|---|
| 92 | |
|---|
| 93 | <!-- Include locale-specific items in the path --> |
|---|
| 94 | <arg line="-locale ${flexsdk.locale}" /> |
|---|
| 95 | <arg line="-compiler.library-path '${flexsdk.locale.dir}'" /> |
|---|
| 96 | |
|---|
| 97 | <!-- Compile with network sandbox --> |
|---|
| 98 | <arg line="-use-network=true" /> |
|---|
| 99 | |
|---|
| 100 | <!-- Ignore missing type definitions --> |
|---|
| 101 | <arg line="-warnings=false" /> |
|---|
| 102 | </exec> |
|---|
| 103 | <copy file="${test.dir}/PlayerTestLauncher-app.xml" tofile="${basedir}/bin-test/PlayerTestLauncher-app.xml" /> |
|---|
| 104 | </target> |
|---|
| 105 | |
|---|
| 106 | <target name="test-unit" depends="check-properties"> |
|---|
| 107 | <exec executable="${airDebugLauncher.exe}"> |
|---|
| 108 | <arg line="'${basedir}/bin-test/PlayerTestLauncher-app.xml'" /> |
|---|
| 109 | </exec> |
|---|
| 110 | </target> |
|---|
| 111 | |
|---|
| 112 | <target name="test-all"> |
|---|
| 113 | <exec executable="${flashDebugPlayer.exe}" spawn="yes"> |
|---|
| 114 | <arg line="'${debug.dir}/player.swf'" /> |
|---|
| 115 | </exec> |
|---|
| 116 | </target> |
|---|
| 117 | |
|---|
| 118 | <target name="build-swf"> |
|---|
| 119 | <condition property="debugLine" value="-debug=true" else=""> |
|---|
| 120 | <isset property="debug" /> |
|---|
| 121 | </condition> |
|---|
| 122 | <condition property="optimizeLine" value="-optimize=true" else=""> |
|---|
| 123 | <isset property="optimize" /> |
|---|
| 124 | </condition> |
|---|
| 125 | <condition property="incrementLine" value="-incremental=true" else=""> |
|---|
| 126 | <isset property="increment" /> |
|---|
| 127 | </condition> |
|---|
| 128 | <condition property="additionalArgLine" value="${additionalArgs}" else=""> |
|---|
| 129 | <isset property="additionalArgs" /> |
|---|
| 130 | </condition> |
|---|
| 131 | |
|---|
| 132 | <exec executable="${mxmlc.exe}" dir="${basedir}"> |
|---|
| 133 | <!-- Point to the main class .as file --> |
|---|
| 134 | <arg line="'${src.dir}/${package}/${class}.as'" /> |
|---|
| 135 | |
|---|
| 136 | <!-- Place the built .swf file in the "bin" directory --> |
|---|
| 137 | <arg line="-output '${outputPath}/${swf}.swf'" /> |
|---|
| 138 | |
|---|
| 139 | <!-- Define source directories for "src" and "tests" --> |
|---|
| 140 | <arg line="-compiler.source-path '${src.dir}'" /> |
|---|
| 141 | |
|---|
| 142 | <!-- Include the necessary framework libraries in the class path --> |
|---|
| 143 | <arg line="-compiler.library-path '${flexsdk.lib.dir}'" /> |
|---|
| 144 | <arg line="-compiler.library-path '${flexunit.lib.dir}'" /> |
|---|
| 145 | <arg line="-compiler.library-path '${lib.dir}'" /> |
|---|
| 146 | |
|---|
| 147 | <!-- Include locale-specific items in the path --> |
|---|
| 148 | <arg line="-locale ${flexsdk.locale}" /> |
|---|
| 149 | <arg line="-compiler.library-path '${flexsdk.locale.dir}'" /> |
|---|
| 150 | |
|---|
| 151 | <!-- Enable incremental compilation --> |
|---|
| 152 | <arg line="${incrementLine}" /> |
|---|
| 153 | |
|---|
| 154 | <!-- Optimize for size --> |
|---|
| 155 | <arg line="${optimizeLine}" /> |
|---|
| 156 | |
|---|
| 157 | <!-- Compile with network sandbox --> |
|---|
| 158 | <arg line="-use-network=true" /> |
|---|
| 159 | |
|---|
| 160 | <!-- Ignore missing type definitions --> |
|---|
| 161 | <arg line="-warnings=false" /> |
|---|
| 162 | |
|---|
| 163 | <!-- Allow additional arguments to be passed in as parameters --> |
|---|
| 164 | <arg value="${additionalArgLine}" /> |
|---|
| 165 | |
|---|
| 166 | <!-- Enable debugging --> |
|---|
| 167 | <arg line="${debugLine}" /> |
|---|
| 168 | |
|---|
| 169 | </exec> |
|---|
| 170 | </target> |
|---|
| 171 | |
|---|
| 172 | |
|---|
| 173 | <!-- |
|---|
| 174 | Compile the player in debug mode. |
|---|
| 175 | --> |
|---|
| 176 | <target name="debug-swf"> |
|---|
| 177 | <antcall target="build-swf"> |
|---|
| 178 | <param name="swf" value="${swf}" /> |
|---|
| 179 | <param name="class" value="${class}" /> |
|---|
| 180 | <param name="package" value="${package}" /> |
|---|
| 181 | <param name="debug" value="true" /> |
|---|
| 182 | <param name="increment" value="true"/> |
|---|
| 183 | <param name="outputPath" value="${debug.dir}"/> |
|---|
| 184 | </antcall> |
|---|
| 185 | |
|---|
| 186 | </target> |
|---|
| 187 | |
|---|
| 188 | <target name="release-swf"> |
|---|
| 189 | <condition property="additionalArgs" value="${additionalArgs}" else=""> |
|---|
| 190 | <isset property="additionalArgs" /> |
|---|
| 191 | </condition> |
|---|
| 192 | <antcall target="build-swf"> |
|---|
| 193 | <param name="swf" value="${swf}" /> |
|---|
| 194 | <param name="class" value="${class}" /> |
|---|
| 195 | <param name="package" value="${package}" /> |
|---|
| 196 | <param name="optimize" value="true" /> |
|---|
| 197 | <param name="outputPath" value="${release.dir}"/> |
|---|
| 198 | </antcall> |
|---|
| 199 | </target> |
|---|
| 200 | |
|---|
| 201 | <target name="build-debug-player" depends="check-properties"> |
|---|
| 202 | <antcall target="debug-swf"> |
|---|
| 203 | <param name="package" value="${application.package}" /> |
|---|
| 204 | <param name="class" value="${application.class}" /> |
|---|
| 205 | <param name="swf" value="player" /> |
|---|
| 206 | </antcall> |
|---|
| 207 | </target> |
|---|
| 208 | |
|---|
| 209 | <target name="build-release-player" depends="check-properties, clean-release"> |
|---|
| 210 | <antcall target="release-swf"> |
|---|
| 211 | <param name="package" value="${application.package}" /> |
|---|
| 212 | <param name="class" value="${application.class}" /> |
|---|
| 213 | <param name="swf" value="player" /> |
|---|
| 214 | </antcall> |
|---|
| 215 | </target> |
|---|
| 216 | |
|---|
| 217 | </project> |
|---|