You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by mt...@apache.org on 2006/08/16 21:57:12 UTC
svn commit: r432045 [1/6] - in /incubator/xap/trunk/buildscripts: ./
doctool/ doctool/narcissus/ doctool/narcissus/CVS/ lib/ profiles/
Author: mturyn
Date: Wed Aug 16 14:57:09 2006
New Revision: 432045
URL: http://svn.apache.org/viewvc?rev=432045&view=rev
Log:
More new files for building.
Added:
incubator/xap/trunk/buildscripts/build.xml (with props)
incubator/xap/trunk/buildscripts/buildUtil$py.class (with props)
incubator/xap/trunk/buildscripts/buildUtil.js (with props)
incubator/xap/trunk/buildscripts/buildUtil.py (with props)
incubator/xap/trunk/buildscripts/buildUtil.test.js (with props)
incubator/xap/trunk/buildscripts/buildUtilExt.js (with props)
incubator/xap/trunk/buildscripts/build_notice.txt (with props)
incubator/xap/trunk/buildscripts/copyright.txt (with props)
incubator/xap/trunk/buildscripts/doctool/
incubator/xap/trunk/buildscripts/doctool/README (with props)
incubator/xap/trunk/buildscripts/doctool/inline.html (with props)
incubator/xap/trunk/buildscripts/doctool/inline.py (with props)
incubator/xap/trunk/buildscripts/doctool/narcissus/
incubator/xap/trunk/buildscripts/doctool/narcissus/CVS/
incubator/xap/trunk/buildscripts/doctool/narcissus/CVS/Entries
incubator/xap/trunk/buildscripts/doctool/narcissus/CVS/Repository
incubator/xap/trunk/buildscripts/doctool/narcissus/CVS/Root
incubator/xap/trunk/buildscripts/doctool/narcissus/js.js (with props)
incubator/xap/trunk/buildscripts/doctool/narcissus/jsdefs.js (with props)
incubator/xap/trunk/buildscripts/doctool/narcissus/jsexec.js (with props)
incubator/xap/trunk/buildscripts/doctool/narcissus/jsparse.js (with props)
incubator/xap/trunk/buildscripts/dojoGuardEnd.js (with props)
incubator/xap/trunk/buildscripts/dojoGuardStart.js (with props)
incubator/xap/trunk/buildscripts/externalconfig.mak
incubator/xap/trunk/buildscripts/foo-bard-ant.txt (with props)
incubator/xap/trunk/buildscripts/getDependencyList.js (with props)
incubator/xap/trunk/buildscripts/jslink.pl (with props)
incubator/xap/trunk/buildscripts/lib/
incubator/xap/trunk/buildscripts/lib/ant-apache-bsf.jar (with props)
incubator/xap/trunk/buildscripts/lib/bsf.jar (with props)
incubator/xap/trunk/buildscripts/lib/custom_rhino.diff
incubator/xap/trunk/buildscripts/lib/custom_rhino.jar (with props)
incubator/xap/trunk/buildscripts/lib/js.jar (with props)
incubator/xap/trunk/buildscripts/lib/jython.jar (with props)
incubator/xap/trunk/buildscripts/lib/pyLib.zip (with props)
incubator/xap/trunk/buildscripts/lib/xapcore_c.js (with props)
incubator/xap/trunk/buildscripts/lib/xbean.jar (with props)
incubator/xap/trunk/buildscripts/lib/zimbra.js (with props)
incubator/xap/trunk/buildscripts/lib/zimbra_c.js (with props)
incubator/xap/trunk/buildscripts/profiles/ajax.profile.js (with props)
incubator/xap/trunk/buildscripts/profiles/browserio.profile.js (with props)
incubator/xap/trunk/buildscripts/profiles/core.profile.js (with props)
incubator/xap/trunk/buildscripts/profiles/dashboard.profile.js (with props)
incubator/xap/trunk/buildscripts/profiles/dojoWebsite.profile.js (with props)
incubator/xap/trunk/buildscripts/profiles/editor.profile.js (with props)
incubator/xap/trunk/buildscripts/profiles/event.profile.js (with props)
incubator/xap/trunk/buildscripts/profiles/event_and_io.profile.js (with props)
incubator/xap/trunk/buildscripts/profiles/google.profile.js (with props)
incubator/xap/trunk/buildscripts/profiles/kitchen_sink.profile.js (with props)
incubator/xap/trunk/buildscripts/profiles/lfx.profile.js (with props)
incubator/xap/trunk/buildscripts/profiles/minimal.profile.js (with props)
incubator/xap/trunk/buildscripts/profiles/moxie.profile.js (with props)
incubator/xap/trunk/buildscripts/profiles/multi.one.js (with props)
incubator/xap/trunk/buildscripts/profiles/multi.profiles.js (with props)
incubator/xap/trunk/buildscripts/profiles/multi.two.js (with props)
incubator/xap/trunk/buildscripts/profiles/storage.profile.js (with props)
incubator/xap/trunk/buildscripts/profiles/widget.profile.js (with props)
incubator/xap/trunk/buildscripts/profiles/zimbra.profile.js (with props)
incubator/xap/trunk/buildscripts/sitedoc.mak
incubator/xap/trunk/buildscripts/testBuildUtil.py (with props)
incubator/xap/trunk/buildscripts/usage
incubator/xap/trunk/buildscripts/usage-report
incubator/xap/trunk/buildscripts/xaplicense.txt (with props)
Added: incubator/xap/trunk/buildscripts/build.xml
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/buildscripts/build.xml?rev=432045&view=auto
==============================================================================
--- incubator/xap/trunk/buildscripts/build.xml (added)
+++ incubator/xap/trunk/buildscripts/build.xml Wed Aug 16 14:57:09 2006
@@ -0,0 +1,884 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!--
+ Copyright (c) 2004-2006 The Dojo Foundation, Licensed under the Academic
+ Free License version 2.1 or BSD licenses
+-->
+<!--
+ TODO:
+ - single-file builds
+ - task for firing off jslink.pl against a set of "app files". TBD:
+ should we support these as HTML? Or just JS files?
+ NOTE: the following command issued from the top-level seems to work correctly:
+ perl buildscripts/jslink.pl -pre cat -i release/testUsage.js -l src/bootstrap1.js -l src/bootstrap2.js -l src/hostenv_browser.js -l src/io/IO.js -l src/io/BrowserIO.js -o - > release/minimal.js
+ This correctly "links" the files together, but mangles some
+ identifiers and places anonymous inner functions at the wrong places
+ OTOH, running the linker over the pre-compressed version of the file doesn't seem to work at all
+ - a task for running the compressor across the user's files as well as our own
+ - doc generation (pending new mods to Rhino)
+-->
+<project name="dojo" default="help" basedir=".">
+ <description>build the Dojo toolkit</description>
+
+ <!-- project properties -->
+ <property name="project" value="dojo"/>
+ <property name="build_dir" value="../build"/>
+ <property name="root" value=".."/>
+ <property name="src" value="src"/>
+ <property name="version" value="0.0.0.dev"/>
+ <property name="lang" value="en"/>
+ <property name="releaseName" value="${project}"/>
+ <property name="dojoLoader" value="default"/>
+ <property name="release_dir" value="${root}/release/${releaseName}"/>
+ <property name="docs_dir" value="${root}/documents"/>
+ <property name="articles_dir" value="${docs_dir}/articles"/>
+ <property name="release_docs_dir" value="${release_dir}/documents"/>
+ <property name="rest_style_sheet" value="${docs_dir}/styles/dojo.css"/>
+ <property name="rest_files" value=""/>
+ <property name="website_dir" value="${docs_dir}/website"/>
+ <property name="release_website_dir" value="/srv/www/htdocs"/>
+ <property name="profile" value=""/>
+
+ <loadfile property="copyright" srcFile="./xaplicense.txt"/>
+ <loadfile property="build_notice" srcFile="./xaplicense.txt"/>
+
+ <!-- help task -->
+ <target name="help" depends="-fix-config">
+ <echo>
+build targets:
+ clean - deletes all files in the ${release_dir} directory
+ website - copies website files into the correct location and sets
+ permissions correctly
+ compress - copies the files in ${root}/${src} to the
+ ${release_dir}/${project}/${src} directory where it
+ compresses all the .js files with a set of regular
+ expressions and removes all non .js files
+ src - Take ./${src} and build the ${release_dir}/${project}/${src}_src
+ directory. More or less a copy of the source files, documentation and
+ all.
+ docs - builds documentation in all formats from ./${src} and place it in ${release_docs_dir}
+ test - builds and runs command line unit tests
+ testScripting - tests the JS and Jython integration in the build process
+ buildFlash - compiles a Flash ActionScript 2 file to use dojo.flash.comm; provide
+ relative path to file using -Ddojo.flash.file.
+ buildDojoFlash - compiles the dojo.flash package, including its testing
+ and example files.
+ buildDojoStorage - compiles the dojo.storage package
+
+ **** all following build types can take an optional parameter in the form of: -Dversion='currentVer'
+ where 'currentVer' is the version of ${project} being built, default is 'development'
+
+ zip - zips the ${release_dir}/${project} directory for distribution
+ tar - tars and gzips the ${release_dir}/${project} directory for distribution
+ release - creates a full release of ${project}
+
+ full build example:
+ ant -Dversion=0.3.0 clean release
+
+ build example with tarball:
+ ant -Dversion=0.3.0 clean compress tar
+
+ just generate documentation:
+ ant -Dversion=0.3.0 clean docs
+
+ full build, but without docs:
+ ant -Dversion=0.3.0 -Ddocless=true clean release
+
+ </echo>
+ </target>
+ <!-- end help task -->
+
+ <!-- test task -->
+ <target name="test"
+ depends="-fix-config"
+ description="builds and runs unit tests for Dojo under Rhino and JUM">
+ <!-- clobber the tests directory and rebuild it -->
+ <!-- copy over the contents of the old test directory -->
+ <!--
+ <delete dir="${release_dir}/tests"/>
+ <mkdir dir="${release_dir}/tests" />
+ -->
+
+ <script language="jython"><![CDATA[
+# make the python standard library available
+import sys
+sys.path.append("lib/pyLib.zip")
+sys.path.append(".")
+import buildUtil
+
+buildUtil.buildTestFiles()
+
+# print "#################### testRunner.js ####################",
+# for line in file("../testRunner.js"):
+# print line,
+# print "################## end testRunner.js ##################\n"
+]]></script>
+ <!-- <java jar="${user.home}/.ant/lib/js.jar" fork="true"> -->
+ <java jar="./lib/custom_rhino.jar" fork="true">
+ <!-- FIXME: should this be in the release/ dir somewhere? -->
+ <arg value="../testRunner.js" />
+ </java>
+ <!--
+ <delete file="../testRunner.js" />
+ -->
+ </target>
+ <!-- end test task -->
+
+ <!-- test-scripting task -->
+ <target name="testScripting"
+ depends="-fix-config"
+ description="runs minimal test on our BSF+JS+Jython integration">
+ <script language="javascript"><![CDATA[
+ function print(){
+ var args = [];
+ for(var x=0; x<arguments.length; x++){
+ args.push(arguments[x]);
+ }
+ java.lang.System.out.println.apply(java.lang.System.out, args);
+
+ }
+
+ function echo(msg, parentTask){
+ var echo = dojo.createTask("echo");
+ parentTask.addTask(echo);
+ echo.setMessage(msg);
+ }
+
+ /*
+ function load(){
+ for(var x=0; x<arguments.length; x++){
+ var scriptTask = dojo.createTask("script");
+ scriptTask.setAttribute(); // FIXME: will this work?
+ }
+ }
+ */
+
+ print("foo");
+ echo("JavaScript (Rhino) integration is working!", testScripting);
+ ]]></script>
+ <script language="jython"><![CDATA[
+import sys
+# make the python standard library avialable
+sys.path.append("lib/pyLib.zip")
+
+# import re
+
+echo = dojo.createTask("echo")
+testScripting.addTask(echo)
+echo.setMessage("Jython integration is working!");
+
+print "look ma! Jython!"
+]]></script>
+ </target>
+ <!-- end testScripting task -->
+
+ <!-- -check-config task -->
+ <target name="-check-config"
+ description="checks to make sure than we're sane before doing anything else">
+ <available property="bsf_ok" file="${user.home}/.ant/lib/bsf.jar" />
+ <available property="ant_bsf_ok" file="${user.home}/.ant/lib/ant-apache-bsf.jar" />
+ <available property="jython_ok" file="${user.home}/.ant/lib/jython.jar" />
+ <available property="jython_libs_ok" file="${user.home}/.ant/lib/pyLib.zip" />
+
+ <condition property="config_ok">
+ <and>
+ <isset property="bsf_ok" />
+ <isset property="ant_bsf_ok" />
+ <isset property="jython_ok" />
+ <isset property="jython_libs_ok" />
+ </and>
+ </condition>
+
+ </target>
+ <!-- end -check-config task -->
+
+ <!-- -fix-config task -->
+ <target name="-fix-config"
+ depends="-check-config"
+ unless="config_ok"
+ description="fixes our ant classpath (if possible)">
+ <copy todir="${user.home}/.ant/lib"
+ preservelastmodified="true">
+ <fileset dir="lib/">
+ <include name="bsf.jar"/>
+ <include name="jython.jar"/>
+ <include name="pyLib.zip"/>
+ <include name="js.jar"/>
+ <include name="ant-apache-bsf.jar"/>
+ </fileset>
+ </copy>
+
+ <echo message=""/>
+ <echo message="+--------------------------------------------------------+" />
+ <echo message="| Due to some horrendous design decisions by the authors |" />
+ <echo message="| of Ant, it has been necessaray to install some jar |" />
+ <echo message="| files to your ~/.ant/ directory. Given the nature of |" />
+ <echo message="| the problem, it will be necessaray for you to re-run |" />
+ <echo message="| your build command. |" />
+ <echo message="| |" />
+ <echo message="| The Dojo team apologies for this inconvenience. |" />
+ <echo message="| |" />
+ <echo message="| The system will now exit. |" />
+ <echo message="+--------------------------------------------------------+" />
+ <echo message=""/>
+
+ <fail message="Sorry, please re-run your build command, it should work now"/>
+ </target>
+ <!-- end -fix-config task -->
+
+ <!-- website task -->
+ <!--
+ FIXME: need to build docs here and copy the HTML files generated from
+ reST to website/docs/
+ -->
+ <target name="website"
+ depends="-fix-config"
+ description="'builds' the website and moves files into the correct directory, taking care to ensure that file permissions are correct">
+
+ <copy todir="${release_website_dir}" overwrite="true">
+ <fileset dir="${website_dir}">
+ <exclude name="**/.svn*" />
+ <include name="**/*" />
+ </fileset>
+ </copy>
+ <antcall target="docs" />
+ <copy todir="${release_website_dir}/docs/" overwrite="true">
+ <fileset dir="${release_docs_dir}">
+ <exclude name="**/.svn*" />
+ <include name="*.html" />
+ </fileset>
+ </copy>
+ <chgrp group="www" type="both">
+ <fileset dir="${release_website_dir}" followsymlinks="false" includes="**/**" />
+ </chgrp>
+ <chmod perm="g+rwx" type="dir">
+ <fileset dir="${release_website_dir}" followsymlinks="false" includes="**/**" />
+ </chmod>
+ <chmod perm="g+rw" type="file">
+ <fileset dir="${release_website_dir}" followsymlinks="false" includes="**/**" />
+ </chmod>
+ </target>
+ <!-- end website task -->
+
+ <!-- FIXME: need to fix this task!! -->
+ <!-- docs task -->
+ <target name="docs"
+ unless="docless"
+ depends="-fix-config"
+ description="'builds' the docs">
+ <!-- first, clobber the docs directory and rebuild it -->
+ <!--
+ FIXME: how best can we check for staleness here? Shouldn't Ant be
+ doing this for us? Clobbering entire dirs seems a little
+ heavyweight.
+ -->
+ <delete dir="${release_docs_dir}"/>
+ <mkdir dir="${release_docs_dir}" />
+ <mkdir dir="${release_docs_dir}/requirements" />
+ <script language="jython"><![CDATA[
+import sys
+# make the python standard library avialable
+sys.path.append("lib/pyLib.zip")
+sys.path.append(".")
+
+# import re
+import os
+from buildUtil import *
+
+buildRestFiles( dojo.getProperty("articles_dir"),
+ dojo.getProperty("release_docs_dir"),
+ dojo.getProperty("rest_style_sheet"),
+ dojo.getProperty("rest_files"))
+]]></script>
+
+ <!-- fix body tags -->
+ <replaceregexp match="^<body>$" byline="true"
+ replace="<body class="docs">" flags="g">
+ <fileset dir="${release_docs_dir}">
+ <exclude name="**/.svn*" />
+ <include name="**/*.html" />
+ </fileset>
+ </replaceregexp>
+
+ </target>
+ <!-- end docs task -->
+
+ <!-- clean task -->
+ <target name="clean"
+ description="removes release files">
+ <delete dir="${release_dir}"/>
+ </target>
+ <!-- end clean task -->
+
+ <!-- gen-strip-docs task -->
+ <target name="gen-strip-docs">
+ <!-- make sure we're dealing with unix newlines -->
+ <replaceregexp match="(\r)" replace="" byline="false" flags="g">
+ <fileset dir="${destdir}" includes="**/*.js"/>
+ </replaceregexp>
+
+ <replaceregexp match="(\n)" replace="NWNEWLINEHERE" byline="false" flags="g">
+ <fileset dir="${destdir}" includes="**/*.js"/>
+ </replaceregexp>
+
+ <!-- strip /* */ (multiline) comments -->
+ <replaceregexp match="\/\*(.*?)\*\/" replace="" byline="false" flags="g">
+ <fileset dir="${destdir}" includes="**/*.js"/>
+ </replaceregexp>
+
+ <!-- clobber leading and trailing DocBook comment -->
+ <replaceregexp match="^<\!--" replace="" byline="false" flags="g">
+ <fileset dir="${destdir}" includes="**/*.js"/>
+ </replaceregexp>
+ <replaceregexp match="-->$" replace="" byline="false" flags="g">
+ <fileset dir="${destdir}" includes="**/*.js"/>
+ </replaceregexp>
+
+ <!-- add copyright notice -->
+ <replaceregexp match="^" byline="false" replace="${copyright}">
+ <fileset dir="${destdir}">
+ <include name="**/*.js" />
+ <include name="**/*.as" />
+ <not>
+ <contains text="copyright" casesensitive="no" />
+ </not>
+ </fileset>
+ </replaceregexp>
+
+ <replace dir="${release_dir}/${project}/${nodocs}">
+ <include name="**/*.js"/>
+ <replacetoken>NWNEWLINEHERE</replacetoken>
+ <replacevalue><![CDATA[
+]]></replacevalue>
+ </replace>
+
+ <!-- add copyright notice -->
+ <replaceregexp match="^" byline="false" replace="${copyright}">
+ <fileset dir="${destdir}">
+ <include name="**/*.js" />
+ <include name="**/*.as" />
+ <not>
+ <contains text="copyright" casesensitive="no" />
+ </not>
+ </fileset>
+ </replaceregexp>
+ </target>
+ <!-- end gen-strip-docs task -->
+
+ <!-- src task -->
+ <target name="src"
+ depends="-fix-config"
+ unless="nosrc"
+ description="creates a copy of the source files for distribution">
+
+ <property name="ddir" value="${release_dir}/${project}/${src}_src"/>
+ <!-- make sure our dir structure is right -->
+ <delete dir="${ddir}" />
+ <mkdir dir="${ddir}" />
+
+ <copy todir="${ddir}" preservelastmodified="true">
+ <fileset dir="./${src}" includes="**" />
+ </copy>
+
+ <!-- make sure we're dealing with unix newlines -->
+ <fixcrlf srcdir="${ddir}"
+ eol="lf" eof="remove"
+ includes="**/*.js" />
+
+ <!-- ensure everyone can read -->
+ <chmod perm="ugo+rx" type="dir" dir="${release_dir}" includes="**" />
+ <chmod perm="ugo+r" type="file" dir="${release_dir}" includes="**/*.*" />
+ </target>
+ <!-- end src task -->
+
+ <!-- strip-docs task -->
+ <target name="strip-docs"
+ depends="-fix-config"
+ description="this task generates files somewhere between the full 'source' version and the fully comment and white-space stripped versions produced by the 'compress' task">
+ <delete dir="${release_dir}/${project}/${nodocs}"/>
+
+ <mkdir dir="${release_dir}/${project}/${nodocs}"/>
+ <mkdir dir="${release_dir}/${project}/${nodocs}/widgets"/>
+ <copy todir="${release_dir}/${project}/${nodocs}">
+ <fileset dir="./${src}" includes="${core.files},console.js" />
+ </copy>
+ <copy todir="${release_dir}/${project}/${nodocs}/widgets">
+ <fileset dir="./${src}/widgets" includes="${widgets}" />
+ </copy>
+
+ <antcall target="gen-strip-docs">
+ <param name="destdir" value="${release_dir}/${project}/${nodocs}" />
+ </antcall>
+ <fixcrlf srcdir="${release_dir}/${project}/${nodocs}"
+ eol="lf" eof="remove"
+ includes="**/*.js" />
+ <chmod perm="ugo+rx" type="dir" dir="${release_dir}" includes="**"/>
+ <chmod perm="ugo+r" type="file" dir="${release_dir}" includes="**/*.*"/>
+ </target>
+ <!-- strip-docs task -->
+
+ <!-- -set-profile-deps task -->
+ <target name="-set-profile-deps" depends="-fix-config"
+ description="populates the contents of the dependecy list for a given profile">
+ <!--
+ FIXME: this is just a stub! need to fill it in!
+ -->
+ <script language="javascript"><![CDATA[
+ var pf = dojo.getProperty("profileFile");
+ if((!pf)||(pf=="null")||(pf=="")){
+ // echo("profile: "+dojo.getProperty("profile"), compress);
+ var prof = dojo.getProperty("profile");
+ if((prof)&&(prof!="null")&&(prof!="")){
+ dojo.setNewProperty("profileFile", "profiles/"+prof+".profile.js");
+ }else{
+ dojo.setNewProperty("profileFile", "getDependencyList.js");
+ }
+ }
+ ]]></script>
+
+ <!-- FIXME: need to actually get a list of js files to be processed -->
+ <java jar="./lib/js.jar" fork="true" outputproperty="concatFilesProp" errorproperty="concatFilesError">
+ <arg value="${profileFile}" />
+ <sysproperty key="DOJO_LOADER" value="${dojoLoader}" />
+ </java>
+ <script language="javascript"><![CDATA[
+ var currentTask = dojo.getTargets().get("-set-profile-deps");
+ var files = dojo.getProperty("concatFilesProp");
+ dojo.setNewProperty("profileDeps", files);
+ ]]></script>
+
+ </target>
+ <!-- end -set-profile-deps task -->
+
+ <!-- list-profile-deps task -->
+ <target name="list-profile-deps" depends="-fix-config, -set-profile-deps"
+ description="lists out the contents of the file dependencies">
+ <echo>${profileDeps}</echo>
+ </target>
+ <!-- end list-profile-deps task -->
+
+ <!-- list-profile-sizes task -->
+ <target name="list-profile-sizes" depends="-fix-config, -set-profile-deps"
+ description="lists out the contents of the file dependencies">
+ <script language="javascript"><![CDATA[
+ function echo(msg){
+ var echo = dojo.createTask("echo");
+ echo.setMessage(msg);
+ echo.execute();
+ }
+
+ var files = new String(dojo.getProperty("profileDeps"));
+ var outparts = files.split("\n");
+ for(var x=0; x<outparts.length; x++){
+ if(outparts[x][outparts[x].length-1]==","){
+ outparts[x] = outparts[x].substring(0, outparts[x].length-1);
+ }
+ var flen = parseInt(new java.io.File(new java.lang.String(outparts[x])).length());
+ echo(((flen>=1024) ? parseInt(flen/1024)+"K" : flen+"B") +": \t"+ outparts[x]);
+ }
+ ]]></script>
+ <!-- <echo>${profileDeps}</echo> -->
+ </target>
+ <!-- end list-profile-sizes task -->
+
+ <!-- compress task -->
+ <target name="compress" depends="-fix-config, list-profile-deps"
+ description="runs compression code over release JS files">
+ <echo>profileFile: ${profileFile}</echo>
+
+ <!-- Create the release dir if it doesn't exist. -->
+ <mkdir dir="${release_dir}"/>
+ <!-- write the list of files included to the release directory -->
+ <echo file="${release_dir}/build.txt">
+Files baked into this package:
+
+${profileDeps}
+
+ </echo>
+
+ <!-- now write 'em all to a single file -->
+ <concat fixlastline="yes" eol="crlf" destfile="${release_dir}/source.__package__.js">
+ <!--
+ <concat fixlastline="yes" eol="crlf" destfile="${release_dir}/dojo.js">
+ -->
+ <filelist
+ dir="."
+ files="${profileDeps}" />
+ </concat>
+ <!--
+ clobber requireIf and requireAfterIf statements since they
+ aren't applicable in build
+ -->
+ <replaceregexp match="dojo.requireIf\((.*?)\);"
+ byline="true" flags="g" file="${release_dir}/source.__package__.js">
+ <substitution expression=""/>
+ </replaceregexp>
+
+ <replaceregexp match="dojo.requireAfterIf\((.*?)\);"
+ byline="true" flags="g" file="${release_dir}/source.__package__.js">
+ <substitution expression=""/>
+ </replaceregexp>
+
+ <!-- Set the version number -->
+ <script language="jython"><![CDATA[
+import sys
+# make the python standard library avialable
+sys.path.append("lib/pyLib.zip")
+sys.path.append(".")
+
+# import re
+import os
+from buildUtil import *
+
+print "Setting version for Dojo to: " + dojo.getProperty("version")
+replaceVersion(dojo.getProperty("release_dir") + "/source.__package__.js", dojo.getProperty("version"))
+print "Removing dojo.require calls in source.__package__.js."
+removeRequires(dojo.getProperty("release_dir") + "/source.__package__.js")
+]]></script>
+
+ <antcall target="-rhino-compress">
+ <param name="srcFile" value="${release_dir}/source.__package__.js" />
+ <param name="dstFile" value="${release_dir}/dojo.js" />
+ </antcall>
+
+ <antcall target="-no-rhino-compress">
+ <param name="srcFile" value="${release_dir}/source.__package__.js" />
+ <param name="dstFile" value="${release_dir}/dojo.js" />
+ </antcall>
+
+ <!--
+ <java jar="./lib/custom_rhino.jar" fork="true" output="${release_dir}/__package__.js">
+ <arg value="-c" />
+ <arg value="${release_dir}/source.__package__.js" />
+ </java>
+ -->
+
+ <!-- add build notice -->
+ <replaceregexp match="^" byline="false" replace="${build_notice}">
+ <fileset dir="${release_dir}" includes="dojo.js"/>
+ </replaceregexp>
+
+ <!-- add copyright notice -->
+ <replaceregexp match="^" byline="false" replace="${copyright}">
+ <fileset dir="${release_dir}">
+ <include name="**/*.js" />
+ <include name="**/*.as" />
+ <not>
+ <contains text="copyright" casesensitive="no" />
+ </not>
+ </fileset>
+ </replaceregexp>
+
+ <delete file="${release_dir}/source.__package__.js"/>
+
+ <!-- we copy over iframe_history.html here just in case this is a truly
+ stand-alone build that isn't being kicked off via release -->
+ <copy file="../iframe_history.html" todir="${release_dir}/" />
+
+ <!-- copy our dojo.storage and dojo.flash SWFs -->
+ <copy todir="${release_dir}/" preservelastmodified="true">
+ <fileset dir="${root}/">
+ <include name="**/*.swf" />
+ </fileset>
+ </copy>
+
+ </target>
+ <!-- end compress task -->
+
+ <target name="-rhino-compress"
+ unless="nostrip">
+ <copy overwrite="true" file="${srcFile}" tofile="${dstFile}.uncompressed.js" />
+ <java jar="./lib/custom_rhino.jar" fork="true" output="${dstFile}">
+ <arg value="-c" />
+ <arg value="${srcFile}" />
+ </java>
+ </target>
+
+ <target name="-no-rhino-compress"
+ if="nostrip">
+ <copy overwrite="true" file="${srcFile}" tofile="${dstFile}" />
+ </target>
+
+ <!-- intern-strings task -->
+ <target name="intern-strings" depends="-fix-config"
+ description="pulls template paths specified in prototypes into templateStrings which can be used to speed up widget construction">
+ <script language="jython"><![CDATA[
+import sys
+# make the python standard library avialable
+sys.path.append("lib/pyLib.zip")
+sys.path.append(".")
+
+# import re
+import os
+from buildUtil import *
+
+print "Interning strings for directory: " + dojo.getProperty("release_dir")
+internTemplateStrings(dojo.getProperty("dojoLoader"), dojo.getProperty("release_dir"))
+]]></script>
+ </target>
+ <!-- end intern-strings task -->
+
+ <!-- release task -->
+ <target name="release" depends="-fix-config"
+ description="builds a release">
+
+ <echo message="Using version number: ${version} for the release."/>
+
+ <antcall target="clean" />
+ <!--
+ <antcall target="src" />
+ -->
+ <copy todir="${release_dir}/${src}" includeEmptyDirs="false" preservelastmodified="true">
+ <fileset dir="${root}/${src}">
+ <include name="**" />
+ <exclude name="**/*.swp" />
+ <exclude name="**/.svn*" />
+ </fileset>
+ </copy>
+
+ <copy todir="${release_dir}/demos" includeEmptyDirs="false" preservelastmodified="true">
+ <fileset dir="${root}/demos">
+ <include name="**" />
+ <exclude name="**/*.swp" />
+ <exclude name="**/.svn*" />
+ </fileset>
+ </copy>
+
+ <copy todir="${release_dir}/tests" includeEmptyDirs="false" preservelastmodified="true">
+ <fileset dir="${root}/tests">
+ <include name="**" />
+ <exclude name="**/*.swp" />
+ <exclude name="**/.svn*" />
+ </fileset>
+ </copy>
+
+ <!--
+ Call our Dojo Flash and Storage tasks
+ in such a way that they won't cause the
+ entire release task to fail if mtasc is not
+ available - make mtasc optional.
+ -->
+ <script language="javascript"><![CDATA[
+ function echo(msg){
+ var echo = dojo.createTask("echo");
+ echo.setMessage(msg);
+ echo.execute();
+ }
+
+ function antCall(target){
+ var antCall = dojo.createTask("antcall");
+ antCall.setTarget(target);
+ antCall.execute();
+ }
+
+ try{
+ antCall("buildDojoFlash");
+ antCall("buildDojoStorage");
+ }catch(exp){
+ echo("WARNING: buildDojoFlash and buildDojoStorage could not run.");
+ echo("Please download and install mtasc from http://www.mtasc.org and place it in your path.");
+ }
+ ]]></script>
+
+ <antcall target="-docs-and-tests" />
+ <antcall target="compress" />
+ <!-- <antcall target="intern-strings" /> -->
+
+ <!-- Run xdgen if it xdomain loading is wanted. -->
+ <condition property="xdgenRun">
+ <equals arg1="xdomain" arg2="${dojoLoader}"/>
+ </condition>
+ <antcall target="xdgenRelease"/>
+
+ <copy overwrite="true" file="../iframe_history.html" todir="${release_dir}/" preservelastmodified="true" />
+
+ <copy file="${root}/LICENSE" todir="${release_dir}/" preservelastmodified="true" />
+ <copy file="${root}/README" todir="${release_dir}/" preservelastmodified="true" />
+ </target>
+ <!-- end release task -->
+
+ <target name="-docs-and-tests"
+ unless="docless"
+ description="builds docs, copies in tests, and constructs API outlines">
+ <copy todir="${release_dir}/apis" includeEmptyDirs="false" preservelastmodified="true">
+ <fileset dir="${root}/documents/apis">
+ <include name="**" />
+ <exclude name="**/*.swp" />
+ <exclude name="**/.svn*" />
+ </fileset>
+ </copy>
+
+ <antcall target="docs" />
+ </target>
+
+ <!-- zip task -->
+ <target name="zip"
+ description="builds zip file of release files">
+ <zip destfile="${root}/release/${project}_${version}.zip" basedir="${root}/release/${project}"/>
+ </target>
+ <!-- end zip task -->
+
+ <!-- tar task -->
+ <target name="tar"
+ description="builds tarball of release files">
+ <tar tarfile="${root}/release/${project}_${version}.tar" basedir="${root}/release" includes="${project}/**"/>
+ <gzip zipfile="${root}/release/${project}_${version}.tar.gz" src="${root}/release/${project}_${version}.tar"/>
+ <delete file="${root}/release/${project}_${version}.tar"/>
+ </target>
+ <!-- end tar task -->
+
+ <!-- buildDojoFlash task -->
+ <target name="buildDojoFlash"
+ description="builds the Dojo Flash package and its testing files">
+ <antcall target="buildFlash">
+ <param name="dojo.flash.file" value="${root}/tests/flash/HelloWorld.as"/>
+ </antcall>
+
+ <antcall target="buildFlash">
+ <param name="dojo.flash.file" value="${root}/tests/flash/UnitTestsComm.as"/>
+ </antcall>
+
+ <move todir="${root}/tests/flash/resources">
+ <fileset dir="${root}/tests/flash/">
+ <include name="*.swf"/>
+ </fileset>
+ </move>
+ </target>
+ <!-- end buildDojoFlash task -->
+
+ <!-- buildDojoStorage task -->
+ <target name="buildDojoStorage"
+ description="builds the Dojo Storage package">
+ <antcall target="buildFlash">
+ <param name="dojo.flash.file" value="${root}/${src}/storage/Storage.as"/>
+ </antcall>
+
+ <move todir="${root}">
+ <fileset dir="${root}/${src}/storage/">
+ <include name="*.swf"/>
+ </fileset>
+ </move>
+ </target>
+ <!-- end buildDojoStorage task -->
+
+ <!-- buildFlash task -->
+ <target name="buildFlash"
+ description="builds Flash ActionScript class to use dojo.flash.comm">
+ <!-- extract the ActionScript class name and path -->
+ <script language="javascript"><![CDATA[
+ var flashFile = dojo.getProperty("dojo.flash.file");
+
+ var matches = flashFile.match(/([A-Za-z0-9_]*)\.as$/);
+ var flashClass = matches[1];
+ dojo.setNewProperty("flashClass", flashClass);
+
+ var flashFileName = matches[0];
+ var endCut = new String(flashFile).length - flashFileName.length;
+ var flashPath = flashFile.substring(0, endCut);
+ dojo.setNewProperty("flashPath", flashPath);
+ ]]></script>
+
+ <!-- generate the Flash 6 SWF -->
+ <echo message="Flash 6: Compiling ${dojo.flash.file}..."/>
+
+ <exec executable="mtasc">
+ <arg value="-version"/>
+ <arg value="6"/>
+
+ <arg value="-cp"/>
+ <arg value="${root}/${src}/flash/flash6"/>
+
+ <arg value="-swf"/>
+ <arg value="${flashPath}/${flashClass}_version6.swf"/>
+
+ <arg value="-main"/>
+
+ <arg value="-header"/>
+ <arg value="215:138:10"/>
+
+ <arg value="${dojo.flash.file}"/>
+ </exec>
+
+ <!-- generate the Flash 8 SWF -->
+ <echo message="Flash 8: Compiling ${dojo.flash.file}..."/>
+
+ <exec executable="mtasc">
+ <arg value="-version"/>
+ <arg value="8"/>
+
+ <arg value="-cp"/>
+ <arg value="${root}/${src}/flash/flash8"/>
+
+ <arg value="-swf"/>
+ <arg value="${flashPath}/${flashClass}_version8.swf"/>
+
+ <arg value="-main"/>
+
+ <arg value="-header"/>
+ <arg value="215:138:10"/>
+
+ <arg value="${dojo.flash.file}"/>
+ </exec>
+ </target>
+ <!-- end buildFlash task -->
+
+ <!-- xdgenRelease task -->
+ <target name="xdgenRelease" if="xdgenRun">
+ <antcall target="xdgen">
+ <param name="xdgenDir" value="${release_dir}/src" />
+ </antcall>
+ </target>
+ <!-- end xdgenRelease task -->
+
+ <!-- xdgen task -->
+ <target name="xdgen"
+ description="Create package files that can be used as part of a cross domain dojo installation.">
+ <property name="xdgen.basedir" location="../tools/xdgen"/>
+ <property name="xdgen.src" location="${xdgen.basedir}/src"/>
+ <property name="xdgen.build" location="${xdgen.basedir}/build"/>
+
+ <mkdir dir="${xdgen.build}"/>
+
+ <!-- Compile xdgen if it hasn't been compiled yet -->
+ <javac srcdir="${xdgen.src}" destdir="${xdgen.build}" debug="true">
+ <classpath>
+ <fileset dir="${xdgen.basedir}/lib">
+ <include name="**/*.jar"/>
+ </fileset>
+ </classpath>
+ </javac>
+
+ <!-- Set up the classpath for the xdgen ant task. -->
+ <path id="xdgen.classpath">
+ <pathelement path="${classpath}"/>
+ <pathelement location="${xdgen.build}"/>
+ <fileset dir="./lib">
+ <include name="**/*.jar"/>
+ <include name="**/*.zip"/>
+ </fileset>
+ </path>
+
+ <!-- Define the xdgen ant task -->
+ <taskdef name="xdgenTask" classname="org.dojotoolkit.xdgen.XdGenAntTask">
+ <classpath refid="xdgen.classpath"/>
+ </taskdef>
+
+ <!-- Call the xdgen ant task -->
+ <xdgenTask>
+ <fileset dir="${xdgenDir}">
+ <include name="**/*.js"/>
+ </fileset>
+ </xdgenTask>
+ </target>
+ <!-- end xdgen task -->
+
+ <!-- xdgenRemove task -->
+ <target name="xdgenRemove"
+ description="Removes package files that were created by xdgen.">
+ <delete>
+ <fileset dir="${xdgenDir}" includes="**/*.xd.js"/>
+ </delete>
+ </target>
+ <!-- end xdgenRemove task -->
+
+</project>
Propchange: incubator/xap/trunk/buildscripts/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/buildscripts/buildUtil$py.class
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/buildscripts/buildUtil%24py.class?rev=432045&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/xap/trunk/buildscripts/buildUtil$py.class
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/xap/trunk/buildscripts/buildUtil.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/buildscripts/buildUtil.js?rev=432045&view=auto
==============================================================================
--- incubator/xap/trunk/buildscripts/buildUtil.js (added)
+++ incubator/xap/trunk/buildscripts/buildUtil.js Wed Aug 16 14:57:09 2006
@@ -0,0 +1,202 @@
+var buildUtil = {};
+buildUtil.getDependencyList = function(dependencies, hostenvType) {
+
+ djConfig = {
+ baseRelativePath: "../"
+ // ,isDebug: true
+ };
+
+ if(!dependencies){
+ dependencies = [
+ "dojo.event.*",
+ "dojo.io.*",
+ "dojo.string",
+ "dojo.xml.*",
+ "dojo.xml.Parse",
+ "dojo.widget.Parse",
+ "dojo.widget.Button"
+ ];
+ }
+
+ var dojoLoader = java.lang.System.getProperty("DOJO_LOADER");
+ if(!dojoLoader || dojoLoader=="null" || dojoLoader==""){
+ dojoLoader = "default";
+ }
+ var dj_global = {};
+
+ load("../src/dojo/src/bootstrap1.js");
+ load("../src/dojo/src/loader.js");
+ load("../src/dojo/src/hostenv_rhino.js");
+ load("../src/dojo/src/bootstrap2.js");
+ load("../src/xap/Xap.js");
+
+
+ // FIXME: is this really what we want to say?
+ dojo.render.html.capable = true;
+
+
+ dojo.hostenv.loadedUris.push("dojoGuardStart.js");
+ dojo.hostenv.loadedUris.push("../src/dojo/src/bootstrap1.js");
+
+ if(dojoLoader == "default"){
+ dojo.hostenv.loadedUris.push("../src/dojo/src/loader.js");
+
+ }else if(dojoLoader=="xdomain"){
+ dojo.hostenv.loadedUris.push("../src/dojo/src/loader.js");
+ dojo.hostenv.loadedUris.push("../src/dojo/src/loader_xd.js");
+ }
+ dojo.hostenv.loadedUris.push("dojoGuardEnd.js");
+
+ if(!hostenvType){
+ hostenvType = "browser";
+ }
+
+ if(hostenvType.constructor == Array){
+ for(var x=0; x<hostenvType.length; x++){
+ dojo.hostenv.loadedUris.push("../src/dojo/src/hostenv_"+hostenvType[x]+".js");
+ }
+ hostenvType = hostenvType.pop();
+ }else{
+ dojo.hostenv.loadedUris.push("../src/dojo/src/hostenv_"+hostenvType+".js");
+ }
+
+ dojo.hostenv.loadedUris.push("../src/dojo/src/bootstrap2.js");
+
+ dojo.hostenv.loadedUris.push("../src/xap/util/Utils.js");
+ dojo.hostenv.loadedUris.push("../src/xap/Xap.js");
+
+ if(dependencies["prefixes"]){
+ var tmp = dependencies.prefixes;
+ for(var x=0; x<tmp.length; x++){
+ dojo.setModulePrefix(tmp[x][0], tmp[x][1]);
+ }
+ }
+
+
+ dojo.hostenv.name_ = hostenvType;
+
+ function removeComments(contents){
+ // if we get the contents of the file from Rhino, it might not be a JS
+ // string, but rather a Java string, which will cause the replace() method
+ // to bomb.
+ contents = new String((!contents) ? "" : contents);
+ // clobber all comments
+ contents = contents.replace( /^(.*?)\/\/(.*)$/mg , "$1");
+ contents = contents.replace( /(\n)/mg , "__DOJONEWLINE");
+ contents = contents.replace( /\/\*(.*?)\*\//g , "");
+ return contents.replace( /__DOJONEWLINE/mg , "\n");
+ }
+
+ // over-write dj_eval to prevent actual loading of subsequent files
+ old_eval = dj_eval;
+ dj_eval = function(){ return true; }
+ old_load = load;
+ load = function(uri){
+ try{
+ var text = removeComments(readText(uri));
+ var requires = dojo.hostenv.getRequiresAndProvides(text);
+ eval(requires.join(";"));
+ dojo.hostenv.loadedUris.push(uri);
+ dojo.hostenv.loadedUris[uri] = true;
+ var delayRequires = dojo.hostenv.getDelayRequiresAndProvides(text);
+ eval(delayRequires.join(";"));
+ }catch(e){
+ print("load exception for: " + uri + ", exception: " + e);
+ }
+ return true;
+ }
+
+ dojo.hostenv.getRequiresAndProvides = function(contents){
+ // FIXME: should probably memoize this!
+ if(!contents){ return []; }
+
+ // check to see if we need to load anything else first. Ugg.
+ var deps = [];
+ var tmp;
+ RegExp.lastIndex = 0;
+ //var testExp = /dojo.(hostenv.loadModule|hostenv.require|require|kwCompoundRequire|hostenv.conditionalLoadModule|hostenv.startPackage|provide)\([\w\W]*?\)/mg;
+ var testExp = /(Xap.require\(\s*"[\w\W]*?\))|(Xap.provide\([\w\W]*?\))|(dojo.(hostenv.loadModule|hostenv.require|require|kwCompoundRequire|hostenv.conditionalLoadModule|hostenv.startPackage|provide)\([\w\W]*?\))/mg;
+
+ while ((tmp = testExp.exec(contents)) != null){
+ deps.push(tmp[0]);
+ }
+ return deps;
+ }
+
+ dojo.hostenv.getDelayRequiresAndProvides = function(contents){
+ // FIXME: should probably memoize this!
+ if(!contents){ return []; }
+
+ // check to see if we need to load anything else first. Ugg.
+ var deps = [];
+ var tmp;
+ RegExp.lastIndex = 0;
+ var testExp = /dojo.(requireAfterIf|requireIf)\([\w\W]*?\)/mg;
+ while((tmp = testExp.exec(contents)) != null){
+ deps.push(tmp[0]);
+ }
+ return deps;
+ }
+
+ for(var x=0; x<dependencies.length; x++){
+ try{
+ var dep = dependencies[x];
+ if(dep.indexOf("(") != -1){
+ dep = dojo.hostenv.getDepsForEval(dep)[0];
+ }
+
+ //Don't process loader_xd.js since it has some regexps
+ //and mentions of dojo.require/provide, which will cause
+ //havoc in the dojo.hostenv.loadModule() method.
+ if(dep.indexOf("loader_xd.js") == -1){
+ dojo.hostenv.loadModule(dep, null, true);
+ }
+ }catch(e){
+ print(e);
+ }
+ }
+
+ // FIXME: we should also provide some way of figuring out what files are the
+ // test files for the namespaces which are included and provide them in the
+ // final package.
+
+ // FIXME: should we turn __package__.js file clobbering on? It will break things if there's a subdir rolled up into a __package__
+ /*
+ for(var x=0; x<dojo.hostenv.loadedUris.length; x++){
+ print(dojo.hostenv.loadedUris[x].substr(-14));
+ if(dojo.hostenv.loadedUris[x].substr(-14) == "__package__.js"){
+ dojo.hostenv.loadedUris.splice(x, 1);
+ x--;
+ }
+ }
+ */
+
+ // print("URIs, in order: ");
+ // for(var x=0; x<dojo.hostenv.loadedUris.length; x++){
+ // print(dojo.hostenv.loadedUris[x]);
+ // }
+
+ var depList = [];
+ var seen = {};
+ uris: for(var x=0; x<dojo.hostenv.loadedUris.length; x++){
+ var curi = dojo.hostenv.loadedUris[x];
+ if(!seen[curi]){
+ seen[curi] = true;
+ if(dependencies["filters"]){
+ for(var i in dependencies.filters){
+ if(curi.match(dependencies.filters[i])){
+ continue uris;
+ }}}
+ depList.push(curi);
+ }
+ }
+
+ load = old_load; // restore the original load function
+ dj_eval = old_eval; // restore the original dj_eval function
+
+ dj_global['dojo'] = undefined;
+ dj_global['djConfig'] = undefined;
+ delete dj_global;
+
+ return depList;
+}
Propchange: incubator/xap/trunk/buildscripts/buildUtil.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/buildscripts/buildUtil.py
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/buildscripts/buildUtil.py?rev=432045&view=auto
==============================================================================
--- incubator/xap/trunk/buildscripts/buildUtil.py (added)
+++ incubator/xap/trunk/buildscripts/buildUtil.py Wed Aug 16 14:57:09 2006
@@ -0,0 +1,241 @@
+# NOTE: this file is a Jython script, and much of the code here would be
+# redundant in a normal CPython 2.3 environment (Jython implements Python
+# 2.1). We avoid Python2.3-isms like os.walk as a result.
+import sys
+sys.path.append("lib/pyLib.zip")
+import re
+import os
+import popen2
+import fnmatch
+import glob
+import string
+
+def escape(instr):
+ out = []
+ for x in xrange(len(instr)):
+ if instr[x] == "\\":
+ out.append("\\\\")
+ elif instr[x] == "\n":
+ out.append("\\n")
+ elif instr[x] == "\"":
+ out.append("\\\"")
+ else:
+ out.append(instr[x])
+ return string.join(out, "")
+
+
+def regexpMagic(loader, pkgString, srcRoot):
+ uriMethod = "dojo.uri.dojoUri"
+ #if loader == "xdomain":
+ # uriMethod = "dojo.uri.dojoUriXd"
+
+ # "Now they have two problems" -- jwz
+ # http://en.wikiquote.org/wiki/Jamie_Zawinski
+ matches = re.findall('(templatePath\s*=\s*(dojo\.uri\.(dojo)?Uri\(\s*)?"(.+)"(\s*\))?)', pkgString)
+ print matches
+ for x in matches:
+ replacement = "templateString=\""+escape(open(srcRoot+x[3]).read())+"\""
+ pkgString = string.replace(pkgString, x[0], replacement)
+
+ matches = re.findall('(templatePath\s*:\s*(dojo\.uri\.(dojo)?Uri\(\s*)?"([\w\.\/]+)"(\s*\))?)', pkgString)
+ print matches
+ for x in matches:
+ replacement = "templateString:\""+escape(open(srcRoot+x[3]).read())+"\""
+ pkgString = string.replace(pkgString, x[0], replacement)
+
+ #Find template CSS stuff.
+ matches = re.findall('(templateCssPath\s*:\s*(dojo\.uri\.(dojo)?Uri\(\s*)?"([\w\.\/]+)"(\s*\))?)', pkgString)
+ print matches
+ for x in matches:
+ replacement = "templateCssString:\""+escape(open(srcRoot+x[3]).read())+"\",templateCssPath:"+uriMethod+"(\""+x[3]+"\")"
+ pkgString = string.replace(pkgString, x[0], replacement)
+
+ #This regexp is a little weak because it assumes a "this" in front of the templateCssPath.
+ #In theory it could be something else, but in practice it is not, and it gets a little too weird
+ #to figure out, at least given the short amount of time this change is going in.
+ matches = re.findall('(this\.templateCssPath\s*=\s*(dojo\.uri\.(dojo)?Uri\(\s*)?"(.+)"(\s*\))?)', pkgString)
+ print matches
+ for x in matches:
+ replacement = "this.templateCssString=\""+escape(open(srcRoot+x[3]).read())+"\";this.templateCssPath="+uriMethod+"(\""+x[3]+"\")"
+ pkgString = string.replace(pkgString, x[0], replacement)
+ return pkgString
+
+def internTemplateStringsInFile(loader, packageFile, srcRoot):
+ print packageFile
+ pfd = open(packageFile)
+ pkgString = pfd.read()
+ pfd.close()
+
+ pkgString = regexpMagic(loader, pkgString, srcRoot)
+
+ pfd = open(packageFile, "w")
+ pfd.write(pkgString)
+ pfd.close() # flush is implicit
+
+
+def internXdFiles(loader, xdDir, srcRoot):
+ xdFiles = glob.glob1(xdDir, "*.xd.js")
+ for name in xdFiles:
+ print "XD INTERNING: " + name
+ internTemplateStringsInFile(loader, xdDir+os.sep+name, srcRoot)
+
+
+def internTemplateStrings(loader="default", packageDir="../release/dojo", srcRoot="../"):
+ #Fix up dojo.js
+ print "loader: " + loader
+ print "packageDir - " + packageDir
+ packageFile = packageDir+"/dojo.js"
+ #try:
+ internTemplateStringsInFile(loader, packageFile, srcRoot)
+ #except:
+ # packageFile = packageDir+"/__package__.js"
+ # internTemplateStringsInFile(loader, packageFile, srcRoot)
+
+ #If doing xdomain, then need to fix up the .xd.js files in the widget subdir.
+ #Hack alert! I am not patient enough to figure out how to do dir recursion
+ #in python right now.
+ internXdFiles(loader, packageDir+"/src/widget", srcRoot)
+ internXdFiles(loader, packageDir+"/src/widget/html", srcRoot)
+ internXdFiles(loader, packageDir+"/src/widget/svg", srcRoot)
+ internXdFiles(loader, packageDir+"/src/widget/vml", srcRoot)
+
+
+def replaceVersion(fileName, version):
+ verSegments = version.split('.')
+ majorValue = 0
+ minorValue = 0
+ patchValue = 0
+ flagValue = ""
+
+ if len(verSegments) > 0 and verSegments[0]:
+ majorValue = verSegments[0]
+ if len(verSegments) > 1 and verSegments[1]:
+ minorValue = verSegments[1]
+ if len(verSegments) > 2 and verSegments[2]:
+ patchValue = re.split('\D', verSegments[2])[0]
+ if len(patchValue) is not len(verSegments[2]):
+ flagValue = verSegments[2][len(patchValue):]
+ if len(verSegments) > 3 and verSegments[3]:
+ flagValue = verSegments[3]
+
+ pfd = open(fileName)
+ fileContents = pfd.read()
+ pfd.close()
+
+ matches = re.findall('(major:\s*\d*,\s*minor:\s*\d*,\s*patch:\s*\d*,\s*flag:\s*".*?"\s*,)', fileContents)
+ for x in matches:
+ replacement = "major: " + majorValue + ", minor: " + minorValue + ", patch: " + patchValue + ", flag: \"" + flagValue + "\","
+ fileContents = string.replace(fileContents, x, replacement)
+
+ pfd = open(fileName, "w")
+ pfd.write(fileContents)
+ pfd.close() # flush is implicit
+
+def removeRequires(fileName):
+ pfd = open(fileName)
+ fileContents = pfd.read()
+ pfd.close()
+
+ r = re.compile("^dojo\.(require|requireAfterIf|requireIf|kwCompoundRequire)\(.*?\);.*?\n", re.S|re.M)
+ newContents = r.sub("", fileContents)
+
+ pfd = open(fileName, "w")
+ pfd.write(newContents)
+ pfd.close() # flush is implicit
+
+def buildRestFiles(docDir, docOutDir, styleSheetFile, restFiles=""):
+ docFiles = []
+
+ # start in docDir and add all the reST files in the directory to the
+ # list
+ docDir = os.path.normpath(os.path.abspath(docDir))
+ styleSheetFile = os.path.normpath(os.path.abspath(styleSheetFile))
+ docOutDir = os.path.normpath(os.path.abspath(docOutDir))
+
+ if not len(restFiles):
+ docFiles = glob.glob1(docDir, "*.rest")
+ else:
+ docFiles = map(lambda x: x.strip(), restFiles.split(","))
+
+ for name in docFiles:
+ x = docDir+os.sep+name
+ if x.find(os.sep+".svn") == -1:
+ # print x
+ cmdStr = "rst2html.py --no-doc-info --no-doc-title --embed-stylesheet --stylesheet-path=%s %s %s" % \
+ (styleSheetFile, x, docOutDir+os.sep+(name[0:-5])+".html")
+
+ # I'd much rather be using popen3, but it doesn't appear to be
+ # available from either the os.* or popen2.* modules in a useable
+ # way. The source of popen2.py leads me to believe that this is an
+ # underlying Java issue.
+ os.system("echo `which rst2html.py`")
+ os.system(cmdStr)
+ # java.lang.Runtime.exec(??)
+
+ if not len(restFiles):
+ for name in os.listdir(docDir):
+ tn = os.path.normpath(docDir+os.sep+name)
+ if os.path.isdir(tn) and not name == ".svn":
+ buildRestFiles(tn, docOutDir+os.sep+name, styleSheetFile)
+
+def norm(path):
+ path = os.path.normpath(os.path.abspath(path))
+ if os.sep == '\\':
+ return path.replace("\\", "\\\\")
+ else:
+ return path
+
+def buildTestFiles( testDir="../tests/",
+ testOutFile="../testRunner.js",
+ prologueFile="../tests/prologue.js",
+ epilogueFile="../tests/epilogue.js",
+ jumFile="../testtools/JsTestManager/jsunit_wrap.js",
+ domImplFile="../testtools/JsFakeDom/BUFakeDom.js",
+ dojoRootPath="../"):
+ # FIXME: need to test for file existance of all the passed file names
+
+ testOutFile = norm(testOutFile)
+ if os.path.isfile(testOutFile):
+ print "rebuilding %s" % (testOutFile,)
+ os.unlink(testOutFile)
+
+ testOutFD = open(testOutFile, "w+")
+ testOutFD.write("""
+
+djConfig = {
+ baseRelativePath: "%s/",
+ isDebug: true
+};
+
+load("%s/dojo.js");
+
+load("%s",
+ "%s",
+ "%s");
+""" % (norm(dojoRootPath), norm(dojoRootPath), norm(prologueFile), norm(domImplFile), norm(jumFile))
+ )
+
+ testFiles = findTestFiles(testDir)
+ for fn in testFiles:
+ testOutFD.write("""load("%s");\n""" % (norm(fn),))
+
+ testOutFD.write("""
+load("%s");
+jum.init();
+jum.runAll();""" % (norm(epilogueFile),))
+ testOutFD.close()
+
+def findTestFiles(testDir="../tests"):
+ testFiles = glob.glob1(testDir, "test*.js")
+ dirFiles = os.listdir(testDir)
+ for name in dirFiles:
+ if os.path.isdir(testDir+os.sep+name):
+ if name[0] == ".": continue
+ testFiles.extend(findTestFiles(testDir+os.sep+name))
+ for x in xrange(len(testFiles)):
+ if not os.path.isabs(testFiles[x]):
+ testFiles[x] = norm(testDir+os.sep+testFiles[x])
+ # testFiles = map(lambda x: os.path.abspath(testDir+os.sep+x), testFiles)
+ return testFiles
+
+# vim:ai:ts=4:noet:textwidth=80
Propchange: incubator/xap/trunk/buildscripts/buildUtil.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/buildscripts/buildUtil.test.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/buildscripts/buildUtil.test.js?rev=432045&view=auto
==============================================================================
--- incubator/xap/trunk/buildscripts/buildUtil.test.js (added)
+++ incubator/xap/trunk/buildscripts/buildUtil.test.js Wed Aug 16 14:57:09 2006
@@ -0,0 +1,21 @@
+load('buildUtil.js');
+buildUtil.isDebug = true;
+
+function printA(array) {
+ print(" " + array.join("\n "));
+}
+
+function test(deps) {
+ print("Dependencies:");
+ printA(deps)
+ print("Resolved:");
+ printA(buildUtil.getDependencyList(deps));
+ print("");
+}
+
+test(['dojo.widget.Button']);
+test(['dojo.widget.Button']);
+
+print("")
+print("Note : MISSING dojo.widget.Button from second run")
+
Propchange: incubator/xap/trunk/buildscripts/buildUtil.test.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/buildscripts/buildUtilExt.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/buildscripts/buildUtilExt.js?rev=432045&view=auto
==============================================================================
--- incubator/xap/trunk/buildscripts/buildUtilExt.js (added)
+++ incubator/xap/trunk/buildscripts/buildUtilExt.js Wed Aug 16 14:57:09 2006
@@ -0,0 +1,91 @@
+load('buildUtil.js');
+
+buildUtil.isDebug = false;
+
+buildUtil.debug = function() {
+ if (!buildUtil.isDebug) return;
+ var s = [];
+ for (var i = 0; i < arguments.length; i++) {
+ s.push(arguments[i]);
+ }
+ print(s.join(" "));
+}
+
+buildUtil.copyArray = function(source, dest) {
+ for (var i = 0 ; i < source.length; i++) {
+ dest.push(source[i]);
+ }
+}
+
+// return a new array containg (a - b)
+buildUtil.subtractArray = function(a, b) {
+
+ var list = [];
+ // hash all items in b for faster lookups
+ var bHash = {};
+ for (var i = 0; i < b.length; i++) {
+ bHash[b[i]] = true;
+ }
+
+ for (var i = 0; i < a.length; i++) {
+ if (!bHash[a[i]]) {
+ list.push(a[i]);
+ }
+ }
+ return list;
+}
+
+
+// TODO : detect cyclic dependencies and throw an error
+buildUtil.getParentDeps = function(profiles, name) {
+
+ var deps = [];
+
+ var profileDepNames = profiles[name].profileDeps || [];
+ for (var i = 0 ; i < profileDepNames.length; i++) {
+ var profileDepName = profileDepNames[i];
+
+ var profileDep = profiles[profileDepName];
+
+ // add the profile's dependencies
+ buildUtil.copyArray(profileDep.dependencies, deps);
+
+ //buildUtil.debug('getParentDeps', profileDepName, profileDep.dependencies.join(", "));
+
+ // traverse up the tree, to add its parent's deps
+ var parentDeps = buildUtil.getParentDeps(profiles, profileDepName);
+
+ buildUtil.copyArray(parentDeps, deps);
+
+ }
+
+ return deps;
+}
+
+buildUtil.getDepsExcludingParentDeps = function(profiles, name) {
+
+ var profile = profiles[name];
+
+ buildUtil.debug('myDeps:', profile.dependencies.join(", "), '\n');
+
+ var myIncludes = buildUtil.getDependencyList(profile.dependencies);
+ buildUtil.debug('myIncludes:', myIncludes.join(", "), '\n');
+
+ var parentDeps = buildUtil.getParentDeps(profiles, name);
+
+ buildUtil.debug('parentDeps', parentDeps.join(", "), '\n');
+
+ if (parentDeps.length > 0) {
+ var parentIncludes = buildUtil.getDependencyList(parentDeps);
+ buildUtil.debug('parentIncludes', parentIncludes.join(', '), '\n');
+ return buildUtil.subtractArray(myIncludes, parentIncludes);
+ }
+ else {
+ return myIncludes;
+ }
+
+}
+
+buildUtil.printDepsExcludingParentDeps = function(profiles, name) {
+ print(buildUtil.getDepsExcludingParentDeps(profiles, name).join("\n"));
+}
\ No newline at end of file
Propchange: incubator/xap/trunk/buildscripts/buildUtilExt.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/buildscripts/build_notice.txt
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/buildscripts/build_notice.txt?rev=432045&view=auto
==============================================================================
--- incubator/xap/trunk/buildscripts/build_notice.txt (added)
+++ incubator/xap/trunk/buildscripts/build_notice.txt Wed Aug 16 14:57:09 2006
@@ -0,0 +1,9 @@
+/*
+ This is a compiled version of Dojo, built for deployment and not for
+ development. To get an editable version, please visit:
+
+ http://dojotoolkit.org
+
+ for documentation and information on getting the source.
+*/
+
Propchange: incubator/xap/trunk/buildscripts/build_notice.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/buildscripts/copyright.txt
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/buildscripts/copyright.txt?rev=432045&view=auto
==============================================================================
--- incubator/xap/trunk/buildscripts/copyright.txt (added)
+++ incubator/xap/trunk/buildscripts/copyright.txt Wed Aug 16 14:57:09 2006
@@ -0,0 +1,10 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
Propchange: incubator/xap/trunk/buildscripts/copyright.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/buildscripts/doctool/README
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/buildscripts/doctool/README?rev=432045&view=auto
==============================================================================
--- incubator/xap/trunk/buildscripts/doctool/README (added)
+++ incubator/xap/trunk/buildscripts/doctool/README Wed Aug 16 14:57:09 2006
@@ -0,0 +1,8 @@
+As a Dojo contributor, you should be a aware that code in this directory MAY
+NOT belong to the Dojo Foundation, and therefore MAY be goverened under
+licensing terms not determined by the Foundation. While your patches and
+contributions are governed under the terms of the CLA which you submitted in
+order to gain commit privledges, the licensing assurances made therein DO NOT
+apply to code in this directory.
+
+Modify code contained within at your own risk.
Propchange: incubator/xap/trunk/buildscripts/doctool/README
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/buildscripts/doctool/inline.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/buildscripts/doctool/inline.html?rev=432045&view=auto
==============================================================================
--- incubator/xap/trunk/buildscripts/doctool/inline.html (added)
+++ incubator/xap/trunk/buildscripts/doctool/inline.html Wed Aug 16 14:57:09 2006
@@ -0,0 +1,144 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+
+<script type="text/javascript"> var djConfig = { isDebug: true } </script>
+<script type="text/javascript" src="../../release/dojo/dojo.js"></script>
+
+<style type="text/css">
+ pre { border: 1px solid black; padding: 1em; background: #eee; }
+</style>
+
+<script type="text/javascript">
+
+function props (e, name, descend) {
+ if (arguments.length == 2) { descend = true; }
+ var ns = ["Methods", "Properties", "Unreachables"];
+ var as = [[], [], []]; // array of (empty) arrays of arrays!
+ var p, j, i; // loop variables, several used multiple times
+
+ var protoLevels = 0;
+
+ for (p = e; p; p = p.__proto__) {
+ for (i = 0; i < ns.length; ++i) { as[i][protoLevels] = []; }
+ ++protoLevels;
+ }
+
+ var propLength = function (o) { var i = 0; for (p in o) { i++; }; return i; }
+
+ for (var a in e) {
+ // Shortcoming: doesn't check that VALUES are the same in object and prototype.
+
+ var protoLevel = -1;
+ try {
+ for (p = e; p && (a in p); p = p.__proto__) { ++protoLevel; }
+ } catch (er) { protoLevel = 0; } // "in" operator throws when param to props() is a string
+
+ var type = 1;
+ try {
+ if (dojo.lang.isFunction(e[a])) { type = 0; }
+ } catch (er) { type = 2; }
+
+ if (a.indexOf("$joinpoint") != -1 || a.indexOf("_") == 0
+ || a.lastIndexOf("_") == a.length - 1) { continue; }
+
+ if (type == 1 && /^[A-Z]/.test(a) && propLength(e[a]) == 0) { continue; }
+
+ as[type][protoLevel].push(a);
+ }
+
+ function times (s, n) { return n ? s + times(s, n-1) : ""; }
+
+ if (name.split(".").length == 2) {
+ document.body.appendChild(document.createTextNode("\n------" + name.split(".")[1] + "\n"));
+ }
+
+ for (j = 0; j < 1 && j < protoLevels; ++j) {
+ var h2 = document.createElement("h2");
+ h2.appendChild(document.createTextNode(name));
+ h2.setAttribute("id", name);
+ document.body.appendChild(h2);
+ for (i = 0;i < ns.length; ++i) {
+ if (as[i][j].length) {
+ var h3 = document.createElement("h3");
+ h3.appendChild(document.createTextNode(ns[i]));
+ document.body.appendChild(h3);
+
+ var pre = document.createElement("pre");
+ for (var k = 0; k < as[i][j].length; k++) {
+ if (i == 1) {
+ var obj = e[as[i][j][k]];
+ with (dojo.lang) {
+ if (isArray(obj)) { var type = "Array"; }
+ else if (isNumber(obj)) { var type = "Number"; }
+ else if (isString(obj)) { var type = "String"; }
+ else if (isBoolean(obj)) { var type = "Boolean"; }
+ else if (isUndefined(obj)) { var type = "undefined"; }
+ else { var type = "Object"; }
+ }
+ pre.appendChild(document.createTextNode(type + " "));
+ if (type == "Object" && (propLength(obj) > 0 || /^[A-Z]/.test(as[i][j][k]))) {
+ var a = document.createElement("a");
+ a.href = "#" + name + "." + as[i][j][k];
+ a.appendChild(document.createTextNode(as[i][j][k]));
+ pre.appendChild(a);
+ } else {
+ pre.appendChild(document.createTextNode(as[i][j][k]));
+ }
+ pre.appendChild(document.createTextNode("\n"));
+ } else if (i == 0) {
+ pre.appendChild(document.createTextNode(as[i][j][k] + " "));
+ var args = e[as[i][j][k]].toString().match(/\([^\)]*\)/)[0];
+ pre.appendChild(document.createTextNode(args + "\n"));
+ } else {
+ pre.appendChild(document.createTextNode(as[i][j][k] + "\n"));
+ }
+ }
+ document.body.appendChild(pre);
+ }
+ }
+ if (document.body.lastChild == h2) { document.body.removeChild(h2); }
+ }
+
+ if (descend) {
+
+ if (as[0][0]) {
+ for (i = 0; i < as[0][0].length; i++) {
+ if (/^[A-Z]/.test(as[0][0][i])) { // Object constructor
+ try {
+ var obj = new e[as[0][0][i]];
+ props(obj, name + "." + as[0][0][i] + " Object", false);
+ } catch (e) {}
+ }
+ }
+ }
+ if (as[1][0]) {
+ for (i = 0; i < as[1][0].length; i++) {
+ if (typeof e[as[1][0][i]] == "object" && !(e[as[1][0][i]] instanceof Array)) {
+ props(e[as[1][0][i]], name + "." + as[1][0][i], true);
+ }
+ }
+ }
+ }
+}
+
+dojo.event.connect(window, "onload", function (e) {
+ props(dojo, "dojo", true);
+});
+
+</script>
+
+<h2>Globals</h2>
+
+<pre>dj_undef
+dj_eval_object_path
+dj_error_to_string
+dj_eval
+dj_load
+dj_last_script_src
+dj_addNodeEvtHdlr</pre>
+
+<pre>djConfig
+dj_global
+dojo
+DJ_XMLHTTP_PROGIDS
+dojo_ie_clobber</pre>
Propchange: incubator/xap/trunk/buildscripts/doctool/inline.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/buildscripts/doctool/inline.py
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/buildscripts/doctool/inline.py?rev=432045&view=auto
==============================================================================
--- incubator/xap/trunk/buildscripts/doctool/inline.py (added)
+++ incubator/xap/trunk/buildscripts/doctool/inline.py Wed Aug 16 14:57:09 2006
@@ -0,0 +1,12 @@
+#!/usr/bin/python
+
+docfile = open("inline_generated.html", "r")
+docfilelines = docfile.readlines()
+
+subdocfile = False
+
+for line in docfilelines:
+ if line[:6] == "------":
+ subdocfile = open('%s.html' % line[6:-1], "w")
+ elif subdocfile:
+ subdocfile.write(line)
Propchange: incubator/xap/trunk/buildscripts/doctool/inline.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/buildscripts/doctool/narcissus/CVS/Entries
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/buildscripts/doctool/narcissus/CVS/Entries?rev=432045&view=auto
==============================================================================
--- incubator/xap/trunk/buildscripts/doctool/narcissus/CVS/Entries (added)
+++ incubator/xap/trunk/buildscripts/doctool/narcissus/CVS/Entries Wed Aug 16 14:57:09 2006
@@ -0,0 +1,5 @@
+/js.js/1.5/Sat Aug 20 17:55:33 2005//
+/jsdefs.js/1.2/Sat Aug 20 17:55:34 2005//
+/jsexec.js/1.21/Sat Aug 20 17:55:34 2005//
+/jsparse.js/1.16/Sat Aug 20 17:55:34 2005//
+D
Added: incubator/xap/trunk/buildscripts/doctool/narcissus/CVS/Repository
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/buildscripts/doctool/narcissus/CVS/Repository?rev=432045&view=auto
==============================================================================
--- incubator/xap/trunk/buildscripts/doctool/narcissus/CVS/Repository (added)
+++ incubator/xap/trunk/buildscripts/doctool/narcissus/CVS/Repository Wed Aug 16 14:57:09 2006
@@ -0,0 +1 @@
+/cvsroot/mozilla/js/narcissus
Added: incubator/xap/trunk/buildscripts/doctool/narcissus/CVS/Root
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/buildscripts/doctool/narcissus/CVS/Root?rev=432045&view=auto
==============================================================================
--- incubator/xap/trunk/buildscripts/doctool/narcissus/CVS/Root (added)
+++ incubator/xap/trunk/buildscripts/doctool/narcissus/CVS/Root Wed Aug 16 14:57:09 2006
@@ -0,0 +1 @@
+:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
Added: incubator/xap/trunk/buildscripts/doctool/narcissus/js.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/buildscripts/doctool/narcissus/js.js?rev=432045&view=auto
==============================================================================
--- incubator/xap/trunk/buildscripts/doctool/narcissus/js.js (added)
+++ incubator/xap/trunk/buildscripts/doctool/narcissus/js.js Wed Aug 16 14:57:09 2006
@@ -0,0 +1,73 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Narcissus JavaScript engine.
+ *
+ * The Initial Developer of the Original Code is
+ * Brendan Eich <br...@mozilla.org>.
+ * Portions created by the Initial Developer are Copyright (C) 2004
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Narcissus - JS implemented in JS.
+ *
+ * Native objects and classes implemented metacircularly:
+ * the global object (singleton)
+ * eval
+ * function objects, Function
+ *
+ * SpiderMonkey extensions used:
+ * catch guards
+ * const declarations
+ * get and set functions in object initialisers
+ * Object.prototype.__defineGetter__
+ * Object.prototype.__defineSetter__
+ * Object.prototype.__defineProperty__
+ * Object.prototype.__proto__
+ * filename and line number arguments to *Error constructors
+ * callable regular expression objects
+ *
+ * SpiderMonkey extensions supported metacircularly:
+ * catch guards
+ * const declarations
+ * get and set functions in object initialisers
+ */
+
+/*
+ * Loads a file relative to the calling script's (our) source directory, and not
+ * the directory that the executing shell is being run out of.
+ */
+function my_load(filename) {
+ evaluate(snarf(filename), filename, 1);
+}
+
+my_load('jsdefs.js');
+my_load('jsparse.js');
+my_load('jsexec.js');
+
Propchange: incubator/xap/trunk/buildscripts/doctool/narcissus/js.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/buildscripts/doctool/narcissus/jsdefs.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/buildscripts/doctool/narcissus/jsdefs.js?rev=432045&view=auto
==============================================================================
--- incubator/xap/trunk/buildscripts/doctool/narcissus/jsdefs.js (added)
+++ incubator/xap/trunk/buildscripts/doctool/narcissus/jsdefs.js Wed Aug 16 14:57:09 2006
@@ -0,0 +1,169 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Narcissus JavaScript engine.
+ *
+ * The Initial Developer of the Original Code is
+ * Brendan Eich <br...@mozilla.org>.
+ * Portions created by the Initial Developer are Copyright (C) 2004
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Narcissus - JS implemented in JS.
+ *
+ * Well-known constants and lookup tables. Many consts are generated from the
+ * tokens table via eval to minimize redundancy, so consumers must be compiled
+ * separately to take advantage of the simple switch-case constant propagation
+ * done by SpiderMonkey.
+ */
+const GLOBAL = this;
+
+var tokens = [
+ // End of source.
+ "END",
+
+ // Operators and punctuators. Some pair-wise order matters, e.g. (+, -)
+ // and (UNARY_PLUS, UNARY_MINUS).
+ "\n", ";",
+ ",",
+ "=",
+ "?", ":", "CONDITIONAL",
+ "||",
+ "&&",
+ "|",
+ "^",
+ "&",
+ "==", "!=", "===", "!==",
+ "<", "<=", ">=", ">",
+ "<<", ">>", ">>>",
+ "+", "-",
+ "*", "/", "%",
+ "!", "~", "UNARY_PLUS", "UNARY_MINUS",
+ "++", "--",
+ ".",
+ "[", "]",
+ "{", "}",
+ "(", ")",
+
+ // Nonterminal tree node type codes.
+ "SCRIPT", "BLOCK", "LABEL", "FOR_IN", "CALL", "NEW_WITH_ARGS", "INDEX",
+ "ARRAY_INIT", "OBJECT_INIT", "PROPERTY_INIT", "GETTER", "SETTER",
+ "GROUP", "LIST",
+
+ // Terminals.
+ "IDENTIFIER", "NUMBER", "STRING", "REGEXP",
+
+ // Keywords.
+ "break",
+ "case", "catch", "const", "continue",
+ "debugger", "default", "delete", "do",
+ "else", "enum",
+ "false", "finally", "for", "function",
+ "if", "in", "instanceof",
+ "new", "null",
+ "return",
+ "switch",
+ "this", "throw", "true", "try", "typeof",
+ "var", "void",
+ "while", "with",
+];
+
+// Operator and punctuator mapping from token to tree node type name.
+// NB: superstring tokens (e.g., ++) must come before their substring token
+// counterparts (+ in the example), so that the opRegExp regular expression
+// synthesized from this list makes the longest possible match.
+var opTypeNames = {
+ '\n': "NEWLINE",
+ ';': "SEMICOLON",
+ ',': "COMMA",
+ '?': "HOOK",
+ ':': "COLON",
+ '||': "OR",
+ '&&': "AND",
+ '|': "BITWISE_OR",
+ '^': "BITWISE_XOR",
+ '&': "BITWISE_AND",
+ '===': "STRICT_EQ",
+ '==': "EQ",
+ '=': "ASSIGN",
+ '!==': "STRICT_NE",
+ '!=': "NE",
+ '<<': "LSH",
+ '<=': "LE",
+ '<': "LT",
+ '>>>': "URSH",
+ '>>': "RSH",
+ '>=': "GE",
+ '>': "GT",
+ '++': "INCREMENT",
+ '--': "DECREMENT",
+ '+': "PLUS",
+ '-': "MINUS",
+ '*': "MUL",
+ '/': "DIV",
+ '%': "MOD",
+ '!': "NOT",
+ '~': "BITWISE_NOT",
+ '.': "DOT",
+ '[': "LEFT_BRACKET",
+ ']': "RIGHT_BRACKET",
+ '{': "LEFT_CURLY",
+ '}': "RIGHT_CURLY",
+ '(': "LEFT_PAREN",
+ ')': "RIGHT_PAREN"
+};
+
+// Hash of keyword identifier to tokens index. NB: we must null __proto__ to
+// avoid toString, etc. namespace pollution.
+var keywords = {__proto__: null};
+
+// Define const END, etc., based on the token names. Also map name to index.
+var consts = "const ";
+for (var i = 0, j = tokens.length; i < j; i++) {
+ if (i > 0)
+ consts += ", ";
+ var t = tokens[i];
+ if (/^[a-z]/.test(t)) {
+ consts += t.toUpperCase();
+ keywords[t] = i;
+ } else {
+ consts += (/^\W/.test(t) ? opTypeNames[t] : t);
+ }
+ consts += " = " + i;
+ tokens[t] = i;
+}
+eval(consts + ";");
+
+// Map assignment operators to their indexes in the tokens array.
+var assignOps = ['|', '^', '&', '<<', '>>', '>>>', '+', '-', '*', '/', '%'];
+
+for (i = 0, j = assignOps.length; i < j; i++) {
+ t = assignOps[i];
+ assignOps[t] = tokens[t];
+}
Propchange: incubator/xap/trunk/buildscripts/doctool/narcissus/jsdefs.js
------------------------------------------------------------------------------
svn:eol-style = native