Changeset 7074

Show
Ignore:
Timestamp:
01/24/07 14:37:54 (22 months ago)
Author:
jburke
Message:

References #2366. web build plumbing. Not quite there. The end result is showing a textarea with the dojo contents. Need to send to CGI to trigger file download. Too bad.

Location:
trunk/buildscripts
Files:
4 added
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/buildscripts/buildUtil.js

    r7003 r7074  
    11var buildUtil = {}; 
    2 buildUtil.getDependencyList = function(dependencies, hostenvType) { 
    3         djConfig = { 
    4                 baseRelativePath: "../" 
    5                 // isDebug: true 
    6         }; 
    7          
     2 
     3buildUtil.getLineSeparator = function(){ 
     4        //summary: Gives the line separator for the platform. 
     5        //For web builds override this function. 
     6        return java.lang.System.getProperty("line.separator"); 
     7} 
     8 
     9buildUtil.getDojoLoader = function(/*Object?*/dependencies){ 
     10        //summary: gets the type of Dojo loader for the build. For example default or 
     11        //xdomain loading. Override for web builds. 
     12        return (dependencies && dependencies["loader"] ? dependencies["loader"] : java.lang.System.getProperty("DOJO_LOADER")); 
     13} 
     14 
     15buildUtil.getDependencyList = function(/*Object*/dependencies, /*String or Array*/hostenvType, /*boolean?*/isWebBuild){ 
     16        if(!isWebBuild){ 
     17                djConfig = { 
     18                        baseRelativePath: "../" 
     19                        // isDebug: true 
     20                }; 
     21        } 
     22 
    823        if(!dependencies){ 
    924                dependencies = [  
     
    1833        } 
    1934         
    20         var dojoLoader = dependencies["loader"]||java.lang.System.getProperty("DOJO_LOADER"); 
     35        var dojoLoader = buildUtil.getDojoLoader(dependencies); 
    2136        if(!dojoLoader || dojoLoader=="null" || dojoLoader==""){ 
    2237                dojoLoader = "default"; 
    2338        } 
    24         dj_global = {}; 
    25          
    26         load("../src/bootstrap1.js"); 
    27         load("../src/loader.js"); 
    28         load("../src/hostenv_rhino.js"); 
    29         load("../src/bootstrap2.js"); 
    30  
    31         // FIXME: is this really what we want to say? 
    32         dojo.render.html.capable = true; 
    33          
     39 
     40        if(!isWebBuild){ 
     41                dj_global = {}; 
     42                 
     43                load("../src/bootstrap1.js"); 
     44                load("../src/loader.js"); 
     45                load("../src/hostenv_rhino.js"); 
     46                load("../src/bootstrap2.js"); 
     47         
     48                // FIXME: is this really what we want to say? 
     49                dojo.render.html.capable = true; 
     50        } 
     51 
    3452        dojo.hostenv.loadedUris.push("dojoGuardStart.js"); 
    3553        dojo.hostenv.loadedUris.push("../src/bootstrap1.js"); 
     
    93111        load = function(uri){ 
    94112                try{ 
    95                         var text = removeComments(readText(uri)); 
     113                        var text = removeComments((isWebBuild ? dojo.hostenv.getText(uri) : readText(uri))); 
    96114                        var requires = dojo.hostenv.getRequiresAndProvides(text); 
    97115                        eval(requires.join(";")); 
     
    100118                        var delayRequires = dojo.hostenv.getDelayRequiresAndProvides(text); 
    101119                        eval(delayRequires.join(";")); 
    102                 }catch(e){  
    103                         java.lang.System.err.println("error loading uri: " + uri + ", exception: " + e); 
    104                         quit(-1); 
     120                }catch(e){ 
     121                        if(isWebBuild){ 
     122                                dojo.debug("error loading uri: " + uri + ", exception: " + e); 
     123                        }else{ 
     124                                java.lang.System.err.println("error loading uri: " + uri + ", exception: " + e); 
     125                                quit(-1); 
     126                        } 
    105127                } 
    106128                return true; 
     129        } 
     130         
     131        if(isWebBuild){ 
     132                dojo.hostenv.oldLoadUri = dojo.hostenv.loadUri; 
     133                dojo.hostenv.loadUri = load; 
    107134        } 
    108135         
     
    194221        } 
    195222         
    196         load = old_load; // restore the original load function 
    197         dj_eval = old_eval; // restore the original dj_eval function 
    198          
    199         dj_global['dojo'] = undefined; 
    200         dj_global['djConfig'] = undefined; 
    201         delete dj_global; 
    202                  
     223        if(isWebBuild){ 
     224                dojo.hostenv.loadUri = dojo.hostenv.oldLoadUri; 
     225        }else{ 
     226                load = old_load; // restore the original load function 
     227                dj_eval = old_eval; // restore the original dj_eval function 
     228 
     229                dj_global['dojo'] = undefined; 
     230                dj_global['djConfig'] = undefined; 
     231                delete dj_global; 
     232        } 
     233 
    203234        return { 
    204235                depList: depList, 
     
    224255} 
    225256 
    226 buildUtil.makeDojoJs = function(/*String*/profileFile, /*String*/version){ 
    227         //summary: Makes the uncompressed contents for dojo.js. 
    228  
    229         //Get the profileFile text. 
    230         var lineSeparator = java.lang.System.getProperty("line.separator"); 
    231          
    232         //Remove the call to getDependencyList.js because we want to call it manually. 
    233         var depLists = buildUtil.loadDependencyList(profileFile); 
    234         var depList = depLists.depList; 
     257buildUtil.makeDojoJs = function(/*Object*/dependencyResult, /*String*/version){ 
     258        //summary: Makes the uncompressed contents for dojo.js using the object 
     259        //returned from buildUtil.getDependencyList() 
     260 
     261        var lineSeparator = buildUtil.getLineSeparator(); 
     262        var depList = dependencyResult.depList; 
    235263 
    236264        //Concat the files together, and mark where we should insert all the 
     
    250278        //Sort the provide list alphabetically to make it easy to read. Order of provide statements 
    251279        //do not matter. 
    252         var provideList = depLists.provideList.sort();  
     280        var provideList = dependencyResult.provideList.sort();  
    253281        var depRegExpString = ""; 
    254282        for(var i = 0; i < provideList.length; i++){ 
     
    437465         
    438466        //Get the generated, flattened bundle. 
    439         var module = dojo.evalObjPath(moduleName); 
     467        var module = dojo.getObject(moduleName); 
    440468        var bundleLocale = localeName ? localeName.replace(/-/g, "_") : "ROOT"; 
    441469        var flattenedBundle = module.nls[bundleName][bundleLocale]; 
  • trunk/buildscripts/buildUtilXd.js

    r6717 r7074  
     1//The functions in this file assume that buildUtil.js have been loaded. 
    12var buildUtilXd = {}; 
     3 
     4buildUtilXd.setXdDojoConfig = function(/*String*/fileContents, /*String*/url){ 
     5        //summary: sets sets up xdomain loading for a particular URL. 
     6        //parameters: 
     7        //              fileContents: be a built dojo.js (can be uncompressed or compressed). 
     8        //              url: value should include the /src path for the xdomain dojo. 
     9        //                      Example: "http://some.domain.com/dojo-xdversion/src" (no ending slash) 
     10        //This function will inject some contents before the dojo.hostenv.resetXd() definition, 
     11        //so the contents of fileName should have been a dojo.js that includes the contents 
     12        //of loader_xd.js (specify -DdojoLoader=xdomain in the build command). 
     13 
     14        return fileContents.replace(/dojo\.hostenv\.resetXd\s*\=/, "djConfig.useXDomain = true;\ndojo.registerModulePath(\"dojo\", \"" 
     15                + url 
     16                + "\");\ndojo.hostenv.resetXd="); 
     17} 
    218 
    319//START makeXdContents function 
  • trunk/buildscripts/makeDojoJs.js

    r7003 r7074  
    99var lineSeparator = java.lang.System.getProperty("line.separator"); 
    1010 
    11 var result = buildUtil.makeDojoJs(profileFile, version); 
     11var result = buildUtil.makeDojoJs(buildUtil.loadDependencyList(profileFile), version); 
    1212 
    1313//Save the dojo.js contents.