Changeset 7396

Show
Ignore:
Timestamp:
02/21/07 17:12:31 (21 months ago)
Author:
jburke
Message:

References #2366. Fixes issue where moving all dojo.provide statements to the top caused problems. The important thing is the matching dojo.require() removal (which is still done)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/0.4/buildscripts/buildUtil.js

    r7338 r7396  
    262262        //provide statements. 
    263263        var dojoContents = ""; 
    264         var insertedProvideMarker = false; 
    265264        for(var i = 0; i < depList.length; i++){ 
    266265                //Make sure we have a JS string and not a Java string by using new String(). 
    267266                dojoContents += new String(readFile(depList[i])) + "\r\n"; 
    268                 if(!insertedProvideMarker && depList[i].indexOf("hostenv_") != -1){ 
    269                         dojoContents += "__DOJO_PROVIDE_INSERTION__"; 
    270                         insertedProvideMarker = true; 
    271                 } 
    272         } 
    273          
    274         //Move all the dojo.provide calls to the top, and remove any matching dojo.require calls. 
    275         //Sort the provide list alphabetically to make it easy to read. Order of provide statements 
    276         //do not matter. 
     267        } 
     268         
     269        //Construct a string of all the dojo.provide statements. 
     270        //This string will be used to construct the regexp that will be 
     271        //used to remove matching dojo.require statements. 
     272        //Sort the provide list alphabetically to make it easy to read. 
     273        //Order of provide statements do not matter. 
    277274        var provideList = dependencyResult.provideList.sort();  
    278275        var depRegExpString = ""; 
     
    286283        //If we have a string for a regexp, do the dojo.require() removal now. 
    287284        if(depRegExpString){ 
    288                 var depRegExp = new RegExp("dojo\\.(provide|require)\\((" + depRegExpString + ")\\)(;?)", "g"); 
     285                var depRegExp = new RegExp("dojo\\.(require)\\((" + depRegExpString + ")\\)(;?)", "g"); 
    289286                dojoContents = dojoContents.replace(depRegExp, ""); 
    290287        } 
    291  
    292         //Insert all the provide statements at the provide insertion marker. 
    293         var provideString = ""; 
    294         if(provideList && provideList.length > 0){ 
    295                 for(var i = 0; i < provideList.length; i++){ 
    296                         provideString += 'dojo.provide("' + provideList[i] + '");' + lineSeparator; 
    297                 } 
    298         } 
    299         dojoContents = dojoContents.replace(/__DOJO_PROVIDE_INSERTION__/, provideString); 
    300288 
    301289        //Set version number.