diff --git a/Makefile b/Makefile index 95dcf964..29cf0495 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,6 @@ pre_build: build: pre_build ./Makefile.dryice.js normal ./Makefile.dryice.js demo - ./Makefile.dryice.js bm # Minimal build: call Makefile.dryice.js only if our sources changed basic: build/src/ace.js diff --git a/Makefile.dryice.js b/Makefile.dryice.js index 19ba9192..2bc36f8b 100755 --- a/Makefile.dryice.js +++ b/Makefile.dryice.js @@ -31,14 +31,12 @@ var fs = require("fs"); var path = require("path"); -if (!fs.existsSync) - fs.existsSync = path.existsSync; -else - path.existsSync = fs.existsSync; -var copy = require('dryice').copy; +var copy = require('architect-build/copy'); +var build = require('architect-build/build'); var ACE_HOME = __dirname; var BUILD_DIR = ACE_HOME + "/build"; +var CACHE = {}; function main(args) { if (args.indexOf("updateModes") !== -1) { @@ -49,7 +47,7 @@ function main(args) { if (x[0] == "-" && x[1] != "-") return "-" + x; return x; - }); + }).filter(Boolean); if (args[2] && (args[2][0] != "-" || args[2].indexOf("h") != -1)) type = args[2]; @@ -69,36 +67,22 @@ function main(args) { ace(); } else if (type == "demo") { demo(); - } else if (type == "bm") { - bookmarklet(); } else if (type == "full") { - demo(ace()); - bookmarklet(); + ace(); + demo(); } else if (type == "highlighter") { - var project = buildAce({ - coreOnly: true, - exportModule: "ace/ext/static_highlight", - requires: ["ace/ext/static_highlight", "ace/theme/textmate"], - readFilters: [copy.filter.moduleDefines, function(a) { - console.log(a.substring(0, 2500)) - return a - }] - }) - copy({ - source: project.result, - filter: getWriteFilters(project.options, "main"), - dest: BUILD_DIR + "/static_highlight.js" - }); + // TODO } } +} +function showHelp(type) { console.log("--- Ace Dryice Build Tool ---"); console.log(""); console.log("Options:"); console.log(" minimal Places necessary Ace files out in build dir; uses configuration flags below [default]"); console.log(" normal Runs four Ace builds--minimal, minimal-noconflict, minimal-min, and minimal-noconflict-min"); console.log(" demo Runs demo build of Ace"); - console.log(" bm Runs bookmarklet build of Ace"); console.log(" full all of above"); console.log(" highlighter "); console.log("args:"); @@ -109,91 +93,30 @@ function main(args) { console.log(" --nc namespace require"); console.log(" --s shrinkwrap (combines all output files into one)"); console.log(""); - if (BUILD_DIR) - console.log(" output generated in " + type + __dirname + "/" + BUILD_DIR) -} - -function bookmarklet() { - var targetDir = BUILD_DIR + "/textarea"; - copy({ - source: "build_support/editor_textarea.html", - dest: targetDir + '/editor.html' - }); - copy({ - source: "build_support/style.css", - dest: targetDir + '/style.css' - }); - - buildAce({ - targetDir: targetDir + "/src", - ns: "__ace_shadowed__", - exportModule: "ace/ext/textarea", - compress: false, - noconflict: true, - suffix: "", - name: "ace-bookmarklet", - workers: [], - keybindings: [] - }); + if (type) + console.log(" output for " + type + " generated in " + BUILD_DIR); } function ace() { - console.log('# ace ---------'); - - // uncompressed - var project = buildAce({ - compress: false, - noconflict: false - }); - buildAce({ - compress: false, - noconflict: true - }); - - // compressed - buildAce({ - compress: true, - noconflict: false - }); - buildAce({ - compress: true, - noconflict: true - }); - console.log('# ace License | Readme | Changelog ---------'); - copy({ - source: ACE_HOME + "/build_support/editor.html", - dest: BUILD_DIR + "/editor.html" - }); - copy({ - source: ACE_HOME + "/LICENSE", - dest: BUILD_DIR + "/LICENSE" - }); - copy({ - source: ACE_HOME + "/ChangeLog.txt", - dest: BUILD_DIR + "/ChangeLog.txt" - }); - - return project; + copy.file(ACE_HOME + "/build_support/editor.html", BUILD_DIR + "/editor.html"); + copy.file(ACE_HOME + "/LICENSE", BUILD_DIR + "/LICENSE"); + copy.file(ACE_HOME + "/ChangeLog.txt", BUILD_DIR + "/ChangeLog.txt"); + + console.log('# ace ---------'); + for (var i = 0; i < 4; i++) + buildAce({compress: i & 2, noconflict: i & 1}); } -function demo(project) { - project = project || buildAce({ - compress: false, - noconflict: false, - coreOnly: true - }); +function demo() { console.log('# kitchen sink ---------'); - var version, ref; + var version = "", ref = ""; try { version = JSON.parse(fs.readFileSync(ACE_HOME + "/package.json")).version; ref = fs.readFileSync(ACE_HOME + "/.git-ref").toString(); - } catch(e) { - ref = ""; - version = ""; - } + } catch(e) {} function changeComments(data) { return (data @@ -204,88 +127,54 @@ function demo(project) { .replace("%version%", version) .replace("%commit%", ref) ); - }; - - function fixDocPaths(data) { - return data.replace(/"(demo|build)\//g, "\""); } - - copy({ - source: ACE_HOME + "/kitchen-sink.html", - dest: BUILD_DIR + "/kitchen-sink.html", - filter: [changeComments, fixDocPaths] - }); - - copy({ - source: ACE_HOME + "/demo/kitchen-sink/styles.css", - dest: BUILD_DIR + "/kitchen-sink/styles.css", - filter: [ changeComments ] - }); - - fs.readdirSync(ACE_HOME +"/demo/kitchen-sink/docs/").forEach(function(x) { - copy({ - source: ACE_HOME +"/demo/kitchen-sink/docs/" + x, - dest: BUILD_DIR + "/kitchen-sink/docs/" + x - }); - }); - - var demo = copy.createDataObject(); - - project.assumeAllFilesLoaded(); - copy({ - source: [{ - project: cloneProject(project), - require: [ "kitchen-sink/demo" ] - }], - filter: getWriteFilters({filters:[fixDocPaths]}, "demo"), - dest: demo - }); - - copy({ - source: demo, - dest: BUILD_DIR + "/kitchen-sink/demo.js", - }); - - copyFileSync(ACE_HOME + "/demo/kitchen-sink/logo.png", BUILD_DIR + "/kitchen-sink/logo.png"); - fs.readdirSync(ACE_HOME + "/demo/").forEach(function(x) { - if (/\s|requirejs/.test(x) || !/\.(js|html)$/.test(x)) - return; - copy({ - source: ACE_HOME +"/demo/" + x, - dest: BUILD_DIR + "/demo/" + x, - filter: [function(source) { - if (/\.(js)$/.test(x)) - return source; - var removeRequireJS - source = source.replace(/')} - scripts.forEach(function(s) { - s = s.replace(/"/g, ""); - if (s == "ace/ace") { - comment("load ace") - script("ace") - } else { - var extName = s.match(/[^/]*$/)[0]; - comment("load ace " + extName + " extension"); - script("ext-" + extName); - } - }); - result.push("')} + scripts.forEach(function(s) { + s = s.replace(/"/g, ""); + if (s == "ace/ace") { + comment("load ace"); + script("ace"); + } else { + var extName = s.match(/[^/]*$/)[0]; + comment("load ace " + extName + " extension"); + script("ext-" + extName); + } + }); + result.push(" -