tweak build file to make it easy to select which components to include

This commit is contained in:
Joe Walker 2011-01-12 14:06:12 +00:00
commit de202c1eee

View file

@ -40,22 +40,44 @@ var copy = internalRequire('dryice').copy;
var aceHome = __dirname; var aceHome = __dirname;
var buildStep = copy.createDataObject(); // Pilot sources
var pilot = copy.createDataObject();
// The Javascript files that don't need unwrapping
copy({ copy({
source: [ 'demo/mini_require.js' ], source: [ {
dest: buildStep root: aceHome + '/support/cockpit/support/pilot/lib',
include: /.*\.js$/,
exclude: /tests?\//
} ],
filter: [ copy.filter.moduleDefines ],
dest: pilot
}); });
// JS files that we tweak the define lines on // Cockpit sources
var cockpit = copy.createDataObject();
copy({
source: [ {
root: aceHome + '/support/cockpit/lib',
include: /.*\.js$/,
exclude: /tests?\//
} ],
filter: [ copy.filter.moduleDefines ],
dest: cockpit
});
/*
// The graphics files
copy({
source: sources.map(function(source) {
return { root: aceHome, include: source + '/.*\\.png$' };
}, this),
filter: [ copy.filter.base64, copy.filter.addDefines ],
dest: cockpit
});
*/
// Ace sources
var ace = copy.createDataObject();
copy({ copy({
source: [ source: [
{
root: aceHome + '/support/cockpit/support/pilot/lib',
include: /.*\.js$/,
exclude: /tests?\//
},
// Exclude all themes/modes so we can just include textmate/js // Exclude all themes/modes so we can just include textmate/js
{ {
root: aceHome + '/lib', root: aceHome + '/lib',
@ -69,55 +91,49 @@ copy({
{ base: aceHome + '/lib/', path: 'ace/mode/javascript_highlight_rules.js' }, { base: aceHome + '/lib/', path: 'ace/mode/javascript_highlight_rules.js' },
{ base: aceHome + '/lib/', path: 'ace/mode/doc_comment_highlight_rules.js' }, { base: aceHome + '/lib/', path: 'ace/mode/doc_comment_highlight_rules.js' },
{ base: aceHome + '/lib/', path: 'ace/mode/matching_brace_outdent.js' }, { base: aceHome + '/lib/', path: 'ace/mode/matching_brace_outdent.js' },
{ base: aceHome + '/lib/', path: 'ace/mode/javascript_highlight_rules.js' }, { base: aceHome + '/lib/', path: 'ace/mode/javascript_highlight_rules.js' }
], ],
filter: [ copy.filter.moduleDefines ], filter: [ copy.filter.moduleDefines ],
dest: buildStep dest: ace
}); });
// The CSS files
copy({ copy({
source: [ source: [ {
{
root: aceHome + '/lib', root: aceHome + '/lib',
include: /tm\.css|editor\.css/, include: /tm\.css|editor\.css/,
exclude: /tests?\// exclude: /tests?\//
} } ],
],
filter: [ copy.filter.addDefines ], filter: [ copy.filter.addDefines ],
dest: buildStep dest: ace
}); });
/* // Piece together the parts that we want
// The graphics files var data = copy.createDataObject();
copy({ copy({
source: sources.map(function(source) { source: [
return { root: aceHome, include: source + '/.*\\.png$' }; 'demo/mini_require.js',
}, this), pilot,
filter: [ copy.filter.base64, copy.filter.addDefines ], // cockpit,
dest: buildStep ace,
}); 'demo/build_boot.js'
*/ ],
dest: data
// The Javascript files that don't need unwrapping
copy({
source: [ 'demo/build_boot.js' ],
dest: buildStep
}); });
// Create the compressed and uncompressed output files // Create the compressed and uncompressed output files
copy({ copy({
source: buildStep, source: data,
filter: copy.filter.uglifyjs, filter: copy.filter.uglifyjs,
dest: 'build/ace.js' dest: 'build/ace.js'
}); });
copy({ copy({
source: buildStep, source: data,
dest: 'build/ace-uncompressed.js' dest: 'build/ace-uncompressed.js'
}); });
function internalRequire(ignore) { function internalRequire(ignore) {
var exports = {}; var exports = {};
@ -421,10 +437,11 @@ copy.filter.addDefines.onRead = true;
* *
*/ */
copy.filter.base64 = function(input, source) { copy.filter.base64 = function(input, source) {
if (typeof input !== 'string') { if (typeof input === 'string') {
input = input.toString(); throw new Error('base64 filter needs to be the first in a filter set');
} }
return 'define("text!' + source.toString() + '", ' + input + ');\n\n';
}; };
copy.filter.base64.onRead = true; copy.filter.base64.onRead = true;