1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.getArchSuffix = getArchSuffix;
|
7 | exports.toLinuxArchString = toLinuxArchString;
|
8 | exports.archFromString = archFromString;
|
9 | var Arch = exports.Arch = undefined;
|
10 | (function (Arch) {
|
11 | Arch[Arch["ia32"] = 0] = "ia32";
|
12 | Arch[Arch["x64"] = 1] = "x64";
|
13 | Arch[Arch["armv7l"] = 2] = "armv7l";
|
14 | })(Arch || (exports.Arch = Arch = {}));
|
15 | function getArchSuffix(arch) {
|
16 | return arch === Arch.x64 ? "" : `-${Arch[arch]}`;
|
17 | }
|
18 | function toLinuxArchString(arch) {
|
19 | return arch === Arch.ia32 ? "i386" : arch === Arch.x64 ? "amd64" : "armv7l";
|
20 | }
|
21 | function archFromString(name) {
|
22 | if (name === "x64") {
|
23 | return Arch.x64;
|
24 | }
|
25 | if (name === "ia32") {
|
26 | return Arch.ia32;
|
27 | }
|
28 | if (name === "armv7l") {
|
29 | return Arch.armv7l;
|
30 | }
|
31 | throw new Error(`Unsupported arch ${name}`);
|
32 | }
|
33 | class Platform {
|
34 | constructor(name, buildConfigurationKey, nodeName) {
|
35 | this.name = name;
|
36 | this.buildConfigurationKey = buildConfigurationKey;
|
37 | this.nodeName = nodeName;
|
38 | }
|
39 | toString() {
|
40 | return this.name;
|
41 | }
|
42 | createTarget(type) {
|
43 | for (var _len = arguments.length, archs = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
44 | archs[_key - 1] = arguments[_key];
|
45 | }
|
46 |
|
47 | if (type == null && (archs == null || archs.length === 0)) {
|
48 | return new Map([[this, new Map()]]);
|
49 | }
|
50 | const archToType = new Map();
|
51 | if (this === Platform.MAC) {
|
52 | archs = [Arch.x64];
|
53 | }
|
54 | for (const arch of archs == null || archs.length === 0 ? [archFromString(process.arch)] : archs) {
|
55 | archToType.set(arch, type == null ? [] : Array.isArray(type) ? type : [type]);
|
56 | }
|
57 | return new Map([[this, archToType]]);
|
58 | }
|
59 | static current() {
|
60 | return Platform.fromString(process.platform);
|
61 | }
|
62 | static fromString(name) {
|
63 | name = name.toLowerCase();
|
64 | switch (name) {
|
65 | case Platform.MAC.nodeName:
|
66 | case Platform.MAC.name:
|
67 | return Platform.MAC;
|
68 | case Platform.WINDOWS.nodeName:
|
69 | case Platform.WINDOWS.name:
|
70 | case Platform.WINDOWS.buildConfigurationKey:
|
71 | return Platform.WINDOWS;
|
72 | case Platform.LINUX.nodeName:
|
73 | return Platform.LINUX;
|
74 | default:
|
75 | throw new Error(`Unknown platform: ${name}`);
|
76 | }
|
77 | }
|
78 | }
|
79 | exports.Platform = Platform;
|
80 | Platform.MAC = new Platform("mac", "mac", "darwin");
|
81 | Platform.LINUX = new Platform("linux", "linux", "linux");
|
82 | Platform.WINDOWS = new Platform("windows", "win", "win32");
|
83 |
|
84 |
|
85 | Platform.OSX = Platform.MAC;
|
86 | class Target {
|
87 | constructor(name) {
|
88 | let isAsyncSupported = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
89 |
|
90 | this.name = name;
|
91 | this.isAsyncSupported = isAsyncSupported;
|
92 | }
|
93 | finishBuild() {
|
94 | return Promise.resolve();
|
95 | }
|
96 | }
|
97 | exports.Target = Target;
|
98 | const DEFAULT_TARGET = exports.DEFAULT_TARGET = "default";
|
99 | const DIR_TARGET = exports.DIR_TARGET = "dir";
|
100 |
|
\ | No newline at end of file |