Changeset 7415

Show
Ignore:
Timestamp:
02/22/07 23:03:33 (18 months ago)
Author:
jburke
Message:

(merge from 0.4 branch) References #2366. Fixes issue where comment stripping was messing up the charset in i18n bundles.

Location:
trunk/buildscripts
Files:
5 modified
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/buildscripts/buildUtil.js

    r7397 r7415  
    238238        var dependencies = null; 
    239239        var hostenvType = null; 
    240         var profileText = readFile(profileFile); 
     240        var profileText = new String(buildUtil.readFile(profileFile)); 
    241241         
    242242        //Remove the call to getDependencyList.js because we want to call it manually. 
     
    264264        for(var i = 0; i < depList.length; i++){ 
    265265                //Make sure we have a JS string and not a Java string by using new String(). 
    266                 dojoContents += new String(readFile(depList[i])) + "\r\n"; 
     266                dojoContents += new String(buildUtil.readFile(depList[i])) + "\r\n"; 
    267267        } 
    268268         
     
    812812} 
    813813 
     814buildUtil.readFile = function(/*String*/path, /*String?*/encoding){ 
     815        encoding = encoding || "utf-8"; 
     816        var file = new java.io.File(path); 
     817        var lineSeparator = buildUtil.getLineSeparator(); 
     818        var input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file), encoding)); 
     819        try { 
     820                var stringBuffer = new java.lang.StringBuffer(); 
     821                var line = ""; 
     822                while((line = input.readLine()) !== null){ 
     823                        stringBuffer.append(line); 
     824                        stringBuffer.append(lineSeparator); 
     825                } 
     826                return stringBuffer.toString(); 
     827        } finally { 
     828                input.close(); 
     829        } 
     830} 
     831 
    814832buildUtil.saveUtf8File = function(/*String*/fileName, /*String*/fileContents){ 
    815833        buildUtil.saveFile(fileName, fileContents, "utf-8"); 
     
    842860buildUtil.stripComments = function(/*String*/startDir, /*boolean*/suppressDojoCopyright){ 
    843861        //summary: strips the JS comments from all the files in "startDir", and all subdirectories. 
    844         var copyright = suppressDojoCopyright ? "" : (new String(readFile("copyright.txt")) + buildUtil.getLineSeparator()); 
     862        var copyright = suppressDojoCopyright ? "" : (new String(buildUtil.readFile("copyright.txt")) + buildUtil.getLineSeparator()); 
    845863        var fileList = buildUtil.getFilteredFileList(startDir, /\.js$/, true); 
    846864        if(fileList){ 
     
    854872                                print("Stripping comments from file: " + fileList[i]); 
    855873                                 
    856                                 //Read in the file. 
    857                                 var fileContents = readFile(fileList[i]); 
    858                                  
     874                                //Read in the file. Make sure we have a JS string. 
     875                                var fileContents = new String(buildUtil.readFile(fileList[i])); 
     876 
    859877                                //Look for copyright. If so, maintain it. 
    860878                                var singleLineMatches = fileContents.match(/\/\/.*copyright.*$/gi); 
     
    895913                                //Ideally do this in the pretty printer rhino code. 
    896914                                fileContents = fileContents.replace(/    /g, "\t"); 
    897                                  
     915 
    898916                                //Write out the file with appropriate copyright. 
    899917                                buildUtil.saveUtf8File(fileList[i], copyrightText + fileContents); 
  • trunk/buildscripts/makeDojoJsWeb.js

    r7285 r7415  
    4949         
    5050        //Add copyright, and intern strings. 
    51         contents = new String(readFile("copyright.txt")) + buildUtil.interningRegexpMagic("xdomain", contents, djConfig.baseRelativePath, [["dojo", "src"]], [], true); 
     51        contents = new String(buildUtil.readFile("copyright.txt")) + buildUtil.interningRegexpMagic("xdomain", contents, djConfig.baseRelativePath, [["dojo", "src"]], [], true); 
    5252         
    5353        if(xdDojoUrl){ 
  • trunk/buildscripts/setXdDojoConfig.js

    r7102 r7415  
    77load("buildUtilXd.js"); 
    88 
    9 var fileContents = new String(readFile(dojoFile)); 
     9var fileContents = new String(buildUtil.readFile(dojoFile)); 
    1010fileContents = buildUtilXd.setXdDojoConfig(fileContents, xdUrl); 
    1111buildUtil.saveFile(dojoFile, fileContents); 
  • trunk/buildscripts/webbuild/makeWebBuildModuleList.js

    r7175 r7415  
    5757for(var i = 0; i < fileList.length; i++){ 
    5858        var fileName = fileList[i]; 
    59         var fileContents = readFile(fileName); 
     59        var fileContents = new String(buildUtil.readFile(fileName)); 
    6060 
    6161        var matches = fileContents.match(provideRegExp); 
  • trunk/buildscripts/webbuild/webbuild.js

    r7281 r7415  
    1111} 
    1212 
    13 readText = readFile = function(uri){ 
     13buildUtil.readFile = readText = readFile = function(uri){ 
    1414        return dojo.hostenv.getText(uri); 
    1515}