Changeset 7450
- Timestamp:
- 02/25/07 22:46:42 (21 months ago)
- Location:
- branches/0.4/buildscripts
- Files:
-
- 3 modified
-
makeDojoJsWeb.js (modified) (3 diffs)
-
webbuild.php (modified) (2 diffs)
-
webbuild/index.html (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.4/buildscripts/makeDojoJsWeb.js
r7448 r7450 4 4 load("buildUtilXd.js"); 5 5 6 var depList = new String(arguments[0]); 7 var provideList = new String(arguments[1]); 8 var version = new String(arguments[2]); 9 var xdDojoUrl = new String(arguments[3]); 10 var doCompression = new String(arguments[4]); 6 var result = "ERROR"; 11 7 12 if(typeof(doCompression) != "undefined" && doCompression == "true"){ 13 doCompression = true;14 }else{ 15 doCompression = false;16 } 8 var buildDirectory = new String(arguments[0]); 9 var depList = new String(arguments[1]); 10 var provideList = new String(arguments[2]); 11 var version = new String(arguments[3]); 12 var xdDojoUrl = new String(arguments[4]); 17 13 18 14 depList = depList.split(","); … … 52 48 load('../dojo.js'); 53 49 dojo.require("dojo.string.extras"); 54 55 var contents = ""; 50 dojo.require("dojo.crypto.MD5"); 51 52 var buildSigDir = dojo.crypto.MD5.compute(dependencyResult.depList.sort().join(","), dojo.crypto.outputTypes.Hex); 56 53 try{ 57 contents = buildUtil.makeDojoJs(dependencyResult, version).dojoContents; 54 var contents = buildUtil.makeDojoJs(dependencyResult, version).dojoContents; 55 var compressedContents = ""; 58 56 var prefixes = [["dojo", "src"]]; 59 57 … … 73 71 } 74 72 75 //Compress code, if desired. 76 if(doCompression){ 77 contents = buildUtil.optimizeJs("dojo.js", contents, "", doCompression); 78 } 73 //Compress code. 74 compressedContents = buildUtil.optimizeJs("dojo.js", contents, "", true); 79 75 80 76 //Add copyright 81 contents = new String(buildUtil.readFile("copyright.txt")) 82 + new String(buildUtil.readFile("build_notice.txt")) 83 + contents; 77 var copyright = new String(buildUtil.readFile("copyright.txt")); 78 var buildNotice = new String(buildUtil.readFile("build_notice.txt")); 79 contents = copyright + buildNotice + contents; 80 compressedContents = copyright + buildNotice + compressedContents; 81 82 //Prep cache location 83 var buildCachePath = buildDirectory + "/" + buildSigDir + "/"; 84 85 //Create needed directories for cache location. 86 var dirFile = new java.io.File(buildCachePath + "compressed"); 87 var dirsOk = dirFile.mkdirs(); 88 89 result = "dirFile: " + dirFile.getAbsolutePath() + ", dirsOK: " + dirsOk; 90 91 //Save files to disk 92 buildUtil.saveUtf8File(buildCachePath + "dojo.js", contents); 93 buildUtil.saveUtf8File(buildCachePath + "compressed/dojo.js", compressedContents); 94 95 result = "OK"; 84 96 }catch(e){ 85 contents = "dojo.js build error: " + e;97 result += "ERROR: " + e; 86 98 } 87 99 88 print( contents);100 print(result); 89 101 } -
branches/0.4/buildscripts/webbuild.php
r7448 r7450 1 1 <? 2 2 $buildScriptsDir = "/Users/jrbsilver/svn/dojo/branches/0.4/buildscripts"; 3 $buildCacheDir = "/Users/jrbsilver/svn/dojo/branches/0.4/buildscripts/webbuild/webbuildtemp/0.4.2rc1/web/buildscripts"; 3 4 $depList = isset($_POST['depList']) ? $_POST['depList'] : null; 4 5 $provideList = isset($_POST['provideList']) ? $_POST['provideList'] : 'null'; 5 6 $version = isset($_POST['version']) ? $_POST['version'] : '0.0.0dev'; 6 7 $xdDojoUrl = isset($_POST['xdDojoUrl']) ? $_POST['xdDojoUrl'] : ''; 7 $doCompression = isset($_POST['doCompression']) ? $_POST['doCompression'] : 'false';8 8 9 9 if(!isset($depList)){ … … 17 17 header("Content-disposition: attachment; filename=dojo.js"); 18 18 19 $dojoContents = `/usr/bin/java -jar $buildScriptsDir/lib/custom_rhino.jar $buildScriptsDir/makeDojoJsWeb.js $ depList $provideList $version $xdDojoUrl $doCompression`;19 $dojoContents = `/usr/bin/java -jar $buildScriptsDir/lib/custom_rhino.jar $buildScriptsDir/makeDojoJsWeb.js $buildCacheDir/dojobuilds $depList $provideList $version $xdDojoUrl`; 20 20 21 21 print($dojoContents); -
branches/0.4/buildscripts/webbuild/index.html
r7448 r7450 113 113 dojo.require("dojo.widget.TreeEmphasizeOnSelect"); 114 114 dojo.require("dojo.html.iframe"); 115 dojo.require("dojo.crypto.MD5"); 116 dojo.require("dojo.string.extras"); 115 117 116 118 //assign output node on load. … … 124 126 } 125 127 128 function getCachedBuildUrl(depList){ 129 var doCompression = document.masterForm.doCompression[1].checked ? true : false; 130 var sortedFileList = depList.sort().join(","); 131 var buildKey = dojo.crypto.MD5.compute(sortedFileList, dojo.crypto.outputTypes.Hex); 132 return "dojobuilds/" + buildKey + (doCompression ? "/compressed" : "") + "/dojo.js"; 133 } 134 126 135 function sendDependencyResultToServer(dependencyResult){ 127 136 clearOutput(); 128 137 138 //Find out if the build result is already on the server. 139 var cachedBuildUrl = getCachedBuildUrl(dependencyResult.depList); 140 dojo.io.bind({ 141 //Add an URL marker for the server to know if this is an existence query. 142 //Mostly helpful in the Safari 2.0 case where it doesn't support HEAD 143 //requests. This marker should be used to filter server logs when trying to find 144 //download counts. 145 url: cachedBuildUrl + "?query=exist", 146 method: "HEAD", 147 mimetype: "text/plain", 148 handle: function(type, data, xhr, kwArgs){ 149 var httpStatus = parseInt(xhr.status, 10); 150 if(httpStatus >= 400){ 151 //Build does not exist. Ask server to make it. 152 requestServerBuild(dependencyResult); 153 }else{ 154 outputBuildResults(dependencyResult); 155 window.location = "../" + cachedBuildUrl; 156 } 157 } 158 }); 159 } 160 161 function requestServerBuild(dependencyResult){ 129 162 var depListForm = document.depListForm; 130 depListForm.action = "../webbuild.php"; 131 depListForm.depList.value = dependencyResult.depList.join(","); 132 depListForm.provideList.value = dependencyResult.provideList && dependencyResult.provideList.length > 0 ? dependencyResult.provideList.join(",") : "null"; 133 depListForm.version.value = version; 134 depListForm.xdDojoUrl.value = xdDojoUrl; 135 depListForm.doCompression.value = document.masterForm.doCompression[1].checked ? true : false; 136 163 164 //Ask the server to build the result. 165 dojo.io.bind({ 166 url: "../webbuild.php", 167 method: "POST", 168 mimetype: "text/plain", 169 content: { 170 depList: dependencyResult.depList.join(","), 171 provideList: (dependencyResult.provideList && dependencyResult.provideList.length > 0) ? dependencyResult.provideList.join(",") : "null", 172 version: version, 173 xdDojoUrl: xdDojoUrl 174 }, 175 handle: function(type, data, xhr, kwArgs){ 176 if(type == "load" && dojo.string.trim(data).indexOf("OK") == 0){ 177 outputBuildResults(dependencyResult); 178 window.location = "../" + getCachedBuildUrl(dependencyResult.depList); 179 }else{ 180 alert("Build " + type + " [" + data + "]"); 181 } 182 } 183 }); 184 185 } 186 187 function outputBuildResults(dependencyResult){ 137 188 //reset the hidden frame so we can do another build. 138 189 setTimeout(function(){ … … 155 206 } 156 207 } 157 158 //Submit form to generate custom dojo.js file.159 depListForm.submit();160 208 } 161 209