-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.dryice.js
95 lines (82 loc) · 2.61 KB
/
Makefile.dryice.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env node
var copy = require('dryice').copy;
var ACE_HOME = __dirname + "/node_modules/ace"
function main(args) {
var target;
if (args.length == 3) {
target = args[2];
// Check if 'target' contains some allowed value.
if (target != "worker") {
target = null;
}
}
if (!target) {
console.log("--- Cloud9 Dryice Build Tool ---");
console.log("");
console.log("Options:");
console.log(" worker build workers");
process.exit(0);
}
var project = {
roots: [
ACE_HOME + "/lib",
"/tmp/c9_worker_build",
__dirname + "/node_modules/treehugger/lib"
],
textPluginPattern: /^ace\/requirejs\/text!/
};
if (target == "worker") {
worker(project);
}
}
function worker(project) {
console.log('# cloud9 worker ---------');
var worker = copy.createDataObject();
var workerProject = copy.createCommonJsProject(project);
// We don't get a return value from dryice, so we monkey patch error handling
var yeOldeError = console.error;
console.error = function() {
yeOldeError();
yeOldeError("@@@@ FATAL ERROR: DRYICE FAILED", arguments);
yeOldeError();
process.exit(1);
};
copy({
source: [
copy.source.commonjs({
project: workerProject,
require: [
'ace/lib/fixoldbrowsers',
'ace/lib/event_emitter',
'ace/lib/oop',
'ace/narcissus/parser',
'ext/language/worker',
'ext/codecomplete/local_completer',
'ext/codecomplete/snippet_completer',
'ext/codecomplete/open_files_local_completer',
'ext/jslanguage/parse',
'ext/jslanguage/scope_analyzer',
'ext/jslanguage/narcissus_jshint',
'ext/jslanguage/debugger',
'ext/jslanguage/outline'
]
})
],
filter: [ copy.filter.moduleDefines, filterTextPlugin ],
dest: worker
});
copy({
source: [
ACE_HOME + "/lib/ace/worker/worker.js",
worker
],
filter: [ /* copy.filter.uglifyjs */],
dest: __dirname + "/plugins-client/lib.ace/www/worker/worker-language.js"
});
console.error = yeOldeError;
}
function filterTextPlugin(text) {
return text.replace(/(['"])ace\/requirejs\/text\!/g, "$1text!");
}
if (!module.parent)
main(process.argv);