| 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 | <include name="*.js" /> |
|---|
| 29 | </delete> |
|---|
| 30 | </target> |
|---|
| 31 | |
|---|
| 32 | <!-- |
|---|
| 33 | Clean out the test folder |
|---|
| 34 | --> |
|---|
| 35 | <target name="clean-test"> |
|---|
| 36 | <delete dir="${test.bin.dir}"> |
|---|
| 37 | <include name="*.swf" /> |
|---|
| 38 | </delete> |
|---|
| 39 | </target> |
|---|
| 40 | |
|---|
| 41 | <!-- |
|---|
| 42 | Clean out the release folder |
|---|
| 43 | --> |
|---|
| 44 | <target name="clean-release"> |
|---|
| 45 | <delete dir="${release.dir}"> |
|---|
| 46 | <include name="player.swf"/> |
|---|
| 47 | <include name="jwplayer.min.js"/> |
|---|
| 48 | </delete> |
|---|
| 49 | </target> |
|---|
| 50 | |
|---|
| 51 | <!-- |
|---|
| 52 | Generate ASDoc output for the library |
|---|
| 53 | --> |
|---|
| 54 | <target name="asdoc-all" depends="check-properties"> |
|---|
| 55 | <!-- Clean out the contents of the doc directory, without delete "docs" --> |
|---|
| 56 | |
|---|
| 57 | <delete includeemptydirs="true" failonerror="false"> |
|---|
| 58 | <fileset dir="${docs.dir}" includes="**/*" /> |
|---|
| 59 | </delete> |
|---|
| 60 | |
|---|
| 61 | <exec executable="${asdoc.exe}" dir="${basedir}" spawn="no"> |
|---|
| 62 | <!-- Place the documentation in the "docs" directory --> |
|---|
| 63 | <arg line="-output '${docs.dir}'" /> |
|---|
| 64 | |
|---|
| 65 | <!-- Specify the main source path as "src" --> |
|---|
| 66 | <arg line="-compiler.source-path '${src.dir}'" /> |
|---|
| 67 | <arg line="-compiler.source-path '${test.src.dir}'" /> |
|---|
| 68 | |
|---|
| 69 | <!-- Include the necessary framework libraries in the class path --> |
|---|
| 70 | <arg line="-compiler.library-path '${flexsdk.lib.dir}'" /> |
|---|
| 71 | <arg line="-compiler.library-path '${flexunit.lib.dir}'" /> |
|---|
| 72 | <arg line="-compiler.library-path '${lib.dir}'" /> |
|---|
| 73 | |
|---|
| 74 | <!-- Target minimum Flash Player --> |
|---|
| 75 | <arg line="-target-player=${flexsdk.target}" /> |
|---|
| 76 | |
|---|
| 77 | <!-- Document all of the classes in the "src" tree --> |
|---|
| 78 | <arg line="-doc-sources '${src.dir}' " /> |
|---|
| 79 | |
|---|
| 80 | <!-- Include the library name in the window title --> |
|---|
| 81 | <arg line="-window-title 'JW Player' " /> |
|---|
| 82 | |
|---|
| 83 | <!-- Ignore missing type declarations --> |
|---|
| 84 | <arg line="-warnings=false" /> |
|---|
| 85 | </exec> |
|---|
| 86 | </target> |
|---|
| 87 | |
|---|
| 88 | <target name="build-test-unit"> |
|---|
| 89 | <exec executable="${mxmlc.exe}" dir="${basedir}" failonerror="true"> |
|---|
| 90 | <!-- Point to the main class .as file --> |
|---|
| 91 | <arg line="'${test.src.dir}/${class}'" /> |
|---|
| 92 | |
|---|
| 93 | <!-- Place the built .swf file in the "bin" directory --> |
|---|
| 94 | <arg line="-output '${test.bin.dir}/${swf}'" /> |
|---|
| 95 | |
|---|
| 96 | <!-- Define source directories for "src" and "tests" --> |
|---|
| 97 | <arg line="-compiler.source-path '${test.src.dir}'" /> |
|---|
| 98 | <arg line="-compiler.source-path '${src.dir}'" /> |
|---|
| 99 | |
|---|
| 100 | <!-- Include the necessary framework libraries in the class path --> |
|---|
| 101 | <arg line="-compiler.library-path '${flexsdk.lib.dir}'" /> |
|---|
| 102 | <arg line="-compiler.library-path '${flexunit.lib.dir}'" /> |
|---|
| 103 | <arg line="-compiler.library-path '${lib.dir}'" /> |
|---|
| 104 | |
|---|
| 105 | <!-- Include locale-specific items in the path --> |
|---|
| 106 | <arg line="-locale ${flexsdk.locale}" /> |
|---|
| 107 | <arg line="-compiler.library-path '${flexsdk.locale.dir}'" /> |
|---|
| 108 | |
|---|
| 109 | <!-- Target a minimum flash player --> |
|---|
| 110 | <arg line="-target-player=${flexsdk.target}" /> |
|---|
| 111 | |
|---|
| 112 | <!-- Enable incremental compilation --> |
|---|
| 113 | <arg line="-incremental=true" /> |
|---|
| 114 | |
|---|
| 115 | <!-- Needed for Flex 4.x --> |
|---|
| 116 | <arg line="-static-link-runtime-shared-libraries=true" /> |
|---|
| 117 | |
|---|
| 118 | <!-- Compile with network sandbox --> |
|---|
| 119 | <arg line="-use-network=true" /> |
|---|
| 120 | |
|---|
| 121 | <!-- Ignore missing type definitions --> |
|---|
| 122 | <arg line="-warnings=false" /> |
|---|
| 123 | |
|---|
| 124 | <!-- Enable debugging --> |
|---|
| 125 | <arg line="-debug=true" /> |
|---|
| 126 | </exec> |
|---|
| 127 | <copy todir="${basedir}/bin-test/assets"> |
|---|
| 128 | <fileset dir="${test.src.dir}/assets" /> |
|---|
| 129 | </copy> |
|---|
| 130 | </target> |
|---|
| 131 | |
|---|
| 132 | <target name="build-test-unit-windowed"> |
|---|
| 133 | <antcall target="build-test-unit"> |
|---|
| 134 | <param name="swf" value="UnitTestWindowed.swf" /> |
|---|
| 135 | <param name="class" value="PlayerTest.mxml" /> |
|---|
| 136 | </antcall> |
|---|
| 137 | </target> |
|---|
| 138 | |
|---|
| 139 | <target name="build-test-unit-windowless"> |
|---|
| 140 | <antcall target="build-test-unit"> |
|---|
| 141 | <param name="swf" value="UnitTestWindowless.swf" /> |
|---|
| 142 | <param name="class" value="PlayerTest.mxml" /> |
|---|
| 143 | </antcall> |
|---|
| 144 | </target> |
|---|
| 145 | |
|---|
| 146 | <target name="test-unit-windowed" depends="clean-test,check-properties,build-debug-player,build-test-unit-windowed"> |
|---|
| 147 | <exec executable="${flashDebugPlayer.exe}" failonerror="true"> |
|---|
| 148 | <arg line="'${test.bin.dir}/UnitTestWindowed.swf'" /> |
|---|
| 149 | </exec> |
|---|
| 150 | </target> |
|---|
| 151 | |
|---|
| 152 | <target name="test-unit-windowless" depends="clean-test,check-properties,build-debug-player,build-test-unit-windowless"> |
|---|
| 153 | <exec executable="${flashDebugPlayer.exe}" failonerror="true"> |
|---|
| 154 | <arg line="'${test.bin.dir}/UnitTestWindowless.swf'" /> |
|---|
| 155 | </exec> |
|---|
| 156 | </target> |
|---|
| 157 | |
|---|
| 158 | <target name="test-all"> |
|---|
| 159 | <exec executable="${flashDebugPlayer.exe}" spawn="yes"> |
|---|
| 160 | <arg line="'${debug.dir}/player.swf'" /> |
|---|
| 161 | </exec> |
|---|
| 162 | </target> |
|---|
| 163 | |
|---|
| 164 | <target name="update-version"> |
|---|
| 165 | <exec executable="svn" failonerror="false" failifexecutionfails="false" dir="${basedir}" > |
|---|
| 166 | <arg value="up" /> |
|---|
| 167 | </exec> |
|---|
| 168 | <exec executable="bash" outputproperty="versionnumber" failonerror="false" failifexecutionfails="false" dir="${basedir}" resultproperty="execresult"> |
|---|
| 169 | <arg value="-c" /> |
|---|
| 170 | <arg value="echo '1+'`svn info | grep Revision | sed s\/Revision\\:\\ \/\/` | bc" /> |
|---|
| 171 | </exec> |
|---|
| 172 | <condition property="jsmatch" value="jwplayer\.version = '(.*)'\;" else="@%%@"> |
|---|
| 173 | <equals arg1="${execresult}" arg2="0" /> |
|---|
| 174 | </condition> |
|---|
| 175 | <condition property="flashmatch" value="protected static var _version\:String \= '(.*)';" else="@%%@"> |
|---|
| 176 | <equals arg1="${execresult}" arg2="0" /> |
|---|
| 177 | </condition> |
|---|
| 178 | <replaceregexp file="${basedir}/js/src/jwplayer.js" match="${jsmatch}" replace="jwplayer\.version \= '${application.majorversion}.${application.minorversion}.${versionnumber}';" byline="true"/> |
|---|
| 179 | <replaceregexp file="${basedir}/src/com/longtailvideo/jwplayer/player/PlayerVersion.as" match="${flashmatch}" replace="protected static var _version\:String \= '${application.majorversion}.${application.minorversion}.${versionnumber}';" byline="true"/> |
|---|
| 180 | <replace file="${basedir}/jwplayer.min.js" token=", logoConfig);" value=");" /> |
|---|
| 181 | </target> |
|---|
| 182 | |
|---|
| 183 | <target name="build-swf"> |
|---|
| 184 | <condition property="debugLine" value="-debug=true" else=""> |
|---|
| 185 | <isset property="debug" /> |
|---|
| 186 | </condition> |
|---|
| 187 | <condition property="optimizeLine" value="-optimize=true" else=""> |
|---|
| 188 | <isset property="optimize" /> |
|---|
| 189 | </condition> |
|---|
| 190 | <condition property="incrementLine" value="-incremental=true" else=""> |
|---|
| 191 | <isset property="increment" /> |
|---|
| 192 | </condition> |
|---|
| 193 | |
|---|
| 194 | <exec executable="${mxmlc.exe}" dir="${basedir}"> |
|---|
| 195 | <!-- Point to the main class .as file --> |
|---|
| 196 | <arg line="'${src.dir}/${package}/${class}.as'" /> |
|---|
| 197 | |
|---|
| 198 | <!-- Place the built .swf file in the "bin" directory --> |
|---|
| 199 | <arg line="-output '${outputPath}/${swf}.swf'" /> |
|---|
| 200 | |
|---|
| 201 | <!-- Define source directories for "src" and "tests" --> |
|---|
| 202 | <arg line="-compiler.source-path '${src.dir}'" /> |
|---|
| 203 | |
|---|
| 204 | <!-- Include the necessary framework libraries in the class path --> |
|---|
| 205 | <arg line="-compiler.library-path '${flexsdk.lib.dir}'" /> |
|---|
| 206 | <arg line="-compiler.library-path '${lib.dir}'" /> |
|---|
| 207 | |
|---|
| 208 | <arg line="-default-background-color=0x000000" /> |
|---|
| 209 | |
|---|
| 210 | <!-- Include locale-specific items in the path --> |
|---|
| 211 | <arg line="-locale ${flexsdk.locale}" /> |
|---|
| 212 | <arg line="-compiler.library-path '${flexsdk.locale.dir}'" /> |
|---|
| 213 | |
|---|
| 214 | <!-- Enable incremental compilation --> |
|---|
| 215 | <arg line="${incrementLine}" /> |
|---|
| 216 | |
|---|
| 217 | <!-- Needed for Flex 4.x --> |
|---|
| 218 | <arg line="-static-link-runtime-shared-libraries=true" /> |
|---|
| 219 | |
|---|
| 220 | <!-- Optimize for size --> |
|---|
| 221 | <arg line="${optimizeLine}" /> |
|---|
| 222 | |
|---|
| 223 | <!-- Target a minimum flash player --> |
|---|
| 224 | <arg line="-target-player=${flexsdk.target}" /> |
|---|
| 225 | |
|---|
| 226 | <!-- Compile with network sandbox --> |
|---|
| 227 | <arg line="-use-network=false" /> |
|---|
| 228 | |
|---|
| 229 | <!-- Ignore missing type definitions --> |
|---|
| 230 | <arg line="-warnings=false" /> |
|---|
| 231 | |
|---|
| 232 | <!-- Enable debugging --> |
|---|
| 233 | <arg line="${debugLine}" /> |
|---|
| 234 | |
|---|
| 235 | </exec> |
|---|
| 236 | </target> |
|---|
| 237 | |
|---|
| 238 | <target name="build-js"> |
|---|
| 239 | <concat destfile="${outputpath}"> |
|---|
| 240 | <fileset dir="${basedir}/js/src" includes="jwplayer.js" /> |
|---|
| 241 | <fileset dir="${basedir}/js/src/utils" includes="**/*.js" excludes="jwplayer.utils.extensionmap.js,jwplayer.utils.animations.js" /> |
|---|
| 242 | <fileset dir="${basedir}/js/src/utils" includes="jwplayer.utils.animations.js" /> |
|---|
| 243 | <fileset dir="${basedir}/js/src/utils" includes="jwplayer.utils.extensionmap.js" /> |
|---|
| 244 | <fileset dir="${basedir}/js/src/parsers" includes="jwplayer.utils.parsers.js" /> |
|---|
| 245 | <fileset dir="${basedir}/js/src/parsers" includes="**/*.js" excludes="jwplayer.utils.parsers.js" /> |
|---|
| 246 | <fileset dir="${basedir}/js/src/plugins" includes="**/*.js" /> |
|---|
| 247 | <fileset dir="${basedir}/js/src/api" includes="**/*.js" /> |
|---|
| 248 | <fileset dir="${basedir}/js/src/embed" includes="**/*.js" /> |
|---|
| 249 | <fileset dir="${basedir}/js/src/html5" includes="jwplayer.html5.js" /> |
|---|
| 250 | <fileset dir="${basedir}/js/src/html5" includes="jwplayer.html5.states.js" /> |
|---|
| 251 | <fileset dir="${basedir}/js/src/html5" includes="jwplayer.html5.events.js" /> |
|---|
| 252 | <fileset dir="${basedir}/js/src/html5" includes="jwplayer.html5.view.js" /> |
|---|
| 253 | <fileset dir="${basedir}/js/src/html5" includes="jwplayer.html5.*.js" excludes="jwplayer.html5.js,jwplayer.html5.states.js,jwplayer.html5.events.js,jwplayer.html5.api.js,jwplayer.html5.view.js" /> |
|---|
| 254 | <fileset dir="${basedir}/js/src/html5" includes="jwplayer.html5.api.js" /> |
|---|
| 255 | </concat> |
|---|
| 256 | </target> |
|---|
| 257 | |
|---|
| 258 | <!-- |
|---|
| 259 | Compile the player in debug mode. |
|---|
| 260 | --> |
|---|
| 261 | <target name="debug-swf"> |
|---|
| 262 | <antcall target="build-swf"> |
|---|
| 263 | <param name="swf" value="${swf}" /> |
|---|
| 264 | <param name="class" value="${class}" /> |
|---|
| 265 | <param name="package" value="${package}" /> |
|---|
| 266 | <param name="debug" value="true" /> |
|---|
| 267 | <param name="increment" value="true"/> |
|---|
| 268 | <param name="outputPath" value="${debug.dir}"/> |
|---|
| 269 | </antcall> |
|---|
| 270 | </target> |
|---|
| 271 | |
|---|
| 272 | <target name="debug-js"> |
|---|
| 273 | <antcall target="build-js"> |
|---|
| 274 | <param name="outputpath" value="${basedir}/js/bin-debug/jwplayer.js"/> |
|---|
| 275 | </antcall> |
|---|
| 276 | </target> |
|---|
| 277 | |
|---|
| 278 | <target name="release-swf"> |
|---|
| 279 | <condition property="additionalArgs" value="${additionalArgs}" else=""> |
|---|
| 280 | <isset property="additionalArgs" /> |
|---|
| 281 | </condition> |
|---|
| 282 | <antcall target="build-swf"> |
|---|
| 283 | <param name="swf" value="${swf}" /> |
|---|
| 284 | <param name="class" value="${class}" /> |
|---|
| 285 | <param name="package" value="${package}" /> |
|---|
| 286 | <param name="optimize" value="true" /> |
|---|
| 287 | <param name="outputPath" value="${basedir}"/> |
|---|
| 288 | </antcall> |
|---|
| 289 | </target> |
|---|
| 290 | |
|---|
| 291 | <target name="release-js"> |
|---|
| 292 | <antcall target="build-js"> |
|---|
| 293 | <param name="outputpath" value="${basedir}/jwplayer.min.js"/> |
|---|
| 294 | </antcall> |
|---|
| 295 | <replace file="${basedir}/jwplayer.min.js" token=", logoConfig);" value=");"/> |
|---|
| 296 | <java jar="${basedir}/build/yuicompressor-2.4.2.jar" fork="true"> |
|---|
| 297 | <arg line="'${basedir}/jwplayer.min.js'"/> |
|---|
| 298 | <arg line="-o '${basedir}/jwplayer.min.js'"/> |
|---|
| 299 | </java> |
|---|
| 300 | </target> |
|---|
| 301 | |
|---|
| 302 | <target name="build-debug-player" depends="check-properties, debug-js"> |
|---|
| 303 | <antcall target="debug-swf"> |
|---|
| 304 | <param name="package" value="${application.package}" /> |
|---|
| 305 | <param name="class" value="${application.class}" /> |
|---|
| 306 | <param name="swf" value="player" /> |
|---|
| 307 | </antcall> |
|---|
| 308 | </target> |
|---|
| 309 | |
|---|
| 310 | <target name="build-release-player" depends="check-properties, clean-release, debug-js, release-js"> |
|---|
| 311 | <antcall target="release-swf"> |
|---|
| 312 | <param name="package" value="${application.package}" /> |
|---|
| 313 | <param name="class" value="${application.class}" /> |
|---|
| 314 | <param name="swf" value="player" /> |
|---|
| 315 | </antcall> |
|---|
| 316 | </target> |
|---|
| 317 | |
|---|
| 318 | <target name="build-release-player-viral" depends="check-properties, clean-release"> |
|---|
| 319 | <replaceregexp file="${src.dir}/com/longtailvideo/jwplayer/model/PlayerConfig.as" match="protected var _plugins:String(.+);" replace='protected var _plugins:String = "viral-2d";' byline="true"/> |
|---|
| 320 | <antcall target="release-swf"> |
|---|
| 321 | <param name="package" value="${application.package}" /> |
|---|
| 322 | <param name="class" value="${application.class}" /> |
|---|
| 323 | <param name="swf" value="player-viral" /> |
|---|
| 324 | </antcall> |
|---|
| 325 | <replaceregexp file="${src.dir}/com/longtailvideo/jwplayer/model/PlayerConfig.as" match='protected var _plugins:String(.+);' replace='protected var _plugins:String = "";' byline="true" /> |
|---|
| 326 | </target> |
|---|
| 327 | |
|---|
| 328 | <!-- |
|---|
| 329 | Builds the player code library used by plugins |
|---|
| 330 | --> |
|---|
| 331 | <target name="build-lib" depends="build-release-player"> |
|---|
| 332 | <!-- Clean the SDK directory --> |
|---|
| 333 | <antcall target="clean-dir"> |
|---|
| 334 | <param name="clean-directory" value="${sdk.dir}"/> |
|---|
| 335 | </antcall> |
|---|
| 336 | |
|---|
| 337 | <!-- Build the library SWC --> |
|---|
| 338 | <exec executable="${compc.exe}" dir="${src.dir}"> |
|---|
| 339 | <arg line="-source-path ." /> |
|---|
| 340 | <arg line="-output '${sdk.dir}/lib/jwplayer-5-lib.swc'" /> |
|---|
| 341 | <!-- Include the necessary framework libraries in the class path --> |
|---|
| 342 | <arg line="-compiler.library-path '${flexsdk.lib.dir}'" /> |
|---|
| 343 | <arg line="-compiler.library-path '${lib.dir}'" /> |
|---|
| 344 | <!-- Target Flash Player --> |
|---|
| 345 | <arg line="-target-player=${flexsdk.target}" /> |
|---|
| 346 | <arg line="-include-classes com.longtailvideo.jwplayer.player.Player" /> |
|---|
| 347 | <arg line="-link-report='${sdk.dir}/jwplayer-5-classes.xml'" /> |
|---|
| 348 | </exec> |
|---|
| 349 | |
|---|
| 350 | <move file="${sdk.dir}/jwplayer-5-classes.xml" todir="${sdk.dir}/lib/" /> |
|---|
| 351 | </target> |
|---|
| 352 | |
|---|
| 353 | </project> |
|---|