@microtronics/studio-cli 0.26.0 → 0.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -6
- package/dist/studio-cli.d.ts +27 -12
- package/out/api.js +5 -4
- package/out/dlo/compiler.js +45 -44
- package/out/dlo/dlo.js +1 -0
- package/out/dlo/preCompiler.js +1 -1
- package/out/helper.js +1 -1
- package/out/package/package.js +56 -17
- package/out/scriptRunner.js +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
## 0.27.1 (2025-03-25)
|
|
4
|
+
|
|
5
|
+
## 0.27.0 (2025-03-20)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **studio-core:** support to allow preview of the app version manifest ([fdfe18b](https://bitbucket.org/microtronics-core/vscode-studio/commits/fdfe18bf873de150b6870004249880a3e990a811))
|
|
11
|
+
|
|
12
|
+
## 0.26.0 (2025-03-18)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* implemented generic logger ([46b72a1](https://bitbucket.org/microtronics-core/vscode-studio/commits/46b72a1f5bcf9cfe85e58deb7e69bf3e56aa0875))
|
|
9
18
|
* **studio-cli:** introduced generic logger with chalk as colorization tool ([6593494](https://bitbucket.org/microtronics-core/vscode-studio/commits/65934942e2d30b3dfcc965e798ad8c508bf2ed52))
|
|
10
19
|
|
|
11
20
|
## 0.25.0 (2025-03-12)
|
package/dist/studio-cli.d.ts
CHANGED
|
@@ -116,15 +116,16 @@ declare interface BaseTagHeader {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
|
-
* Builds
|
|
119
|
+
* Builds the specified parts of the project located in the given directory.
|
|
120
120
|
*
|
|
121
121
|
* @param {URI} cwd - The current working directory where the build process will be executed.
|
|
122
122
|
* @param {LocalFS} fs - The local file system instance used for file operations during the build.
|
|
123
123
|
* @param {Logger} logger - Logger instance for logging details during the build process.
|
|
124
124
|
* @param {APM.Part} selectedParts - The project parts to be built.
|
|
125
|
-
* @
|
|
125
|
+
* @param {boolean} [errorWithDiagnostics] - If true, includes diagnostic details in case of an error.
|
|
126
|
+
* @return {Promise<Object>} A promise resolved with an object containing diagnostics information for the specified project parts: `dde`, `dlo`, and `dfiles`.
|
|
126
127
|
*/
|
|
127
|
-
export declare function build(cwd: URI, fs: LocalFS, logger: Log.Logger, selectedParts?: APM.Part[] | boolean): Promise<{
|
|
128
|
+
export declare function build(cwd: URI, fs: LocalFS, logger: Log.Logger, selectedParts?: APM.Part[] | boolean, errorWithDiagnostics?: boolean): Promise<{
|
|
128
129
|
[APM.Part.dde]: Diagnostics.File[];
|
|
129
130
|
[APM.Part.dlo]: Diagnostics.File[];
|
|
130
131
|
[APM.Part.dfiles]: Diagnostics.File[];
|
|
@@ -372,7 +373,7 @@ declare interface components {
|
|
|
372
373
|
ApplicationVersion: string | number;
|
|
373
374
|
ApplicationVersionInSemver: boolean;
|
|
374
375
|
/** @description File that can be downloaded */
|
|
375
|
-
ApplicationFileName: "release-notes.md" | "app.tar.gz";
|
|
376
|
+
ApplicationFileName: "release-notes.md" | "app.tar.gz" | "studio.json";
|
|
376
377
|
/** @description User Id */
|
|
377
378
|
MemberId: string;
|
|
378
379
|
/** @description User Id */
|
|
@@ -1764,6 +1765,7 @@ export declare namespace DLO {
|
|
|
1764
1765
|
const Compiler: typeof DloCompiler;
|
|
1765
1766
|
export type Compiler = DloCompiler;
|
|
1766
1767
|
const uriToMemFs: typeof uriToMemFsPath;
|
|
1768
|
+
const parseCompilerWarningsAndErrors: typeof parseWarningsAndErrors;
|
|
1767
1769
|
/**
|
|
1768
1770
|
* Generate the dlo.cfg file and write it to the .studio/auto/dlo directory
|
|
1769
1771
|
* @param cwd
|
|
@@ -1818,7 +1820,6 @@ declare class DloCompiler {
|
|
|
1818
1820
|
memFSunlink(uri: URI): Promise<void>;
|
|
1819
1821
|
private memFSmkdir;
|
|
1820
1822
|
private memFSstat;
|
|
1821
|
-
private parseWarningsAndErrors;
|
|
1822
1823
|
/**
|
|
1823
1824
|
* Get a symbol compiler instance
|
|
1824
1825
|
*/
|
|
@@ -1845,10 +1846,10 @@ declare class DloPreCompiler {
|
|
|
1845
1846
|
private dloFileSequencer;
|
|
1846
1847
|
constructor();
|
|
1847
1848
|
get pragmaDynamicFlag(): string | null;
|
|
1848
|
-
preCompileDloFile(cwd: URI, manifest: Manifest.Manifest, fileUri: URI, fileBlob: string[]):
|
|
1849
|
+
preCompileDloFile(cwd: URI, manifest: Manifest.Manifest, fileUri: URI, fileBlob: string[]): {
|
|
1849
1850
|
diagnostics: Diagnostics.File[];
|
|
1850
1851
|
data: string;
|
|
1851
|
-
}
|
|
1852
|
+
};
|
|
1852
1853
|
}
|
|
1853
1854
|
|
|
1854
1855
|
export declare namespace ENV {
|
|
@@ -2290,18 +2291,25 @@ export declare namespace Manifest {
|
|
|
2290
2291
|
}
|
|
2291
2292
|
|
|
2292
2293
|
export declare namespace Package {
|
|
2294
|
+
export interface MergedDiagnostics {
|
|
2295
|
+
[APM.Part.dde]: Diagnostics.File[];
|
|
2296
|
+
[APM.Part.dlo]: Diagnostics.File[];
|
|
2297
|
+
[APM.Part.dfiles]: Diagnostics.File[];
|
|
2298
|
+
}
|
|
2299
|
+
export class BuildError extends Error {
|
|
2300
|
+
private readonly _mergedDiagnostics;
|
|
2301
|
+
constructor(message: string, mergedDiagnostics: MergedDiagnostics);
|
|
2302
|
+
get mergedDiagnostics(): MergedDiagnostics;
|
|
2303
|
+
}
|
|
2293
2304
|
/**
|
|
2294
2305
|
* Build the whole project or only a specific part
|
|
2295
2306
|
* @param cwd
|
|
2296
2307
|
* @param fs
|
|
2297
2308
|
* @param logger
|
|
2298
2309
|
* @param selectedParts - choose a specific part that should be build or if true all parts are build
|
|
2310
|
+
* @param errorWithDiagnostics
|
|
2299
2311
|
*/
|
|
2300
|
-
export function buildAll(cwd: URI, fs: LocalFS, logger: Log.Logger, selectedParts?: APM.Part[] | boolean): Promise<
|
|
2301
|
-
[APM.Part.dde]: Diagnostics.File[];
|
|
2302
|
-
[APM.Part.dlo]: Diagnostics.File[];
|
|
2303
|
-
[APM.Part.dfiles]: Diagnostics.File[];
|
|
2304
|
-
}>;
|
|
2312
|
+
export function buildAll(cwd: URI, fs: LocalFS, logger: Log.Logger, selectedParts?: APM.Part[] | boolean, errorWithDiagnostics?: boolean): Promise<MergedDiagnostics>;
|
|
2305
2313
|
/**
|
|
2306
2314
|
* Trigger the release based on the manifest settings
|
|
2307
2315
|
* @param cwd
|
|
@@ -2358,6 +2366,8 @@ export declare namespace Package {
|
|
|
2358
2366
|
export function validatePublishSettings(cwd: URI, fs: LocalFS, token: Registry.AuthToken, env: Globals.ENV): Promise<void>;
|
|
2359
2367
|
}
|
|
2360
2368
|
|
|
2369
|
+
declare function parseWarningsAndErrors(stderr: string[], relatedFile?: URI): Diagnostics.File[];
|
|
2370
|
+
|
|
2361
2371
|
/**
|
|
2362
2372
|
* This file was auto-generated by openapi-typescript.
|
|
2363
2373
|
* Do not make direct changes to the file.
|
|
@@ -3584,6 +3594,11 @@ declare interface paths {
|
|
|
3584
3594
|
[name: string]: unknown;
|
|
3585
3595
|
};
|
|
3586
3596
|
content: {
|
|
3597
|
+
"application/json": {
|
|
3598
|
+
name?: string;
|
|
3599
|
+
} & {
|
|
3600
|
+
[key: string]: unknown;
|
|
3601
|
+
};
|
|
3587
3602
|
"application/gzip": string;
|
|
3588
3603
|
"text/markdown": string;
|
|
3589
3604
|
};
|
package/out/api.js
CHANGED
|
@@ -65,16 +65,17 @@ async function install(cwd, fs, env, apiToken, dependencies) {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
|
-
* Builds
|
|
68
|
+
* Builds the specified parts of the project located in the given directory.
|
|
69
69
|
*
|
|
70
70
|
* @param {URI} cwd - The current working directory where the build process will be executed.
|
|
71
71
|
* @param {LocalFS} fs - The local file system instance used for file operations during the build.
|
|
72
72
|
* @param {Logger} logger - Logger instance for logging details during the build process.
|
|
73
73
|
* @param {APM.Part} selectedParts - The project parts to be built.
|
|
74
|
-
* @
|
|
74
|
+
* @param {boolean} [errorWithDiagnostics] - If true, includes diagnostic details in case of an error.
|
|
75
|
+
* @return {Promise<Object>} A promise resolved with an object containing diagnostics information for the specified project parts: `dde`, `dlo`, and `dfiles`.
|
|
75
76
|
*/
|
|
76
|
-
async function build(cwd, fs, logger, selectedParts = true) {
|
|
77
|
-
return package_1.Package.buildAll(cwd, fs, logger, selectedParts);
|
|
77
|
+
async function build(cwd, fs, logger, selectedParts = true, errorWithDiagnostics) {
|
|
78
|
+
return package_1.Package.buildAll(cwd, fs, logger, selectedParts, errorWithDiagnostics);
|
|
78
79
|
}
|
|
79
80
|
/**
|
|
80
81
|
* Publishes a package to the registry with the specified settings and configurations.
|
package/out/dlo/compiler.js
CHANGED
|
@@ -25,6 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.DloCompiler = void 0;
|
|
27
27
|
exports.uriToMemFsPath = uriToMemFsPath;
|
|
28
|
+
exports.parseWarningsAndErrors = parseWarningsAndErrors;
|
|
28
29
|
exports.generateConfigFile = generateConfigFile;
|
|
29
30
|
const preCompiler_1 = require("./preCompiler");
|
|
30
31
|
const vscode_uri_1 = require("vscode-uri");
|
|
@@ -101,7 +102,7 @@ class DloCompiler {
|
|
|
101
102
|
code: exitCode,
|
|
102
103
|
stdout: this.stdout,
|
|
103
104
|
stderr: this.stderr,
|
|
104
|
-
diagnostics: [...precompilerDiagnostics, ...
|
|
105
|
+
diagnostics: [...precompilerDiagnostics, ...parseWarningsAndErrors(this.stderr, mainFile)]
|
|
105
106
|
};
|
|
106
107
|
}
|
|
107
108
|
async persistGeneratedFiles(cwd, fs, mainFile) {
|
|
@@ -154,7 +155,7 @@ class DloCompiler {
|
|
|
154
155
|
*/
|
|
155
156
|
async memFSwriteFile(cwd, manifest, file, stringBlob) {
|
|
156
157
|
const precompilerDiagnostics = [];
|
|
157
|
-
const preCompiled =
|
|
158
|
+
const preCompiled = this.preCompiler.preCompileDloFile(cwd, manifest, file, stringBlob);
|
|
158
159
|
precompilerDiagnostics.push(...preCompiled.diagnostics);
|
|
159
160
|
this.memFSmkdir(file);
|
|
160
161
|
this.MEMFS.writeFile(uriToMemFsPath(file), iconv.encode(preCompiled.data, 'cp1252'));
|
|
@@ -213,48 +214,6 @@ class DloCompiler {
|
|
|
213
214
|
return false;
|
|
214
215
|
}
|
|
215
216
|
}
|
|
216
|
-
parseWarningsAndErrors(stderr, relatedFile) {
|
|
217
|
-
const compilerDiagnostics = [];
|
|
218
|
-
const messages = stderr.filter(line => !!line.trim());
|
|
219
|
-
for (const message of messages) {
|
|
220
|
-
if ((message.includes('Assertion failed:') || message.includes('Compilation aborted.')) && relatedFile) {
|
|
221
|
-
compilerDiagnostics.push({
|
|
222
|
-
file: relatedFile,
|
|
223
|
-
level: 'error',
|
|
224
|
-
line: 0,
|
|
225
|
-
message: message
|
|
226
|
-
});
|
|
227
|
-
continue;
|
|
228
|
-
}
|
|
229
|
-
// regular error/warning - such as:
|
|
230
|
-
// C:\Users\aai\rmstudio\apmparts\dlo-pawn\stdlib\rm-dde.inc(392) : error 036: empty statement
|
|
231
|
-
// main.p(138) : warning 203: symbol is never used: "log_str"
|
|
232
|
-
// main.p(6) : fatal error 100: cannot read from file: "oTests/module_t"
|
|
233
|
-
const i0 = message.indexOf(' : ');
|
|
234
|
-
const i1 = message.indexOf(': ', i0 + 3);
|
|
235
|
-
const fileNameAndLineNumber = message.substring(0, i0).trim();
|
|
236
|
-
const levelAndCode = message.substring(i0 + 3, i1).trim();
|
|
237
|
-
const msg = message.substring(i1 + 2).trim();
|
|
238
|
-
// ignore lines which do not contain err/warn msg (or are empty)
|
|
239
|
-
if (!fileNameAndLineNumber || !levelAndCode || !msg) {
|
|
240
|
-
continue;
|
|
241
|
-
}
|
|
242
|
-
const [fileName, lineNumber] = fileNameAndLineNumber.split(/[()(-)]/);
|
|
243
|
-
const decodeLevelAndCode = levelAndCode.split(' ');
|
|
244
|
-
const level = decodeLevelAndCode[decodeLevelAndCode.length - 2]; //lvl is always the second last
|
|
245
|
-
let posix = fileName.replace(/\\/g, '/');
|
|
246
|
-
if (posix.startsWith('/')) {
|
|
247
|
-
posix = posix.substring(1);
|
|
248
|
-
}
|
|
249
|
-
compilerDiagnostics.push({
|
|
250
|
-
file: vscode_uri_1.URI.parse(`file:///${posix}`),
|
|
251
|
-
level,
|
|
252
|
-
line: Number(lineNumber) - 1,
|
|
253
|
-
message: msg
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
return compilerDiagnostics;
|
|
257
|
-
}
|
|
258
217
|
//Symbol Compiler handling
|
|
259
218
|
/**
|
|
260
219
|
* Get a symbol compiler instance
|
|
@@ -294,6 +253,48 @@ exports.DloCompiler = DloCompiler;
|
|
|
294
253
|
function uriToMemFsPath(path) {
|
|
295
254
|
return path.fsPath.replace(/\\/g, '/');
|
|
296
255
|
}
|
|
256
|
+
function parseWarningsAndErrors(stderr, relatedFile) {
|
|
257
|
+
const compilerDiagnostics = [];
|
|
258
|
+
const messages = stderr.filter(line => !!line.trim());
|
|
259
|
+
for (const message of messages) {
|
|
260
|
+
if ((message.includes('Assertion failed:') || message.includes('Compilation aborted.')) && relatedFile) {
|
|
261
|
+
compilerDiagnostics.push({
|
|
262
|
+
file: relatedFile,
|
|
263
|
+
level: 'error',
|
|
264
|
+
line: 0,
|
|
265
|
+
message: message
|
|
266
|
+
});
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
// regular error/warning - such as:
|
|
270
|
+
// C:\Users\aai\rmstudio\apmparts\dlo-pawn\stdlib\rm-dde.inc(392) : error 036: empty statement
|
|
271
|
+
// main.p(138) : warning 203: symbol is never used: "log_str"
|
|
272
|
+
// main.p(6) : fatal error 100: cannot read from file: "oTests/module_t"
|
|
273
|
+
const i0 = message.indexOf(' : ');
|
|
274
|
+
const i1 = message.indexOf(': ', i0 + 3);
|
|
275
|
+
const fileNameAndLineNumber = message.substring(0, i0).trim();
|
|
276
|
+
const levelAndCode = message.substring(i0 + 3, i1).trim();
|
|
277
|
+
const msg = message.substring(i1 + 2).trim();
|
|
278
|
+
// ignore lines which do not contain err/warn msg (or are empty)
|
|
279
|
+
if (!fileNameAndLineNumber || !levelAndCode || !msg) {
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
const [fileName, lineNumber] = fileNameAndLineNumber.split(/[()(-)]/);
|
|
283
|
+
const decodeLevelAndCode = levelAndCode.split(' ');
|
|
284
|
+
const level = decodeLevelAndCode[decodeLevelAndCode.length - 2]; //lvl is always the second last
|
|
285
|
+
let posix = fileName.replace(/\\/g, '/');
|
|
286
|
+
if (posix.startsWith('/')) {
|
|
287
|
+
posix = posix.substring(1);
|
|
288
|
+
}
|
|
289
|
+
compilerDiagnostics.push({
|
|
290
|
+
file: vscode_uri_1.URI.parse(`file:///${posix}`),
|
|
291
|
+
level,
|
|
292
|
+
line: Number(lineNumber) - 1,
|
|
293
|
+
message: msg
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
return compilerDiagnostics;
|
|
297
|
+
}
|
|
297
298
|
/**
|
|
298
299
|
* Generates the DLO .cfg file for the dlo compiler
|
|
299
300
|
* @param cwd
|
package/out/dlo/dlo.js
CHANGED
|
@@ -15,6 +15,7 @@ var DLO;
|
|
|
15
15
|
*/
|
|
16
16
|
DLO.Compiler = compiler_1.DloCompiler;
|
|
17
17
|
DLO.uriToMemFs = compiler_1.uriToMemFsPath;
|
|
18
|
+
DLO.parseCompilerWarningsAndErrors = compiler_1.parseWarningsAndErrors;
|
|
18
19
|
/**
|
|
19
20
|
* Generate the dlo.cfg file and write it to the .studio/auto/dlo directory
|
|
20
21
|
* @param cwd
|
package/out/dlo/preCompiler.js
CHANGED
|
@@ -87,7 +87,7 @@ class DloPreCompiler {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
90
|
-
|
|
90
|
+
preCompileDloFile(cwd, manifest, fileUri, fileBlob) {
|
|
91
91
|
this.dloFileSequencer.workspacePath = cwd;
|
|
92
92
|
const fileDiagnostics = [];
|
|
93
93
|
const filePath = fileUri.path;
|
package/out/helper.js
CHANGED
|
@@ -63,7 +63,7 @@ var Helper;
|
|
|
63
63
|
Helper.normalizeLF = normalizeLF;
|
|
64
64
|
function convertBlobToStringArray(blob) {
|
|
65
65
|
try {
|
|
66
|
-
const textData = convertBlobToString(blob)
|
|
66
|
+
const textData = convertBlobToString(blob);
|
|
67
67
|
return normalizeLF(textData).split('\n');
|
|
68
68
|
}
|
|
69
69
|
catch (e) {
|
package/out/package/package.js
CHANGED
|
@@ -16,18 +16,28 @@ const library_1 = require("./library");
|
|
|
16
16
|
const dfiles_1 = require("../dfiles/dfiles");
|
|
17
17
|
var Package;
|
|
18
18
|
(function (Package) {
|
|
19
|
+
class BuildError extends Error {
|
|
20
|
+
_mergedDiagnostics;
|
|
21
|
+
constructor(message, mergedDiagnostics) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.name = 'BuildError';
|
|
24
|
+
this._mergedDiagnostics = mergedDiagnostics;
|
|
25
|
+
}
|
|
26
|
+
get mergedDiagnostics() {
|
|
27
|
+
return this._mergedDiagnostics;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
Package.BuildError = BuildError;
|
|
19
31
|
/**
|
|
20
32
|
* Build the whole project or only a specific part
|
|
21
33
|
* @param cwd
|
|
22
34
|
* @param fs
|
|
23
35
|
* @param logger
|
|
24
36
|
* @param selectedParts - choose a specific part that should be build or if true all parts are build
|
|
37
|
+
* @param errorWithDiagnostics
|
|
25
38
|
*/
|
|
26
|
-
async function buildAll(cwd, fs, logger, selectedParts = true) {
|
|
27
|
-
|
|
28
|
-
logger.info('Building project...');
|
|
29
|
-
}
|
|
30
|
-
selectedParts = Object.values(apm_1.APM.Part);
|
|
39
|
+
async function buildAll(cwd, fs, logger, selectedParts = true, errorWithDiagnostics) {
|
|
40
|
+
selectedParts = normalizeSelectedParts(logger, selectedParts);
|
|
31
41
|
const mergedDiagnostics = {
|
|
32
42
|
[apm_1.APM.Part.dde]: [],
|
|
33
43
|
[apm_1.APM.Part.dlo]: [],
|
|
@@ -39,20 +49,30 @@ var Package;
|
|
|
39
49
|
[apm_1.APM.Part.dlo]: buildDLO,
|
|
40
50
|
[apm_1.APM.Part.dfiles]: buildDfiles
|
|
41
51
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
try {
|
|
53
|
+
// Build and validate specific parts
|
|
54
|
+
for (const part of [apm_1.APM.Part.dde, apm_1.APM.Part.dlo, apm_1.APM.Part.dfiles]) {
|
|
55
|
+
if (selectedParts.includes(part)) {
|
|
56
|
+
logger.info(`Building ${part.toUpperCase()}...`);
|
|
57
|
+
const hasError = await buildAndValidatePart(logger, part,
|
|
58
|
+
/*@ts-ignore*/
|
|
59
|
+
buildMapping[part],
|
|
60
|
+
/*@ts-ignore*/
|
|
61
|
+
mergedDiagnostics[part], cwd, fs);
|
|
62
|
+
if (hasError) {
|
|
63
|
+
return mergedDiagnostics; // Early exit on error
|
|
64
|
+
}
|
|
53
65
|
}
|
|
54
66
|
}
|
|
55
67
|
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
if (errorWithDiagnostics) {
|
|
70
|
+
throw new BuildError(e?.message, mergedDiagnostics);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
throw e;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
56
76
|
// Handle pov and blo parts that do not return diagnostics
|
|
57
77
|
if (selectedParts.includes(apm_1.APM.Part.pov)) {
|
|
58
78
|
await scriptRunner_1.Shell.tryBuildPov(cwd, fs, logger);
|
|
@@ -227,6 +247,23 @@ var Package;
|
|
|
227
247
|
}
|
|
228
248
|
Package.validatePublishSettings = validatePublishSettings;
|
|
229
249
|
})(Package || (exports.Package = Package = {}));
|
|
250
|
+
/**
|
|
251
|
+
* Normalize the selected parts parameter for building.
|
|
252
|
+
* @param logger - Logger for generic logging
|
|
253
|
+
* @param selectedParts - Can be a boolean or parts array. True selects all parts, false selects none.
|
|
254
|
+
* @returns Normalized array of parts.
|
|
255
|
+
*/
|
|
256
|
+
function normalizeSelectedParts(logger, selectedParts) {
|
|
257
|
+
const ALL_PARTS = Object.values(apm_1.APM.Part);
|
|
258
|
+
if (selectedParts === true) {
|
|
259
|
+
logger.info('Building project...');
|
|
260
|
+
return ALL_PARTS;
|
|
261
|
+
}
|
|
262
|
+
if (selectedParts === false) {
|
|
263
|
+
return [];
|
|
264
|
+
}
|
|
265
|
+
return selectedParts;
|
|
266
|
+
}
|
|
230
267
|
/**
|
|
231
268
|
* Generates all needed files out of the dde declaration
|
|
232
269
|
* @param cwd
|
|
@@ -289,7 +326,9 @@ async function buildAndValidatePart(logger, part, buildFn, mergedDiagnostics, cw
|
|
|
289
326
|
}
|
|
290
327
|
function logDiagnostics(logger, diagnostics) {
|
|
291
328
|
diagnostics.forEach(diagnostic => {
|
|
292
|
-
|
|
329
|
+
// diagnostic.line and startCharacter are zero based. Therefor we need to increment with 1.
|
|
330
|
+
const startChar = diagnostic.startCharacter ? `:${diagnostic.startCharacter + 1}` : '';
|
|
331
|
+
const message = `${diagnostic.file.path}:${diagnostic.line + 1}${startChar} - ${diagnostic.message}`;
|
|
293
332
|
if (diagnostic.level === 'error') {
|
|
294
333
|
logger.error(message);
|
|
295
334
|
}
|
package/out/scriptRunner.js
CHANGED
|
@@ -94,7 +94,9 @@ async function execShell(cwd, cmd, logger) {
|
|
|
94
94
|
// todo use spawn instead of exec to allow streaming to the console
|
|
95
95
|
child_process.exec(cmd, { cwd: cwd.fsPath, env: process.env }, (error, stdout, stderr) => {
|
|
96
96
|
logger.log(stdout);
|
|
97
|
-
|
|
97
|
+
if (stderr) {
|
|
98
|
+
logger.error(stderr);
|
|
99
|
+
}
|
|
98
100
|
if (error) {
|
|
99
101
|
reject(error);
|
|
100
102
|
}
|