blob: 1cde0ed84182d7072255ccc7b2e57b1ae389f5c6 (
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
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
|
import qbs.TextFile
Product {
property string packageName: ""
qbs.targetPlatform: "android"
multiplexByQbsProperties: ["architectures"]
Properties {
condition: qbs.architectures && qbs.architectures.length > 1
aggregate: true
multiplexedType: "json_arch"
}
Depends { name: "Android.sdk"; required: false }
Depends { name: "Android.ndk"; required: false }
type: ["json"]
Rule {
multiplex: true
property stringList inputTags: "json_arch"
inputsFromDependencies: inputTags
inputs: product.aggregate ? [] : inputTags
Artifact {
filePath: ["android.json"]
fileTags: ["json"]
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = output.filePath;
cmd.sourceCode = function() {
var tools = {};
for (var i in inputs["json_arch"]) {
var tf = new TextFile(inputs["json_arch"][i].filePath, TextFile.ReadOnly);
var json = JSON.parse(tf.readAll());
tools["ndk"] = json["ndk"];
tools["ndk-samples"] = json["ndk-samples"];
tf.close();
}
if (product.moduleProperty("Android.sdk", "present")) {
tools["sdk"] = product.moduleProperty("Android.sdk", "sdkDir");
tools["sdk-build-tools-dx"] = product.Android.sdk.dxFilePath;
tools["sdk-build-tools-d8"] = product.Android.sdk.d8FilePath;
}
if (product.java && product.java.present)
tools["jar"] = product.java.jarFilePath;
var tf;
try {
tf = new TextFile(output.filePath, TextFile.WriteOnly);
tf.writeLine(JSON.stringify(tools, undefined, 4));
} finally {
if (tf)
tf.close();
}
};
return cmd;
}
}
Rule {
multiplex: true
Artifact {
filePath: ["android_arch.json"]
fileTags: ["json_arch"]
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = output.filePath;
cmd.sourceCode = function() {
var tools = {};
if (product.moduleProperty("Android.ndk", "present")) {
tools["ndk"] = product.moduleProperty("Android.ndk", "ndkDir");
tools["ndk-samples"] = product.Android.ndk.ndkSamplesDir;
}
var tf;
try {
tf = new TextFile(output.filePath, TextFile.WriteOnly);
tf.writeLine(JSON.stringify(tools, undefined, 4));
} finally {
if (tf)
tf.close();
}
};
return cmd;
}
}
}
|