Changeset 12119

Show
Ignore:
Timestamp:
01/21/08 20:42:32 (6 months ago)
Author:
jburke
Message:

Refs #4573. Allow for burning in a djConfig for a built version. Still need to convert codebase to dojo.config, but this is a first step. \!strict (redeclaration errors)

Location:
util/trunk/buildscripts
Files:
3 modified

Legend:

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

    r12009 r12119  
    130130                } 
    131131                nlsIgnoreString += (nlsIgnoreString ? "|" : "") + buildUtil.regExpEscape(nameSegment); 
    132                  
    133                  
     132 
     133                //Burn in djConfig for dojo.js/xd.js if requested. 
     134                if(kwArgs.scopeDjConfig && (layerName.match(/dojo\.xd\.js$/) || layerName.match(/dojo\.js$/))){ 
     135                        fileContents = buildUtil.setScopeDjConfig(fileContents, kwArgs.scopeDjConfig); 
     136                } 
     137 
    134138                //Burn in scope names for dojo.js/xd.js if requested. 
    135139                if(kwArgs.scopeMap && (layerName.match(/dojo\.xd\.js$/) || layerName.match(/dojo\.js$/))){ 
  • util/trunk/buildscripts/jslib/buildUtil.js

    r12009 r12119  
    9393                        + "short symbol names to more descriptive names." 
    9494        }, 
     95        "scopeDjConfig": { 
     96                defaultValue: "", 
     97                helpText: "Burn in a djConfig object into the built dojo.js file. Useful if you are making your own scoped dojo and you want a " 
     98                        + "djConfig object local to your version that will not be affected by any globally declared djConfig object in the page. " 
     99                        + "Value must be a string that will look like a javascript object literal once it is placed in the built source. " 
     100                        + "use Dojo as part of a JS library, but want to make a self-contained library with no external dojo/dijit/dojox. Example " 
     101                        + "(note that the backslashes below are required to avoid shell escaping if you type this on the command line):\n" 
     102                        + "scopeDjConfig={isDebug:true,scopeMap:[[\\\"dojo\\\",\\\"mydojo\\\"],[\\\"dijit\\\",\\\"mydijit\\\"][\\\"dojox\\\",\\\"mydojox\\\"]]}" 
     103        }, 
    95104        "scopeMap": { 
    96105                defaultValue: "", 
     
    99108                        + "references. Format is a string that contains no spaces, and is similar to the djConfig.scopeMap value (note that the " 
    100109                        + "backslashes below are required to avoid shell escaping):\n" 
    101                         + "scopeMap: [[\\\"dojo\\\",\\\"mydojo\\\"],[\\\"dijit\\\",\\\"mydijit\\\"][\\\"dojox\\\",\\\"mydojox\\\"]]" 
     110                        + "scopeMap=[[\\\"dojo\\\",\\\"mydojo\\\"],[\\\"dijit\\\",\\\"mydijit\\\"][\\\"dojox\\\",\\\"mydojox\\\"]]" 
    102111        }, 
    103112        "xdScopeArgs": { 
     
    12381247} 
    12391248 
     1249buildUtil.setScopeDjConfig = function(/*String*/fileContents, /*String*/djConfigString){ 
     1250        //summary: burns in a local djConfig for the file contents. 
     1251        //djConfigString should be a string. 
     1252        //Have to use eval to avoid name condensing by shrinksafe. 
     1253        return fileContents.replace(/\/\*\*Build will replace this comment with a scoped djConfig \*\*\//, 'eval("var djConfig = ' + djConfigString.replace(/(['"])/g, '\\$1') + ';");'); 
     1254} 
     1255 
    12401256buildUtil.setScopeNames = function(/*String*/fileContents, /*String*/scopeMap){ 
    12411257        //summary: burns in the scope names into the file contents. 
  • util/trunk/buildscripts/jslib/dojoGuardStart.jsfrag

    r12009 r12119  
    1111        */ 
    1212 
    13         //The null below can be relaced by a build-time value. 
     13        /**Build will replace this comment with a scoped djConfig **/ 
     14 
     15        //The null below can be relaced by a build-time value used instead of djConfig.scopeMap. 
    1416        var sMap = null; 
    15          
     17 
    1618        //See if new scopes need to be defined. 
    1719        if((sMap || (typeof djConfig != "undefined" && djConfig.scopeMap)) && (typeof window != "undefined")){