-
Notifications
You must be signed in to change notification settings - Fork 6
/
buildos.js
444 lines (386 loc) · 19.3 KB
/
buildos.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
// Build OpenAF
//
plugin("ZIP");
ow.loadFormat()
var params = processExpr();
var OPENAF_BUILD_HOME = (isUndefined(params.withDir)) ? "." : params.withDir;
var OPENAF_JSON = (isDef(params.withJSON)) ? params.withJSON : undefined;
var OPENAF_DIST = (isDef(params.withDist)) ? params.withDist : undefined;
var OPENAF_LIB = OPENAF_BUILD_HOME + "/lib";
var OPENAF_SRC = OPENAF_BUILD_HOME + "/src";
var OPENAF_BIN = OPENAF_BUILD_HOME + "/bin";
var OPENAF_JS = OPENAF_BUILD_HOME + "/js";
var JAVAC = "javac";
var smallClassPath = "";
var EXTERNAL = false;
if (isDefined(params.external)) EXTERNAL = true;
log("Building params:");
log(" BUILD_HOME = " + OPENAF_BUILD_HOME);
log(" JSON = " + OPENAF_JSON);
log(" DIST = " + OPENAF_DIST);
log(" LIB = " + OPENAF_LIB);
log(" SRC = " + OPENAF_SRC);
log(" BIN = " + OPENAF_BIN);
log(" JS = " + OPENAF_JS);
log(" JAVAC = " + JAVAC);
log(" EXTERNAL = " + EXTERNAL);
var INTERNAL_LICENSE = "See license info in openaf.jar/LICENSE and openaf.jar/LICENSES.txt";
var EXTERNAL_LICENSE = "See license info in openaf.jar/LICENSE and openaf.jar/LICENSES.txt";
function buildDeps() {
// Check javascript dependencies
var l = io.listFilenames(OPENAF_BUILD_HOME + "/js");
var ss = {};
function u(anArr) {
var ar = [];
for(var ii in anArr) {
if (ar.indexOf(anArr[ii]) < 0) ar.push(anArr[ii]);
}
return ar;
}
for (var i in l) {
if (l[i].match(/\.js$/))
ss[l[i]] = u(io.readFileString(l[i]).match(/plugin\([^\)]+\)/g));
};
return ss;
}
function buildClasspath() {
var classpath = "";
var listfiles = io.listFiles(OPENAF_LIB);
if (isUndefined(listfiles)) {
logErr("Didn't found the OPENAF_LIB. Please configure it.");
java.lang.System.exit(0);
}
for (var i in $from( listfiles.files ).sort("filename").select() ) {
if (!listfiles.files[i].filename.match(/\.jar$/)) continue;
if (listfiles.files[i].filename.match("af.jar")) continue;
log("Including " + listfiles.files[i].filename);
classpath += listfiles.files[i].filepath;
smallClassPath += " " + listfiles.files[i].filename + "";
if (i < (listfiles.files.length - 1)) classpath += PATHSEPARATOR;
}
var tmp = smallClassPath + " compiledJS.jar";
for (var i = 0; i <= Math.floor(smallClassPath.length / 70); i++) {
tmp = tmp.substr(0, i * 70) + "\n " + tmp.substr(i * 70, tmp.length);
}
smallClassPath = tmp;
return classpath;
}
function listFiles(aPath, aFilter, aExcludeFilter) {
var listfiles = io.listFiles(aPath);
var arrayFiles = [];
for (i in listfiles.files) {
if (listfiles.files[i].isDirectory) {
arrayFiles = arrayFiles.concat(listFiles(listfiles.files[i].filepath, aFilter, aExcludeFilter));
} else {
if (listfiles.files[i].filename.match(aFilter)) {
if (!(isDefined(aExcludeFilter) && (listfiles.files[i].filepath.replace(/\\/g, "/").match(new RegExp(aExcludeFilter)) != null)))
arrayFiles.push(listfiles.files[i].filepath);
}
}
}
return arrayFiles;
}
function buildSource() {
var sourcePath = "";
log("Finding sources...");
var excludeFilter;
excludeFilter = "plugins/Wedo";
var arrayList = listFiles(OPENAF_SRC, new RegExp(".+\.java$"), excludeFilter);
log("Found #" + arrayList.length + " java sources.");
sourcePath = arrayList.join(" ");
return sourcePath;
}
// MAIN
// ----
log("Init build");
var os = java.lang.System.getProperty("os.name") + "";
var PATHSEPARATOR = (os.match(/Windows/)) ? ";" : ":";
var dateFormat = new java.text.SimpleDateFormat("yyyyMMdd");
var release = (isDef(params.withVersion)) ? params.withVersion : dateFormat.format(new java.util.Date());
log("Building release " + release);
var classpath = buildClasspath();
log("Changing AFCmdOS for release = " + release);
var javaAFCmd = io.readFileString(OPENAF_SRC + "/openaf/AFCmdBase.java");
javaAFCmd = javaAFCmd.replace(/public static String VERSION = "([0-9]+)";/m, "public static String VERSION = \"" + release + "\";");
if (EXTERNAL)
javaAFCmd = javaAFCmd.replace(/public static String LICENSE = "([^\"]+)";/m, "public static String LICENSE = \"" + EXTERNAL_LICENSE + "\";");
else
javaAFCmd = javaAFCmd.replace(/public static String LICENSE = "([^\"]+)";/m, "public static String LICENSE = \"" + INTERNAL_LICENSE + "\";");
if (isDef(OPENAF_DIST))
javaAFCmd = javaAFCmd.replace(/public static String DISTRIBUTION = "([^\"]+)";/m, "public static String DISTRIBUTION = \"" + OPENAF_DIST + "\";");
io.writeFileString(OPENAF_SRC + "/openaf/AFCmdBase.java", javaAFCmd);
log("Changing openaf.js variables according with release");
var jsOpenAF = io.readFileString(OPENAF_BUILD_HOME + "/js/openaf.js");
if (EXTERNAL)
jsOpenAF = jsOpenAF.replace(/var noHomeComms = ([a-z]+);/m, "var noHomeComms = true;");
else
jsOpenAF = jsOpenAF.replace(/var noHomeComms = ([a-z]+);/m, "var noHomeComms = false;");
io.writeFileString(OPENAF_BUILD_HOME + "/js/openaf.js", jsOpenAF);
io.rm(OPENAF_BIN);
io.mkdir(OPENAF_BIN);
var cmd = JAVAC + " -cp " + classpath + " -encoding UTF-8 -source 1.8 -target 1.8 -Xlint:deprecation -d " + OPENAF_BIN + " " + buildSource();
log("Compiling...");
log(af.sh(cmd, "", undefined, true));
if (__exitcode != 0) {
logErr("Error compiling: " + __stderr);
}
var tempJar = new ZIP(io.readFileBytes(OPENAF_BUILD_HOME + "/jar-in-jar-loader.zip"));
var binFiles = listFiles(OPENAF_BIN, new RegExp("\.class$"));
log("#" + binFiles.length + " binary files identified.");
binFiles = binFiles.concat(classpath.split(PATHSEPARATOR));
//var transformPathBin = (os.match(/Windows/)) ? OPENAF_BIN.replace(/\//g, "\\") : OPENAF_BIN;
//var transformPathLib = (os.match(/Windows/)) ? OPENAF_LIB.replace(/\//g, "\\") : OPENAF_LIB;
var transformPathBin = OPENAF_BIN;
var transformPathLib = OPENAF_LIB;
for (var i in binFiles) {
tempJar.putFile(binFiles[i].replace(transformPathLib, "").replace(transformPathBin, "").replace(/\\/g, "/").replace(/^\//, ""), io.readFileBytes(binFiles[i]));
}
log("Adding extra files...");
var packjson = io.readFile(OPENAF_BUILD_HOME + "/.package.json");
packjson.version = release + "";
//tempJar.putFile("log4j.properties", io.readFileBytes(OPENAF_BUILD_HOME + "/log4j.properties"));
tempJar.putFile("versionsAndDeps.json", io.readFileBytes(OPENAF_BUILD_HOME + "/versionsAndDeps.json"));
tempJar.putFile("LICENSE", io.readFileBytes(OPENAF_BUILD_HOME + "/LICENSE"));
tempJar.putFile("LICENSES.txt", io.readFileBytes(OPENAF_BUILD_HOME + "/LICENSES.txt"));
/*if (isUnDef(OPENAF_JSON)) {
tempJar.putFile("openaf.json", io.readFileBytes(OPENAF_BUILD_HOME + "/openaf.json"));
log("Added " + OPENAF_BUILD_HOME + "/openaf.json...");
} else {
tempJar.putFile("openaf.json", io.readFileBytes(OPENAF_JSON));
log("Added " + OPENAF_JSON + "...");
}*/
tempJar.putFile(".package.json", af.fromString2Bytes(beautifier(packjson)));
log("Adding css files...");
var cssList = listFilesRecursive(OPENAF_BUILD_HOME + "/css");
for (i in cssList) {
var file = cssList[i];
if (file.isFile) {
tempJar.putFile(file.filepath.replace(OPENAF_BUILD_HOME, "").replace(/\\/g, "/").replace(/^\//, ""), io.readFileBytes(OPENAF_BUILD_HOME + "" + file.filepath.replace(OPENAF_BUILD_HOME, "")));
}
};
log("Adding fonts files...");
var fontsList = listFilesRecursive(OPENAF_BUILD_HOME + "/fonts");
for (i in fontsList) {
var file = fontsList[i];
if (file.isFile) {
tempJar.putFile(file.filepath.replace(OPENAF_BUILD_HOME, "").replace(/\\/g, "/").replace(/^\//, ""), io.readFileBytes(OPENAF_BUILD_HOME + "" + file.filepath.replace(OPENAF_BUILD_HOME, "")));
}
}
log("Adding hbs files...");
var hbsList = listFilesRecursive(OPENAF_BUILD_HOME + "/hbs");
for (i in hbsList) {
var file = hbsList[i];
if (file.isFile) {
tempJar.putFile(file.filepath.replace(OPENAF_BUILD_HOME, "").replace(/\\/g, "/").replace(/^\//, ""), io.readFileBytes(OPENAF_BUILD_HOME + "" + file.filepath.replace(OPENAF_BUILD_HOME, "")));
}
}
var jsList = io.listFiles(OPENAF_BUILD_HOME + "/js").files;
var origjssha = {
files: []
};
var destjssha = {
files: []
};
try {
origjssha = io.readFile(OPENAF_BUILD_HOME + "/buildSHA.json");
} catch (e) {}
io.mkdir(OPENAF_BUILD_HOME + "/jsmin");
io.mkdir(OPENAF_BUILD_HOME + "/jslib");
var zipJSlib = new ZIP();
var validationForCompile = (filename) => { return (filename != "synaptic.js" && filename != "nlinqParse.js" && filename != "sqlParse.js" && filename != "slonParse.js" && filename != "materialize.js" && filename != "materialize2.js" && filename != "handlebars.js" && filename != "oafp.js" && filename != "chart.js" && filename != "jquery.js" && filename != "highlight.js" && filename != "brainjs.js"); };
var validationForRequireCompile = (filename) => { return (filename == "regression.js" || filename == "handlebars.js" || filename == "showdown.js" || filename == "synaptic.js" || filename == "nlinqParse.js" || filename == "sqlParse.js" || filename == "slonParse.js"); };
var ojson = (isDef(OPENAF_JSON) ? OPENAF_JSON : OPENAF_BUILD_HOME + "/openaf.json");
if (io.fileExists(ojson)) {
log("Loading " + ojson + "...")
var txt = io.readFileString(ojson)
var s = io.readFileString(OPENAF_BUILD_HOME + "/js/openaf.js")
s = s.replace(/(\/\/ BEGIN_SET__OPENAF\n)(.+\n)+(\/\/ END_SET__OPENAF\n)/m, "$1" + txt + "\n$3")
log("Rewriting " + OPENAF_BUILD_HOME + "/js/openaf.jar...")
io.writeFileString(OPENAF_BUILD_HOME + "/js/openaf.js", s)
}
var compileJS2Java = (classfile, script, path) => {
var tmpFile = io.createTempFile("build_", ".js");
io.writeFileString(tmpFile, script);
var cmd = ow.format.getJavaHome() + "/bin/java -classpath " + OPENAF_BUILD_HOME + "/bin:" + OPENAF_BUILD_HOME + "/lib/js.jar openaf.CompileJS2Java " + classfile + " " + tmpFile + " " + path;
$sh(cmd)
.prefix(classfile)
.get(0)
}
//for(i in jsList) {
parallel4Array(jsList, function (i) {
try {
var file = i;
if (file.isFile) {
//if (file.filename == 'ow.waf.js' || file.filename == 'ow.portal.js') return i;
log("Adding " + file.filename);
if (file.filename !== 'example.js' &&
file.filename !== 'underscore.js' &&
file.filename !== 'materialize.js' &&
file.filename !== 'materialize2.js' &&
file.filename !== 'showdown.js' &&
file.filename !== 'stream.js' &&
file.filename !== 'js-yaml.js' &&
file.filename !== 'highlight.js' &&
file.filename !== 'ajv.js' &&
file.filename !== 'fusejs.js' &&
file.filename !== 'handlebars.js' &&
file.filename !== 'lodash.js' &&
file.filename !== 'nlinq.js' &&
file.filename !== 'sqlParse.js' &&
file.filename !== 'nlinqParse.js' &&
file.filename !== 'slonParse.js' &&
file.filename !== 'oafp.js' &&
file.filename !== 'brainjs.js' &&
file.filename !== 'chart.js' &&
file.filename !== 'jquery.js') {
var doIt = true;
var origF = $from(origjssha.files).equals("file", file.filename).select();
if (origF.length > 0) {
if (sha1(io.readFileStream(OPENAF_BUILD_HOME + "/js/" + file.filename)) == origF[0].orig &&
sha1(io.readFileStream(OPENAF_BUILD_HOME + "/jsmin/" + file.filename)) == origF[0].dest) {
destjssha.files.push(origF[0]);
doIt = false;
}
}
if (doIt) {
log("-> Compiling " + file.filename);
var output = af.sh("java -jar " + OPENAF_BUILD_HOME + "/compiler.jar --language_out " + "ECMASCRIPT_2019" + " --env CUSTOM --strict_mode_input false --rewrite_polyfills false --js " + OPENAF_BUILD_HOME + "/js/" + file.filename + " --js_output_file " + OPENAF_BUILD_HOME + "/jsmin/" + file.filename, "", null, false);
log("<- Compiled " + file.filename);
destjssha.files.push({
file: file.filename,
orig: sha1(io.readFileStream(OPENAF_BUILD_HOME + "/js/" + file.filename)),
dest: sha1(io.readFileStream(OPENAF_BUILD_HOME + "/jsmin/" + file.filename))
});
if (output.length > 0) log(file.filename + ": " + output);
if (__stderr.length > 0) {
if (__stderr.match(/ WARNING - /))
logWarn(file.filename + ": " + __stderr);
else
logErr(file.filename + ": " + __stderr);
}
}
try {
log("Compiling from minimized " + file.filename + "...");
if (validationForCompile(file.filename))
//af.compileToClasses(file.filename.replace(/\./g, "_"), io.readFileString(OPENAF_BUILD_HOME + "/jsmin/" + file.filename), OPENAF_BUILD_HOME + "/jslib");
compileJS2Java(file.filename.replace(/\./g, "_"), io.readFileString(OPENAF_BUILD_HOME + "/jsmin/" + file.filename), OPENAF_BUILD_HOME + "/jslib");
if (validationForRequireCompile(file.filename))
//af.compileToClasses(file.filename.replace(/\./g, "_"), "var __" + file.filename.replace(/\./g, "_") + " = function(require, exports, module) {" + io.readFileString(OPENAF_BUILD_HOME + "/jsmin/" + file.filename) + "}", OPENAF_BUILD_HOME + "/jslib");
compileJS2Java(file.filename.replace(/\./g, "_"), "var __" + file.filename.replace(/\./g, "_") + " = function(require, exports, module) {" + io.readFileString(OPENAF_BUILD_HOME + "/jsmin/" + file.filename) + "}", OPENAF_BUILD_HOME + "/jslib");
} catch(e) {
logErr("Error while compiling to java classes ('" + file.filename + "'): " + e);
}
sync(function () {
tempJar.putFile("js/" + file.filename, io.readFileBytes(OPENAF_BUILD_HOME + "/jsmin/" + file.filename));
if (validationForCompile(file.filename) || validationForRequireCompile(file.filename)) zipJSlib.putFile(file.filename.replace(/\./g, "_") + ".class", io.readFileBytes(OPENAF_BUILD_HOME + "/jslib/" + file.filename.replace(/\./g, "_") + ".class" ));
}, tempJar);
} else {
try {
log("Compiling from source " + file.filename + "...");
if (validationForCompile(file.filename))
//af.compileToClasses(file.filename.replace(/\./g, "_"), io.readFileString(OPENAF_BUILD_HOME + "/js/" + file.filename), OPENAF_BUILD_HOME + "/jslib");
compileJS2Java(file.filename.replace(/\./g, "_"), io.readFileString(OPENAF_BUILD_HOME + "/js/" + file.filename), OPENAF_BUILD_HOME + "/jslib")
if (validationForRequireCompile(file.filename))
//af.compileToClasses(file.filename.replace(/\./g, "_"), "var __" + file.filename.replace(/\./g, "_") + " = function(require, exports, module) {" + io.readFileString(OPENAF_BUILD_HOME + "/js/" + file.filename) + "}", OPENAF_BUILD_HOME + "/jslib");
compileJS2Java(file.filename.replace(/\./g, "_"), "var __" + file.filename.replace(/\./g, "_") + " = function(require, exports, module) {" + io.readFileString(OPENAF_BUILD_HOME + "/js/" + file.filename) + "}", OPENAF_BUILD_HOME + "/jslib")
} catch(e) {
logErr("Error while compiling to java classes ('" + file.filename + "'): " + e);
}
sync(function () {
tempJar.putFile("js/" + file.filename, io.readFileBytes(OPENAF_BUILD_HOME + "/js/" + file.filename));
if (validationForCompile(file.filename) || validationForRequireCompile(file.filename)) zipJSlib.putFile(file.filename.replace(/\./g, "_") + ".class", io.readFileBytes(OPENAF_BUILD_HOME + "/jslib/" + file.filename.replace(/\./g, "_") + ".class" ));
}, tempJar);
}
}
return i;
} catch(e) { }
return true;
});
tempJar.putFile("compiledJS.jar", zipJSlib.generate({"compressionLevel": 9}));
zipJSlib.close();
try {
io.writeFile(OPENAF_BUILD_HOME + "/buildSHA.json", destjssha);
} catch (e) {
sprintErr(e);
}
// Build Manifest
log("Adding manifest");
var manifest = "Manifest-Version: 1.0\n";
manifest += "Rsrc-Class-Path: ./" + smallClassPath + "\n";
manifest += "Class-Path: .\n";
manifest += "Rsrc-Main-Class: openaf._AFCmdOS\n";
manifest += "Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader\n";
tempJar.putFile("META-INF/MANIFEST.MF", af.fromString2Bytes(manifest));
tempJar.putFile("META-INF/services/javax.script.ScriptEngineFactory", af.fromString2Bytes("openaf.OAFEngineFactory"));
// Build ODoc
try {
log("Building ODoc documentation");
var helpFiles = {
"odoc": OPENAF_BUILD_HOME + "/js/odoc.js",
"ow.test": OPENAF_BUILD_HOME + "/js/owrap.test.js",
"ow.format": OPENAF_BUILD_HOME + "/js/owrap.format.js",
"ow.template": OPENAF_BUILD_HOME + "/js/owrap.template.js",
"ow.java": OPENAF_BUILD_HOME + "/js/owrap.java.js",
"ow.net": OPENAF_BUILD_HOME + "/js/owrap.net.js",
"ow.server": OPENAF_BUILD_HOME + "/js/owrap.server.js",
"ow.obj": OPENAF_BUILD_HOME + "/js/owrap.obj.js",
"ow.ai": OPENAF_BUILD_HOME + "/js/owrap.ai.js",
"ow.ch": OPENAF_BUILD_HOME + "/js/owrap.ch.js",
"ow.oJob": OPENAF_BUILD_HOME + "/js/owrap.oJob.js",
"ow.sec": OPENAF_BUILD_HOME + "/js/owrap.sec.js",
"ow.metrics": OPENAF_BUILD_HOME + "/js/owrap.metrics.js",
"ow.python": OPENAF_BUILD_HOME + "/js/owrap.python.js",
"ow.debug": OPENAF_BUILD_HOME + "/js/owrap.debug.js",
"ow.obook": OPENAF_BUILD_HOME + "/js/owrap.oBook.js",
"afbase": OPENAF_BUILD_HOME + "/src/openaf/AFBase.java",
"io": OPENAF_BUILD_HOME + "/src/openaf/IOBase.java",
"iocore": OPENAF_BUILD_HOME + "/src/openaf/core/IO.java",
"csv": OPENAF_BUILD_HOME + "/src/openaf/core/CSV.java",
"db": OPENAF_BUILD_HOME + "/src/openaf/core/DB.java",
"console": OPENAF_BUILD_HOME + "/src/openaf/plugins/Console.java",
"threads": OPENAF_BUILD_HOME + "/src/openaf/plugins/Threads.java",
"email": OPENAF_BUILD_HOME + "/src/openaf/plugins/Email.java",
"http": OPENAF_BUILD_HOME + "/src/openaf/plugins/HTTP.java",
"httpd": OPENAF_BUILD_HOME + "/src/openaf/plugins/HTTPServer.java",
"jmx": OPENAF_BUILD_HOME + "/src/openaf/plugins/JMX.java",
"jmxserver": OPENAF_BUILD_HOME + "/src/openaf/plugins/JMXServer.java",
"ssh": OPENAF_BUILD_HOME + "/src/openaf/plugins/SSH.java",
"snmp": OPENAF_BUILD_HOME + "/src/openaf/plugins/SNMP.java",
"snmpd": OPENAF_BUILD_HOME + "/src/openaf/plugins/SNMPServer.java",
"xml": OPENAF_BUILD_HOME + "/src/openaf/plugins/XML.java",
//"xls": OPENAF_BUILD_HOME + "/src/openaf/plugins/XLS.java",
//"svn": OPENAF_BUILD_HOME + "/src/openaf/plugins/SVN.java",
//"git": OPENAF_BUILD_HOME + "/src/openaf/plugins/GIT.java",
//"smb": OPENAF_BUILD_HOME + "/src/openaf/plugins/SMB.java",
"zip": OPENAF_BUILD_HOME + "/src/openaf/plugins/ZIP.java",
//"ignite": OPENAF_BUILD_HOME + "/src/openaf/plugins/Ignite.java",
"bsdiff": OPENAF_BUILD_HOME + "/src/openaf/plugins/BSDiff.java",
"scope": OPENAF_BUILD_HOME + "/js/openaf.js",
"scopesigil": OPENAF_BUILD_HOME + "/js/openafsigil.js",
"index": OPENAF_BUILD_HOME + "/js/example.js"
};
saveHelp(OPENAF_BUILD_HOME, helpFiles);
log("Generating oDoc for Web");
io.mkdir(OPENAF_BUILD_HOME + "/odocweb");
saveHelpWeb(OPENAF_BUILD_HOME + "/odocweb", helpFiles);
tempJar.putFile(".odoc.db", io.readFileBytes(OPENAF_BUILD_HOME + "/.odoc.db"));
} catch (e) {
logErr(e);
}
if (isUnDef(OPENAF_JSON)) {
tempJar.putFile("openaf.json", io.readFileBytes(OPENAF_BUILD_HOME + "/openaf.json"));
log("Added " + OPENAF_BUILD_HOME + "/openaf.json...");
} else {
tempJar.putFile("openaf.json", io.readFileBytes(OPENAF_JSON));
log("Added " + OPENAF_JSON + "...");
}
tempJar.putFile("ojob.json", io.readFileBytes(OPENAF_BUILD_HOME + "/ojob.json"))
log("Added " + OPENAF_BUILD_HOME + "/ojob.json")
//Build deps
log("Building dependencies");
io.writeFileString(OPENAF_BUILD_HOME + "/dependencies.json", stringify(buildDeps()));
log("Creating the openaf.jar in " + OPENAF_BUILD_HOME);
io.rm(OPENAF_BUILD_HOME + "/openaf.jar");
tempJar.generate2File(OPENAF_BUILD_HOME + "/openaf.jar", { compressionLevel: 9 }, true);
tempJar.close();
log("Done build");