@andersbakken/fisk 3.5.7 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/VM_runtime.js +4040 -0
- package/dist/VM_runtime.js.map +1 -0
- package/dist/fisk-builder.js +55239 -0
- package/dist/fisk-builder.js.map +1 -0
- package/dist/fisk-daemon.js +4223 -0
- package/dist/fisk-daemon.js.map +1 -0
- package/dist/fisk-scheduler.js +53883 -0
- package/dist/fisk-scheduler.js.map +1 -0
- package/package.json +68 -34
- package/builder/VM.js +0 -156
- package/builder/VM_runtime.js +0 -171
- package/builder/client.js +0 -181
- package/builder/compile.js +0 -269
- package/builder/fisk-builder.js +0 -899
- package/builder/load.js +0 -85
- package/builder/objectcache.js +0 -301
- package/builder/quit-on-error.js +0 -9
- package/builder/server.js +0 -214
- package/common/index.js +0 -45
- package/daemon/client.js +0 -100
- package/daemon/clientbuffer.js +0 -73
- package/daemon/compile.js +0 -140
- package/daemon/constants.js +0 -13
- package/daemon/fisk-daemon.js +0 -166
- package/daemon/server.js +0 -81
- package/daemon/slots.js +0 -69
- package/monitor/fisk-monitor.js +0 -767
- package/proxy/fisk-proxy.js +0 -150
- package/scheduler/database.js +0 -144
- package/scheduler/environments.js +0 -386
- package/scheduler/fisk-scheduler.js +0 -1411
- package/scheduler/objectcachemanager.js +0 -306
- package/scheduler/peak.js +0 -112
- package/scheduler/public/index.html +0 -37
- package/scheduler/server.js +0 -432
- package/scheduler/usertester.js +0 -60
package/builder/compile.js
DELETED
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
const child_process = require('child_process');
|
|
2
|
-
const mktemp = require('mktemp');
|
|
3
|
-
const fs = require('fs-extra');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const EventEmitter = require('events');
|
|
6
|
-
|
|
7
|
-
class Compile extends EventEmitter {
|
|
8
|
-
constructor(args, argv0, dir, debug) {
|
|
9
|
-
super();
|
|
10
|
-
|
|
11
|
-
if (!args || !args.length || !dir || !argv0) {
|
|
12
|
-
console.error(argv0, args, dir);
|
|
13
|
-
throw new Error("Bad args");
|
|
14
|
-
}
|
|
15
|
-
let compiler = args.shift();
|
|
16
|
-
const isClang = compiler.indexOf('clang') != -1;
|
|
17
|
-
|
|
18
|
-
let output;
|
|
19
|
-
let outputFileName;
|
|
20
|
-
let depfile;
|
|
21
|
-
let hasDashO = false;
|
|
22
|
-
let hasDashX = false;
|
|
23
|
-
let sourceFile;
|
|
24
|
-
for (let i=0; i<args.length; ++i) {
|
|
25
|
-
// console.log(i, args[i]);
|
|
26
|
-
switch (args[i]) {
|
|
27
|
-
case '-o': {
|
|
28
|
-
hasDashO = true;
|
|
29
|
-
output = args[++i];
|
|
30
|
-
outputFileName = path.basename(output);
|
|
31
|
-
args[i] = outputFileName;
|
|
32
|
-
break; }
|
|
33
|
-
case '-MF': {
|
|
34
|
-
args.splice(i--, 2);
|
|
35
|
-
break; }
|
|
36
|
-
case '-MMD':
|
|
37
|
-
case '-MD':
|
|
38
|
-
case '-MM':
|
|
39
|
-
case '-M':
|
|
40
|
-
args.splice(i--, 1);
|
|
41
|
-
continue;
|
|
42
|
-
case '-MT':
|
|
43
|
-
args.splice(i--, 2);
|
|
44
|
-
continue;
|
|
45
|
-
case '-cxx-isystem':
|
|
46
|
-
case '-isysroot':
|
|
47
|
-
case '-isystem':
|
|
48
|
-
case '-I':
|
|
49
|
-
args.splice(i--, 2);
|
|
50
|
-
break;
|
|
51
|
-
case '-x':
|
|
52
|
-
hasDashX = true;
|
|
53
|
-
if (!isClang) {
|
|
54
|
-
switch (args[++i]) {
|
|
55
|
-
case 'c':
|
|
56
|
-
args[i] = 'cpp-output';
|
|
57
|
-
break;
|
|
58
|
-
case 'c++':
|
|
59
|
-
args[i] = 'c++-cpp-output';
|
|
60
|
-
break;
|
|
61
|
-
case 'objective-c':
|
|
62
|
-
args[i] = 'objective-c-output';
|
|
63
|
-
break;
|
|
64
|
-
case 'objective-c++':
|
|
65
|
-
args[i] = 'objective-c++-cpp-output';
|
|
66
|
-
break;
|
|
67
|
-
default:
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
} else {
|
|
71
|
-
++i;
|
|
72
|
-
}
|
|
73
|
-
break;
|
|
74
|
-
case '--param':
|
|
75
|
-
case '-G':
|
|
76
|
-
case '-T':
|
|
77
|
-
case '-V':
|
|
78
|
-
case '-Xanalyzer':
|
|
79
|
-
case '-Xassembler':
|
|
80
|
-
case '-Xclang':
|
|
81
|
-
case '-Xlinker':
|
|
82
|
-
case '-Xpreprocessor':
|
|
83
|
-
case '-arch':
|
|
84
|
-
case '-b':
|
|
85
|
-
case '-gcc-toolchain':
|
|
86
|
-
case '-imacros':
|
|
87
|
-
case '-imultilib':
|
|
88
|
-
case '-include':
|
|
89
|
-
case '-iprefix':
|
|
90
|
-
case '-ivfsoverlay':
|
|
91
|
-
case '-iwithprefix':
|
|
92
|
-
case '-iwithprefixbefore':
|
|
93
|
-
case '-target':
|
|
94
|
-
++i;
|
|
95
|
-
break;
|
|
96
|
-
default:
|
|
97
|
-
if (/^-mlinker-version=/.exec(args[i]) || /^-stdlib=/.exec(args[i])) {
|
|
98
|
-
args.splice(i--, 1);
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (args[i][0] != '-') {
|
|
103
|
-
if (sourceFile) {
|
|
104
|
-
console.log("Multiple source files", sourceFile, args[i]);
|
|
105
|
-
throw new Error("More than one source file");
|
|
106
|
-
}
|
|
107
|
-
sourceFile = args[i];
|
|
108
|
-
args[i] = path.join(dir, 'sourcefile');
|
|
109
|
-
}
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
if (!sourceFile) {
|
|
114
|
-
throw new Error("No sourcefile");
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (!hasDashX) {
|
|
118
|
-
if (compiler.indexOf('g++') != -1 || compiler.indexOf('c++') != -1) {
|
|
119
|
-
args.unshift(isClang ? 'c++' : 'c++-cpp-output');
|
|
120
|
-
} else {
|
|
121
|
-
switch (path.extname(sourceFile)) {
|
|
122
|
-
case '.C':
|
|
123
|
-
case '.cc':
|
|
124
|
-
case '.cpp':
|
|
125
|
-
case '.CPP':
|
|
126
|
-
case '.c++':
|
|
127
|
-
case '.cp':
|
|
128
|
-
case '.cxx':
|
|
129
|
-
args.unshift(isClang ? 'c++' : 'c++-cpp-output');
|
|
130
|
-
break;
|
|
131
|
-
case '.ii':
|
|
132
|
-
args.unshift('c++-cpp-output');
|
|
133
|
-
break;
|
|
134
|
-
case '.hh':
|
|
135
|
-
case '.hpp':
|
|
136
|
-
case '.H':
|
|
137
|
-
args.unshift('c++-header');
|
|
138
|
-
break;
|
|
139
|
-
case '.h':
|
|
140
|
-
args.unshift('c-header');
|
|
141
|
-
break;
|
|
142
|
-
case '.c':
|
|
143
|
-
args.unshift(isClang ? 'c' : 'cpp-output');
|
|
144
|
-
break;
|
|
145
|
-
case '.i':
|
|
146
|
-
args.unshift('cpp-output');
|
|
147
|
-
break;
|
|
148
|
-
case '.m':
|
|
149
|
-
case '.mi':
|
|
150
|
-
args.unshift(isClang ? 'objective-c' : 'objective-c-cpp-output');
|
|
151
|
-
break;
|
|
152
|
-
case '.s':
|
|
153
|
-
args.unshift('assembler');
|
|
154
|
-
break;
|
|
155
|
-
case '.sx':
|
|
156
|
-
case '.S':
|
|
157
|
-
args.unshift('assembler-with-cpp');
|
|
158
|
-
break;
|
|
159
|
-
case '.mm':
|
|
160
|
-
case '.M':
|
|
161
|
-
case '.mii':
|
|
162
|
-
args.unshift(isClang ? 'objective-c++' : 'objective-c++-cpp-output');
|
|
163
|
-
break;
|
|
164
|
-
default:
|
|
165
|
-
throw new Error(`Can't determine source language for file: ${sourceFile}`);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
args.unshift('-x');
|
|
169
|
-
}
|
|
170
|
-
if (!isClang) {
|
|
171
|
-
args.push('-fpreprocessed', '-fdirectives-only'); // this is not good for clang
|
|
172
|
-
} else {
|
|
173
|
-
args.push('-Wno-stdlibcxx-not-found');
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
if (!hasDashO) {
|
|
177
|
-
let suffix = path.extname(sourceFile);
|
|
178
|
-
outputFileName = output = sourceFile.substr(0, sourceFile.length - suffix) + ".o";
|
|
179
|
-
args.push("-o", outputFileName);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// debug = true;
|
|
183
|
-
if (debug)
|
|
184
|
-
console.log("Calling", argv0, compiler, args.map(x => '"' + x + '"').join(" "));
|
|
185
|
-
if (!fs.existsSync("/usr/bin/as")) {
|
|
186
|
-
this.emit("stderr", "as doesn't exist");
|
|
187
|
-
}
|
|
188
|
-
const env = Object.assign({ TMPDIR: dir, TEMPDIR: dir, TEMP: dir }, process.env);
|
|
189
|
-
const proc = child_process.spawn(compiler, args, { /*env: env, */cwd: dir, maxBuffer: 1024 * 1024 * 16 });
|
|
190
|
-
this.proc = proc;
|
|
191
|
-
proc.stdout.setEncoding('utf8');
|
|
192
|
-
proc.stderr.setEncoding('utf8');
|
|
193
|
-
|
|
194
|
-
proc.stdout.on('data', data => {
|
|
195
|
-
this.emit('stdout', data);
|
|
196
|
-
});
|
|
197
|
-
proc.stderr.on('data', data => {
|
|
198
|
-
this.emit('stderr', data);
|
|
199
|
-
});
|
|
200
|
-
proc.on('error', err => {
|
|
201
|
-
this.emit('error', err);
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
proc.on('exit', exitCode => {
|
|
205
|
-
// try {
|
|
206
|
-
var that = this;
|
|
207
|
-
let files = [];
|
|
208
|
-
function addDir(dir, prefix) {
|
|
209
|
-
try {
|
|
210
|
-
fs.readdirSync(dir).forEach(file => {
|
|
211
|
-
if (file === 'sourcefile')
|
|
212
|
-
return;
|
|
213
|
-
try {
|
|
214
|
-
let stat = fs.statSync(path.join(dir, file));
|
|
215
|
-
if (stat.isDirectory()) {
|
|
216
|
-
addDir(path.join(dir, file), prefix ? prefix + file + '/' : file + '/');
|
|
217
|
-
} else if (stat.isFile()) {
|
|
218
|
-
if (file == outputFileName) {
|
|
219
|
-
files.push({ path: output, mapped: path.join(prefix, file) });
|
|
220
|
-
} else if (path.extname(file) == ".gcno") {
|
|
221
|
-
// console.log("mapping", output, prefix, file);
|
|
222
|
-
files.push({ path: output.substr(0, output.length - 1) + "gcno", mapped: path.join(prefix, file) });
|
|
223
|
-
} else if (path.extname(file) == ".gcda") {
|
|
224
|
-
files.push({ path: output.substr(0, output.length - 1) + "gcda", mapped: path.join(prefix, file) });
|
|
225
|
-
} else {
|
|
226
|
-
files.push({ path: path.join(prefix, file) });
|
|
227
|
-
}
|
|
228
|
-
if (debug)
|
|
229
|
-
console.log("Added file", file, files[files.length - 1]);
|
|
230
|
-
}
|
|
231
|
-
} catch (err) {
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
} catch (err) {
|
|
235
|
-
console.error("Got an error processing outputs for", sourceFile, err);
|
|
236
|
-
that.emit('exit', { exitCode: 110, files: [], error: err.toString(), sourceFile: sourceFile });
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
if (exitCode === 0)
|
|
241
|
-
addDir(dir, dir);
|
|
242
|
-
if (exitCode === null)
|
|
243
|
-
exitCode = 111;
|
|
244
|
-
this.emit('exit', { exitCode: exitCode, files: files, sourceFile: sourceFile });
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
kill() {
|
|
249
|
-
this.proc.kill();
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// let preproc = fs.readFileSync("/tmp/preproc");
|
|
254
|
-
// let f = new Compile([ "/usr/bin/c++", "-Iclient", "-I3rdparty/json11", "-I3rdparty/wslay/lib/includes", "-I3rdparty/wslay/lib", "-I3rdparty/LUrlParser", "-I3rdparty/tiny-process-library", "-std=c++14", "-Wformat", "-Wall", "-g", "-MD", "-MT", "client/CMakeFiles/fiskc.dir/Config.cpp.o", "-MF", "client/CMakeFiles/fiskc.dir/Config.cpp.o.d", "-o", "client/CMakeFiles/fiskc.dir/Config.cpp.o", "-c", "client/Config.cpp" ], preproc);
|
|
255
|
-
// f.on('stdout', (data) => {
|
|
256
|
-
// console.log("Got out", data.length);
|
|
257
|
-
// });
|
|
258
|
-
|
|
259
|
-
// f.on('stderr', (data) => {
|
|
260
|
-
// console.log("Got err", data.toString());
|
|
261
|
-
// });
|
|
262
|
-
// f.on('error', error => {
|
|
263
|
-
// console.log("Got error", error);
|
|
264
|
-
// });
|
|
265
|
-
|
|
266
|
-
// f.on('exit', event => {
|
|
267
|
-
// console.log("Got exit", event);
|
|
268
|
-
// });
|
|
269
|
-
module.exports = Compile;
|