UNPKG

2.72 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.DIR_TARGET = exports.DEFAULT_TARGET = exports.Target = exports.Platform = void 0;
7
8function _bluebirdLst() {
9 const data = require("bluebird-lst");
10
11 _bluebirdLst = function () {
12 return data;
13 };
14
15 return data;
16}
17
18function _builderUtil() {
19 const data = require("builder-util");
20
21 _builderUtil = function () {
22 return data;
23 };
24
25 return data;
26}
27
28class Platform {
29 constructor(name, buildConfigurationKey, nodeName) {
30 this.name = name;
31 this.buildConfigurationKey = buildConfigurationKey;
32 this.nodeName = nodeName;
33 }
34
35 toString() {
36 return this.name;
37 }
38
39 createTarget(type, ...archs) {
40 if (type == null && (archs == null || archs.length === 0)) {
41 return new Map([[this, new Map()]]);
42 }
43
44 const archToType = new Map();
45
46 if (this === Platform.MAC) {
47 archs = [_builderUtil().Arch.x64];
48 }
49
50 for (const arch of archs == null || archs.length === 0 ? [(0, _builderUtil().archFromString)(process.arch)] : archs) {
51 archToType.set(arch, type == null ? [] : Array.isArray(type) ? type : [type]);
52 }
53
54 return new Map([[this, archToType]]);
55 }
56
57 static current() {
58 return Platform.fromString(process.platform);
59 }
60
61 static fromString(name) {
62 name = name.toLowerCase();
63
64 switch (name) {
65 case Platform.MAC.nodeName:
66 case Platform.MAC.name:
67 return Platform.MAC;
68
69 case Platform.WINDOWS.nodeName:
70 case Platform.WINDOWS.name:
71 case Platform.WINDOWS.buildConfigurationKey:
72 return Platform.WINDOWS;
73
74 case Platform.LINUX.nodeName:
75 return Platform.LINUX;
76
77 default:
78 throw new Error(`Unknown platform: ${name}`);
79 }
80 }
81
82}
83
84exports.Platform = Platform;
85Platform.MAC = new Platform("mac", "mac", "darwin");
86Platform.LINUX = new Platform("linux", "linux", "linux");
87Platform.WINDOWS = new Platform("windows", "win", "win32");
88
89class Target {
90 constructor(name, isAsyncSupported = true) {
91 this.name = name;
92 this.isAsyncSupported = isAsyncSupported;
93 } // noinspection JSMethodCanBeStatic
94
95
96 logBuilding(targetPresentableName, artifactPath, arch) {
97 _builderUtil().log.info({
98 target: targetPresentableName,
99 arch: _builderUtil().Arch[arch],
100 file: _builderUtil().log.filePath(artifactPath)
101 }, "building");
102 }
103
104 checkOptions() {// ignore
105
106 return (0, _bluebirdLst().coroutine)(function* () {})();
107 }
108
109 finishBuild() {
110 return Promise.resolve();
111 }
112
113}
114
115exports.Target = Target;
116const DEFAULT_TARGET = "default";
117exports.DEFAULT_TARGET = DEFAULT_TARGET;
118const DIR_TARGET = "dir"; exports.DIR_TARGET = DIR_TARGET;
119//# sourceMappingURL=core.js.map
\No newline at end of file