blob: f50f8a2845d0511b04d5aa2618fba73e789255ca (
plain)
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
|
import qbs
import qbs.File
import qbs.FileInfo
import qbs.ModUtils
Module {
// JavaScript files which have been "processed" - currently this simply means "copied to output
// directory" but might later include minification and obfuscation processing
additionalProductTypes: ["nodejs_processed_js"].concat(applicationFile ? ["application"] : [])
property path applicationFile
PropertyOptions {
name: "applicationFile"
description: "file whose corresponding output will be executed when running the Node.js app"
}
setupRunEnvironment: {
var v = new ModUtils.EnvironmentVariable("NODE_PATH", qbs.pathListSeparator, qbs.hostOS.contains("windows"));
v.prepend(FileInfo.path(getEnv("QBS_RUN_FILE_PATH")));
v.set();
}
FileTagger {
patterns: ["*.js"]
fileTags: ["js"]
}
Rule {
inputs: ["js"]
outputArtifacts: {
var tags = ["nodejs_processed_js"];
if (input.fileTags.contains("application_js") ||
product.moduleProperty("nodejs", "applicationFile") === input.filePath)
tags.push("application");
return [{
filePath: product.destinationDirectory + '/' + input.fileName,
fileTags: tags
}];
}
outputFileTags: ["nodejs_processed_js", "application"]
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "copying " + input.fileName;
cmd.sourceCode = function() {
File.copy(input.filePath, output.filePath);
};
return cmd;
}
}
}
|