| 53 | | build targets: |
| 54 | | clean - deletes all files in the ${release_dir} directory |
| 55 | | |
| 56 | | website - copies website files into the correct location and sets |
| 57 | | permissions correctly |
| 58 | | |
| 59 | | compress - copies the files in ${root}/${src} to the |
| 60 | | ${release_dir}/${project}/${src} directory where it |
| 61 | | compresses all the .js files with a set of regular |
| 62 | | expressions and removes all non .js files |
| 63 | | |
| 64 | | gen-strip-docs - Strips out most comments,line feeds,etc in ALL js found |
| 65 | | in the genereated ${release_dir}. |
| 66 | | |
| 67 | | src - Take ./${src} and build the ${release_dir}/${project}/${src}_src |
| 68 | | directory. More or less a copy of the source files, documentation and |
| 69 | | all. |
| 70 | | |
| 71 | | docs - builds documentation in all formats from ./${src} and place it in ${release_docs_dir} |
| 72 | | |
| 73 | | api - builds release (optimized) api reference application |
| 74 | | |
| 75 | | cldr - transforms the CLDR localization repository into JSON in the source tree |
| 76 | | |
| 77 | | test - builds and runs command line unit tests |
| 78 | | |
| 79 | | testScripting - tests the JS integration in the build process |
| 80 | | |
| 81 | | buildFlash - compiles a Flash ActionScript 2 file to use dojo.flash.comm; provide |
| 82 | | relative path to file using -Ddojo.flash.file. |
| 83 | | |
| 84 | | buildDojoFlash - compiles the dojo.flash package, including its testing |
| 85 | | and example files. |
| 86 | | |
| 87 | | buildDojoStorage - compiles the dojo.storage package |
| 88 | | |
| 89 | | **** all following build types can take an optional parameter in the form of: -Dversion='currentVer' |
| 90 | | where 'currentVer' is the version of ${project} being built, default is 'development' |
| 91 | | |
| 92 | | zip - zips the ${release_dir}/${project} directory for distribution |
| 93 | | tar - tars and gzips the ${release_dir}/${project} directory for distribution |
| 94 | | release - creates a full release of ${project} |
| 95 | | |
| 96 | | full build example: |
| 97 | | ant -Dversion=0.3.0 clean release |
| 98 | | |
| 99 | | build example with tarball: |
| 100 | | ant -Dversion=0.3.0 clean compress tar |
| 101 | | |
| 102 | | just generate documentation: |
| 103 | | ant -Dversion=0.3.0 clean docs |
| 104 | | |
| 105 | | full build, but without docs: |
| 106 | | ant -Dversion=0.3.0 clean release gen-strip-docs |
| 107 | | |
| | 32 | See http://dojotoolkit.org/node/19 for more information. |
| 391 | | <!-- clean task --> |
| 392 | | <target name="clean" |
| 393 | | description="removes release files"> |
| 394 | | <delete dir="${release_dir}"/> |
| 395 | | </target> |
| 396 | | <!-- end clean task --> |
| 397 | | |
| 398 | | <!-- gen-strip-docs task --> |
| 399 | | <target name="gen-strip-docs"> |
| 400 | | |
| 401 | | <!-- strip /* */ (multiline) comments --> |
| 402 | | <replaceregexp match="\/\*(.*?)\*\/" replace="" byline="false" flags="sg"> |
| 403 | | <fileset dir="${release_dir}" includes="**/*.js"/> |
| 404 | | </replaceregexp> |
| 405 | | |
| 406 | | <!-- strip // comments --> |
| 407 | | <replaceregexp match="^\/\/.*$" byline="true" replace="" flags="g"> |
| 408 | | <fileset dir="${release_dir}" includes="**/*.js" /> |
| 409 | | </replaceregexp> |
| 410 | | <replaceregexp byline="false" flags="g"> |
| 411 | | <regexp pattern="([^:(".'\\-][^:C0-9"(\\])(\/\/.*)" /> |
| 412 | | <substitution expression="\1" /> |
| 413 | | <fileset dir="${release_dir}" includes="**/*.js" /> |
| 414 | | </replaceregexp> |
| 415 | | <replaceregexp match="\s\/\/.*$" byline="true" replace="" flags="g"> |
| 416 | | <fileset dir="${release_dir}" includes="**/*.js" /> |
| 417 | | </replaceregexp> |
| 418 | | |
| 419 | | <replaceregexp match="^[ \t]+|[ \t]+$" replace="" byline="false" flags="mg"> |
| 420 | | <fileset dir="${release_dir}" includes="**/*.js" /> |
| 421 | | </replaceregexp> |
| 422 | | |
| 423 | | <!-- clobber leading and trailing DocBook comment --> |
| 424 | | <replaceregexp match="^<\!--" replace="" byline="false" flags="g"> |
| 425 | | <fileset dir="${release_dir}" includes="**/*.js"/> |
| 426 | | </replaceregexp> |
| 427 | | <replaceregexp match="-->$" replace="" byline="false" flags="g"> |
| 428 | | <fileset dir="${release_dir}" includes="**/*.js"/> |
| 429 | | </replaceregexp> |
| 430 | | |
| 431 | | <replaceregexp match="(\r)" replace="" byline="false" flags="g"> |
| 432 | | <fileset dir="${release_dir}" includes="**/*.js"/> |
| 433 | | </replaceregexp> |
| 434 | | |
| 435 | | <replaceregexp match="\n+" replace="NWNEWLINEHERE" byline="false" flags="g"> |
| 436 | | <fileset dir="${release_dir}" includes="**/*.js"/> |
| 437 | | </replaceregexp> |
| 438 | | |
| 439 | | <!-- add copyright notice --> |
| 440 | | <!-- |
| 441 | | <replaceregexp match="^" byline="false" replace="${copyright}"> |
| 442 | | <fileset dir="${destdir}"> |
| 443 | | <include name="**/*.js" /> |
| 444 | | <include name="**/*.as" /> |
| 445 | | <not> |
| 446 | | <contains text="copyright" casesensitive="no" /> |
| 447 | | </not> |
| 448 | | </fileset> |
| 449 | | </replaceregexp> |
| 450 | | --> |
| 451 | | |
| 452 | | <replace dir="${release_dir}"> |
| 453 | | <include name="**/*.js"/> |
| 454 | | <replacetoken>NWNEWLINEHERE</replacetoken> |
| 455 | | <replacevalue> |
| 456 | | <![CDATA[ |
| 457 | | ]]> |
| 458 | | </replacevalue> |
| 459 | | </replace> |
| 460 | | |
| 461 | | <replaceregexp match=";\n*" replace=";" byline="false" flags="g"> |
| 462 | | <fileset dir="${release_dir}" includes="**/*.js"/> |
| 463 | | </replaceregexp> |
| 464 | | <replaceregexp match="\{(\s*)\n" replace="\{" byline="false" flags="g"> |
| 465 | | <fileset dir="${release_dir}" includes="**/*.js"/> |
| 466 | | </replaceregexp> |
| 467 | | <replaceregexp match=",(\n)" replace="," byline="false" flags="g"> |
| 468 | | <fileset dir="${release_dir}" includes="**/*.js"/> |
| 469 | | </replaceregexp> |
| 470 | | <replaceregexp match="}(\n*)(\t*)\s*}" replace="}}" byline="false" flags="g"> |
| 471 | | <fileset dir="${release_dir}" includes="**/*.js"/> |
| 472 | | </replaceregexp> |
| 473 | | <replaceregexp match="\n*}" replace="}" byline="false" flags="g"> |
| 474 | | <fileset dir="${release_dir}" includes="**/*.js"/> |
| 475 | | </replaceregexp> |
| 476 | | <replaceregexp match="\n\n" replace="" byline="false" flags="g"> |
| 477 | | <fileset dir="${release_dir}" includes="**/*.js"/> |
| 478 | | </replaceregexp> |
| 479 | | |
| 480 | | <replaceregexp match="\t" replace="" byline="false" flags="g"> |
| 481 | | <fileset dir="${release_dir}" includes="**/*.js"/> |
| 482 | | </replaceregexp> |
| 483 | | </target> |
| 484 | | <!-- end gen-strip-docs task --> |
| 485 | | |
| | 340 | <!-- clean task --> |
| | 341 | <target name="clean" |
| | 342 | description="removes release files"> |
| | 343 | <delete dir="${release_dir}"/> |
| | 344 | </target> |
| | 345 | <!-- end clean task --> |
| | 346 | |
| | 347 | <!-- release task --> |
| | 348 | <target name="release" depends="-fix-config" |
| | 349 | description="builds a release"> |
| | 350 | |
| | 351 | <echo level="info" taskName="release" message="Using version number: ${version} for the release."/> |
| | 352 | |
| | 353 | <antcall target="clean" /> |
| | 354 | |
| | 355 | <copy todir="${release_dir}/${src}" includeEmptyDirs="false" preservelastmodified="true"> |
| | 356 | <fileset dir="${root}/${src}"> |
| | 357 | <include name="**" /> |
| | 358 | <exclude name="**/*.swp" /> |
| | 359 | <exclude name="**/.svn*" /> |
| | 360 | </fileset> |
| | 361 | </copy> |
| | 362 | |
| | 363 | <copy todir="${release_dir}/tests" includeEmptyDirs="false" preservelastmodified="true"> |
| | 364 | <fileset dir="${root}/tests"> |
| | 365 | <include name="**" /> |
| | 366 | <exclude name="**/*.swp" /> |
| | 367 | <exclude name="**/.svn*" /> |
| | 368 | </fileset> |
| | 369 | </copy> |
| | 370 | |
| | 371 | <antcall target="compress" /> |
| | 372 | |
| | 373 | <!-- Run xdgen if it xdomain loading is wanted. --> |
| | 374 | <condition property="xdgenRun"> |
| | 375 | <equals arg1="xdomain" arg2="${dojoLoader}"/> |
| | 376 | </condition> |
| | 377 | <antcall target="xdgenRelease"/> |
| | 378 | |
| | 379 | <copy overwrite="true" file="../iframe_history.html" todir="${release_dir}/" preservelastmodified="true" /> |
| | 380 | |
| | 381 | <copy file="${root}/LICENSE" todir="${release_dir}/" preservelastmodified="true" /> |
| | 382 | <copy file="${root}/README" todir="${release_dir}/" preservelastmodified="true" /> |
| | 383 | </target> |
| | 384 | <!-- end release task --> |
| | 385 | |
| 700 | | |
| 701 | | <!-- release task --> |
| 702 | | <target name="release" depends="-fix-config" |
| 703 | | description="builds a release"> |
| 704 | | |
| 705 | | <echo level="info" taskName="release" message="Using version number: ${version} for the release."/> |
| 706 | | |
| 707 | | <antcall target="clean" /> |
| 708 | | <!-- |
| 709 | | <antcall target="src" /> |
| 710 | | --> |
| 711 | | <copy todir="${release_dir}/${src}" includeEmptyDirs="false" preservelastmodified="true"> |
| 712 | | <fileset dir="${root}/${src}"> |
| 713 | | <include name="**" /> |
| 714 | | <exclude name="**/*.swp" /> |
| 715 | | <exclude name="**/.svn*" /> |
| 716 | | </fileset> |
| 717 | | </copy> |
| 718 | | |
| 719 | | <copy todir="${release_dir}/demos" includeEmptyDirs="false" preservelastmodified="true"> |
| 720 | | <fileset dir="${root}/demos"> |
| 721 | | <include name="**" /> |
| 722 | | <exclude name="**/*.swp" /> |
| 723 | | <exclude name="**/.svn*" /> |
| 724 | | </fileset> |
| 725 | | </copy> |
| 726 | | |
| 727 | | <copy todir="${release_dir}/tests" includeEmptyDirs="false" preservelastmodified="true"> |
| 728 | | <fileset dir="${root}/tests"> |
| 729 | | <include name="**" /> |
| 730 | | <exclude name="**/*.swp" /> |
| 731 | | <exclude name="**/.svn*" /> |
| 732 | | </fileset> |
| 733 | | </copy> |
| 734 | | |
| 735 | | <!-- |
| 736 | | Call our Dojo Flash and Storage tasks |
| 737 | | in such a way that they won't cause the |
| 738 | | entire release task to fail if mtasc is not |
| 739 | | available - make mtasc optional. |
| 740 | | --> |
| 741 | | <script language="javascript" taskName="release"> |
| 742 | | <![CDATA[ |
| 743 | | function echo(msg){ |
| 744 | | var echo = dojo.createTask("echo"); |
| 745 | | echo.setMessage(msg); |
| 746 | | echo.setTaskName("release"); |
| 747 | | echo.execute(); |
| 748 | | } |
| 749 | | |
| 750 | | function antCall(target){ |
| 751 | | var antCall = dojo.createTask("antcall"); |
| 752 | | antCall.setTarget(target); |
| 753 | | antCall.execute(); |
| 754 | | } |
| 755 | | |
| 756 | | try{ |
| 757 | | antCall("buildDojoFlash"); |
| 758 | | antCall("buildDojoStorage"); |
| 759 | | }catch(exp){ |
| 760 | | echo("WARNING: buildDojoFlash and buildDojoStorage could not run."); |
| 761 | | echo("Please download and install mtasc from http://www.mtasc.org and place it in your path."); |
| 762 | | } |
| 763 | | ]]> |
| 764 | | </script> |
| 765 | | |
| 766 | | <!-- |
| 767 | | Generate optional Java class needed for Safari and Opera |
| 768 | | for dojo.storage.browser.FileStorageProvider |
| 769 | | --> |
| 770 | | <antcall target="buildFileStorageProvider" /> |
| 771 | | |
| 772 | | <antcall target="compress" /> |
| 773 | | <!-- <antcall target="intern-strings" /> --> |
| 774 | | |
| 775 | | <!-- Run xdgen if it xdomain loading is wanted. --> |
| 776 | | <condition property="xdgenRun"> |
| 777 | | <equals arg1="xdomain" arg2="${dojoLoader}"/> |
| 778 | | </condition> |
| 779 | | <antcall target="xdgenRelease"/> |
| 780 | | |
| 781 | | <copy overwrite="true" file="../iframe_history.html" todir="${release_dir}/" preservelastmodified="true" /> |
| 782 | | |
| 783 | | <copy file="${root}/LICENSE" todir="${release_dir}/" preservelastmodified="true" /> |
| 784 | | <copy file="${root}/README" todir="${release_dir}/" preservelastmodified="true" /> |
| 785 | | </target> |
| 786 | | <!-- end release task --> |
| 787 | | |
| 788 | | <target name="api-prep" |
| 789 | | description="Constructs API outlines"> |
| 790 | | <copy todir="${release_dir}/apis" includeEmptyDirs="false" preservelastmodified="true"> |
| 791 | | <fileset dir="${root}/documents/apis"> |
| 792 | | <include name="**" /> |
| 793 | | <exclude name="**/*.swp" /> |
| 794 | | <exclude name="**/.svn*" /> |
| 795 | | </fileset> |
| 796 | | </copy> |
| 797 | | </target> |
| 798 | | |
| 799 | | <!-- zip task --> |
| 800 | | <target name="zip" |
| 801 | | description="builds zip file of release files"> |
| 802 | | <zip destfile="${root}/release/${project}_${version}.zip" basedir="${root}/release/${project}"/> |
| 803 | | </target> |
| 804 | | <!-- end zip task --> |
| 805 | | |
| 806 | | <!-- tar task --> |
| 807 | | <target name="tar" |
| 808 | | description="builds tarball of release files"> |
| 809 | | <tar tarfile="${root}/release/${project}_${version}.tar" basedir="${root}/release" includes="${project}/**"/> |
| 810 | | <gzip zipfile="${root}/release/${project}_${version}.tar.gz" src="${root}/release/${project}_${version}.tar"/> |
| 811 | | <delete file="${root}/release/${project}_${version}.tar"/> |
| 812 | | </target> |
| 813 | | <!-- end tar task --> |
| 814 | | |
| 815 | | <!-- buildFileStorageProvider task --> |
| 816 | | <target name="buildFileStorageProvider" |
| 817 | | description="Builds a Java class needed by dojo.storage.browser.FileStorageProvider"> |
| 818 | | <echo level="info" taskName="buildFileStorageProvider">Building optional Java class for dojo.storage.browser.FileStorageProvider. Don't |
| 819 | | worry if this fails; the generated class file is checked into Subversion and is |
| 820 | | available in src/storage/java/ without rebuilding it.</echo> |
| 821 | | |
| 822 | | <javac srcdir="${root}/src/storage/java/" |
| 823 | | destdir="${root}/src/storage/java/" |
| 824 | | debug="on" |
| 825 | | target="1.1" |
| 826 | | source="1.1" |
| 827 | | failonerror="false"/> |
| 828 | | |
| 829 | | <jar destfile="${root}/DojoFileStorageProvider.jar"> |
| 830 | | <fileset dir="${root}/src/storage/java/" includes="*.class"/> |
| 831 | | </jar> |
| 832 | | </target> |
| 833 | | <!-- end buildFileStorageProvider task --> |
| 834 | | |
| 835 | | <!-- buildDojoFlash task --> |
| 836 | | <target name="buildDojoFlash" |
| 837 | | description="builds the Dojo Flash package and its testing files"> |
| 838 | | <antcall target="buildFlash"> |
| 839 | | <param name="dojo.flash.file" value="${root}/tests/flash/HelloWorld.as"/> |
| 840 | | </antcall> |
| 841 | | |
| 842 | | <antcall target="buildFlash"> |
| 843 | | <param name="dojo.flash.file" value="${root}/tests/flash/UnitTestsComm.as"/> |
| 844 | | </antcall> |
| 845 | | |
| 846 | | <move todir="${root}/tests/flash/resources"> |
| 847 | | <fileset dir="${root}/tests/flash/"> |
| 848 | | <include name="*.swf"/> |
| 849 | | </fileset> |
| 850 | | </move> |
| 851 | | </target> |
| 852 | | <!-- end buildDojoFlash task --> |
| 853 | | |
| 854 | | <!-- buildDojoStorage task --> |
| 855 | | <target name="buildDojoStorage" |
| 856 | | description="builds the Dojo Storage package"> |
| 857 | | <antcall target="buildFlash"> |
| 858 | | <param name="dojo.flash.file" value="${root}/${src}/storage/Storage.as"/> |
| 859 | | </antcall> |
| 860 | | |
| 861 | | <move todir="${root}"> |
| 862 | | <fileset dir="${root}/${src}/storage/"> |
| 863 | | <include name="*.swf"/> |
| 864 | | </fileset> |
| 865 | | </move> |
| 866 | | </target> |
| 867 | | <!-- end buildDojoStorage task --> |
| 868 | | |
| 869 | | <!-- buildFlash task --> |
| 870 | | <target name="buildFlash" |
| 871 | | description="builds Flash ActionScript class to use dojo.flash.comm"> |
| 872 | | <!-- extract the ActionScript class name and path --> |
| 873 | | <script language="javascript"> |
| 874 | | <![CDATA[ |
| 875 | | var flashFile = dojo.getProperty("dojo.flash.file"); |
| 876 | | |
| 877 | | var matches = flashFile.match(/([A-Za-z0-9_]*)\.as$/); |
| 878 | | var flashClass = matches[1]; |
| 879 | | dojo.setNewProperty("flashClass", flashClass); |
| 880 | | |
| 881 | | var flashFileName = matches[0]; |
| 882 | | var endCut = new String(flashFile).length - flashFileName.length; |
| 883 | | var flashPath = flashFile.substring(0, endCut); |
| 884 | | dojo.setNewProperty("flashPath", flashPath); |
| 885 | | ]]> |
| 886 | | </script> |
| 887 | | |
| 888 | | <!-- generate the Flash 6 SWF --> |
| 889 | | <echo level="info" taskName="buildFlash" message="Flash 6: Compiling ${dojo.flash.file}..."/> |
| 890 | | |
| 891 | | <exec executable="mtasc"> |
| 892 | | <arg value="-version"/> |
| 893 | | <arg value="6"/> |
| 894 | | |
| 895 | | <arg value="-cp"/> |
| 896 | | <arg value="${root}/${src}/flash/flash6"/> |
| 897 | | |
| 898 | | <arg value="-swf"/> |
| 899 | | <arg value="${flashPath}/${flashClass}_version6.swf"/> |
| 900 | | |
| 901 | | <arg value="-main"/> |
| 902 | | |
| 903 | | <arg value="-header"/> |
| 904 | | <arg value="215:138:10"/> |
| 905 | | |
| 906 | | <arg value="${dojo.flash.file}"/> |
| 907 | | </exec> |
| 908 | | |
| 909 | | <!-- generate the Flash 8 SWF --> |
| 910 | | <echo message="Flash 8: Compiling ${dojo.flash.file}..."/> |
| 911 | | |
| 912 | | <exec executable="mtasc"> |
| 913 | | <arg value="-version"/> |
| 914 | | <arg value="8"/> |
| 915 | | |
| 916 | | <arg value="-cp"/> |
| 917 | | <arg value="${root}/${src}/flash/flash8"/> |
| 918 | | |
| 919 | | <arg value="-swf"/> |
| 920 | | <arg value="${flashPath}/${flashClass}_version8.swf"/> |
| 921 | | |
| 922 | | <arg value="-main"/> |
| 923 | | |
| 924 | | <arg value="-header"/> |
| 925 | | <arg value="215:138:10"/> |
| 926 | | |
| 927 | | <arg value="${dojo.flash.file}"/> |
| 928 | | </exec> |
| 929 | | </target> |
| 930 | | <!-- end buildFlash task --> |