Changeset 7741

Show
Ignore:
Timestamp:
03/21/07 22:18:17 (20 months ago)
Author:
jburke
Message:

Refs #2607. Slash and burn baby. Stripping things down. Nothing works yet.

Location:
util/trunk/buildscripts
Files:
1 added
25 removed
1 modified

Legend:

Unmodified
Added
Removed
  • util/trunk/buildscripts/build.xml

    r7576 r7741  
    55        Free License version 2.1 or BSD licenses 
    66--> 
    7 <!-- 
    8         TODO: 
    9                 - single-file builds 
    10                 - task for firing off jslink.pl against a set of "app files". TBD: 
    11                   should we support these as HTML? Or just JS files? 
    12                   NOTE: the following command issued from the top-level seems to work correctly: 
    13                         perl buildscripts/jslink.pl -pre cat -i release/testUsage.js -l src/bootstrap1.js -l src/hostenv_browser.js -l src/io/IO.js -l src/io/BrowserIO.js -o - > release/minimal.js 
    14                   This correctly "links" the files together, but mangles some 
    15                   identifiers and places anonymous inner functions at the wrong places 
    16                   OTOH, running the linker over the pre-compressed version of the file doesn't seem to work at all 
    17                 - a task for running the compressor across the user's files as well as our own 
    18                 - doc generation (pending new mods to Rhino) 
    19 --> 
    207<project name="dojo" default="help" basedir="."> 
    21         <description>build the Dojo toolkit</description> 
     8        <description>Build the Dojo toolkit</description> 
    229 
    2310        <!-- project properties --> 
    2411        <!-- FIXME: use location instead of value where appropriate? --> 
    2512        <property name="project" value="dojo"/> 
    26         <property name="build_dir" value="../build"/> 
    2713        <property name="root" value=".."/> 
    2814        <property name="src" value="src"/> 
     
    3218        <property name="dojoLoader" value="default"/> 
    3319        <property name="release_dir" location="${root}/release/${releaseName}"/> 
    34         <property name="docs_dir" value="${root}/documents"/> 
    35         <property name="articles_dir" value="${docs_dir}/articles"/> 
    36         <property name="release_docs_dir" value="${release_dir}/documents"/> 
    37         <property name="rest_style_sheet" value="${docs_dir}/styles/dojo.css"/> 
    38         <property name="rest_files" value=""/> 
    39         <property name="website_dir" value="${docs_dir}/website"/> 
    40         <property name="release_website_dir" value="/srv/www/htdocs"/> 
    4120        <property name="profile" value=""/> 
    4221        <property name="locales" value="en-gb,en-us,de-de,es-es,fr-fr,it-it,pt-br,ko-kr,zh-tw,zh-cn,ja-jp"/>    <!-- FIXME: where should this list come from? --> 
     
    4928 
    5029        <!-- help task --> 
    51         <target name="help" depends="-fix-config"> 
     30        <target name="help"> 
    5231                <echo> 
    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  
     32See http://dojotoolkit.org/node/19 for more information. 
    10833                </echo> 
    10934        </target> 
    11035        <!-- end help task --> 
    111  
    112         <!-- Defines the dojo test task. --> 
    113         <taskdef name="dojo-test" classname="org.dojotoolkit.ant.DojoTestTask" classpath="lib/ant-dojotest.jar" /> 
    114  
    115         <!-- test task --> 
    116         <target name="test" 
    117                 depends="-fix-config" 
    118                 description="builds and runs unit tests for Dojo under Rhino and JUM"> 
    119                 <dojo-test dojosrc="../" testsrc="../tests"/> 
    120         </target> 
    121         <!-- end test task --> 
    12236 
    12337        <!-- test-scripting task --> 
     
    14054                                echo.setMessage(msg); 
    14155                        } 
    142  
    143                         /* 
    144                         function load(){ 
    145                                 for(var x=0; x<arguments.length; x++){ 
    146                                         var scriptTask = dojo.createTask("script"); 
    147                                         scriptTask.setAttribute(); // FIXME: will this work? 
    148                                 } 
    149                         } 
    150                         */ 
    15156 
    15257                        print("foo"); 
     
    389294        <!-- end cldr task --> 
    390295 
    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="([^:(&quot;.'\\-][^:C0-9&quot;(\\])(\/\/.*)" /> 
    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="^&lt;\!--" replace="" byline="false" flags="g"> 
    425                         <fileset dir="${release_dir}" includes="**/*.js"/> 
    426                 </replaceregexp> 
    427                 <replaceregexp match="--&gt;$" 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  
    486296        <!-- strip-resource-comments --> 
    487297                <target name="strip-resource-comments"> 
     
    493303        </target> 
    494304        <!-- end strip-resource-comments --> 
    495  
    496         <!-- src task --> 
    497         <target name="src" 
    498                 depends="-fix-config" 
    499                 unless="nosrc" 
    500                 description="creates a copy of the source files for distribution"> 
    501  
    502                 <property name="ddir" value="${release_dir}/${project}/${src}_src"/> 
    503                 <!-- make sure our dir structure is right --> 
    504                 <delete dir="${ddir}" /> 
    505                 <mkdir dir="${ddir}" /> 
    506  
    507                 <copy todir="${ddir}" preservelastmodified="true"> 
    508                         <fileset dir="./${src}" includes="**" /> 
    509                 </copy> 
    510  
    511                 <!-- make sure we're dealing with unix newlines --> 
    512                 <fixcrlf srcdir="${ddir}" 
    513                         eol="lf" eof="remove" 
    514                         includes="**/*.js" /> 
    515  
    516                 <!-- ensure everyone can read --> 
    517                 <chmod perm="ugo+rx" type="dir" dir="${release_dir}" includes="**" /> 
    518                 <chmod perm="ugo+r" type="file" dir="${release_dir}" includes="**/*.*" /> 
    519         </target> 
    520         <!-- end src task --> 
    521  
    522305 
    523306        <!-- -set-profileFile task --> 
     
    555338        <!-- end list-profile-deps task --> 
    556339 
     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 
    557386        <!-- compress task --> 
    558387        <target name="compress" depends="-fix-config, -set-profileFile" 
     
    698527        </target> 
    699528        <!-- end intern-strings task --> 
    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 --> 
    931529 
    932530        <!-- xd-dojo-config task -->