@microtronics/studio-cli 0.5.1 → 0.6.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 +14 -0
- package/dist/studio-cli.d.ts +24 -0
- package/out/dde/dde.d.ts.map +1 -1
- package/out/dde/dde.js +40 -4
- package/out/dde/fileGenerators/dlo.d.ts.map +1 -1
- package/out/dde/fileGenerators/dlo.js +55 -0
- package/out/dependencies.d.ts.map +1 -1
- package/out/dependencies.js +36 -0
- package/out/main.js +16 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
## 0.6.1 (2024-12-12)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **studio-cli:** prevent `default.inc` to be removed due to race condition ([fbf3fcf](https://bitbucket.org/microtronics-core/vscode-studio/commits/fbf3fcfa2ef0af6ec2359aa99ccb90768d7a25ec))
|
|
9
|
+
|
|
10
|
+
## 0.6.0 (2024-12-11)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **studio-cli:** moved generation of `default.inc` to the cli ([e78ce9e](https://bitbucket.org/microtronics-core/vscode-studio/commits/e78ce9ed8dc6fd73a74a25ad8c89c3a2013ca32d))
|
|
16
|
+
|
|
3
17
|
## 0.5.1 (2024-12-11)
|
|
4
18
|
|
|
5
19
|
|
package/dist/studio-cli.d.ts
CHANGED
|
@@ -1037,6 +1037,13 @@ export declare namespace DDE {
|
|
|
1037
1037
|
* @param ddeJSON
|
|
1038
1038
|
*/
|
|
1039
1039
|
export function exportHistoryJson(cwd: URI, fs: LocalFS, ddeJSON: DDEJson): Promise<void>;
|
|
1040
|
+
/**
|
|
1041
|
+
* Clean up the .studio/auto/dlo directory
|
|
1042
|
+
* @param cwd
|
|
1043
|
+
* @param fs
|
|
1044
|
+
* @internal
|
|
1045
|
+
*/
|
|
1046
|
+
export function clearAutoDloDir(cwd: URI, fs: LocalFS): Promise<any>;
|
|
1040
1047
|
/**
|
|
1041
1048
|
* Generate all dde related dlo files
|
|
1042
1049
|
* @param cwd
|
|
@@ -1051,6 +1058,13 @@ export declare namespace DDE {
|
|
|
1051
1058
|
* @param ddeMap
|
|
1052
1059
|
*/
|
|
1053
1060
|
export function exportOpenApi(cwd: URI, fs: LocalFS, ddeMap: DDEJson): Promise<void>;
|
|
1061
|
+
/**
|
|
1062
|
+
* Generate and export the default.inc file
|
|
1063
|
+
* @param cwd
|
|
1064
|
+
* @param fs
|
|
1065
|
+
* @internal
|
|
1066
|
+
*/
|
|
1067
|
+
export function exportDefaultInc(cwd: URI, fs: LocalFS): Promise<void>;
|
|
1054
1068
|
}
|
|
1055
1069
|
|
|
1056
1070
|
export declare namespace DDE_Core {
|
|
@@ -1474,6 +1488,16 @@ export declare namespace Dependencies {
|
|
|
1474
1488
|
* @param libraryName
|
|
1475
1489
|
*/
|
|
1476
1490
|
export function uninstallDependency(cwd: URI, fs: LocalFS, publisherId: string, libraryName: string): Promise<void>;
|
|
1491
|
+
export interface DLOLibrary {
|
|
1492
|
+
name: string;
|
|
1493
|
+
path: URI;
|
|
1494
|
+
}
|
|
1495
|
+
/**
|
|
1496
|
+
* Get all libraries that have dlo source
|
|
1497
|
+
* @param cwd
|
|
1498
|
+
* @param fs
|
|
1499
|
+
*/
|
|
1500
|
+
export function getDloDependencies(cwd: URI, fs: LocalFS): Promise<DLOLibrary[]>;
|
|
1477
1501
|
}
|
|
1478
1502
|
|
|
1479
1503
|
export declare const DeviceProfiles: any;
|
package/out/dde/dde.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dde.d.ts","sourceRoot":"","sources":["../../src/dde/dde.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAS,MAAM,YAAY,CAAC;AACxC,OAAO,EAAuB,OAAO,EAA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EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,iBAK/E;IAED;;;;OAIG;IACH,SAAsB,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,gBAUzD;IAED;;;;;OAKG;IACH,SAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,MAclG;IAED;;;;;OAKG;IACH,SAAsB,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,iBAO9E;IAED;;;;;OAKG;IACH,SAAsB,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,gBAE1D;IACD;;;;;OAKG;IACH,SAAsB,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,iBA6C/E;IAED;;;;;OAKG;IACH,SAAsB,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,iBAqBzE;IAED;;;;;OAKG;IACH,SAAsB,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,iBAK3D;CACD"}
|
package/out/dde/dde.js
CHANGED
|
@@ -213,6 +213,16 @@ var DDE;
|
|
|
213
213
|
console.log('Generated', defaultFiles_1.DefaultFiles.filePaths.dist.historyJson);
|
|
214
214
|
}
|
|
215
215
|
DDE.exportHistoryJson = exportHistoryJson;
|
|
216
|
+
/**
|
|
217
|
+
* Clean up the .studio/auto/dlo directory
|
|
218
|
+
* @param cwd
|
|
219
|
+
* @param fs
|
|
220
|
+
* @internal
|
|
221
|
+
*/
|
|
222
|
+
async function clearAutoDloDir(cwd, fs) {
|
|
223
|
+
return fs.rm(vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.studio.auto.dlo.path));
|
|
224
|
+
}
|
|
225
|
+
DDE.clearAutoDloDir = clearAutoDloDir;
|
|
216
226
|
/**
|
|
217
227
|
* Generate all dde related dlo files
|
|
218
228
|
* @param cwd
|
|
@@ -220,6 +230,7 @@ var DDE;
|
|
|
220
230
|
* @param ddeJSON
|
|
221
231
|
*/
|
|
222
232
|
async function exportAutoDloFiles(cwd, fs, ddeJSON) {
|
|
233
|
+
await clearAutoDloDir(cwd, fs);
|
|
223
234
|
const manifest = await manifest_1.Manifest.read(cwd, fs);
|
|
224
235
|
const dependencies = await getDependencies(cwd, fs, manifest);
|
|
225
236
|
const globalDefines = await globals_1.Globals.read(cwd, fs);
|
|
@@ -233,8 +244,10 @@ var DDE;
|
|
|
233
244
|
const libraryInc = [...globals, ...helper].join('\r\n');
|
|
234
245
|
const autoIncName = defaultFiles_1.DefaultFiles.filePaths.studio.auto.dlo.autoDdeInc.replace('X', dependency.libraryName);
|
|
235
246
|
const incPath = vscode_uri_1.Utils.joinPath(cwd, autoIncName);
|
|
236
|
-
|
|
237
|
-
|
|
247
|
+
if (libraryInc.length) {
|
|
248
|
+
console.log(`Generated`, autoIncName);
|
|
249
|
+
await fs.writeFile(incPath, libraryInc);
|
|
250
|
+
}
|
|
238
251
|
}
|
|
239
252
|
const mainDDEInc = (0, dlo_1.generateMainDDEIncFromMap)(ddeJSON);
|
|
240
253
|
const autoUplink = (0, dlo_1.generateAutoUplinkIncFromMap)(ddeJSON, dependencies.map(dep => dep.libraryName));
|
|
@@ -250,6 +263,7 @@ var DDE;
|
|
|
250
263
|
const autoDdeMainPath = vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.studio.auto.dlo.autoDdeInc.replace('X', 'main'));
|
|
251
264
|
await fs.writeFile(autoDdeMainPath, mainDDEInc);
|
|
252
265
|
console.log('Generated', defaultFiles_1.DefaultFiles.filePaths.studio.auto.dlo.autoDdeInc.replace('X', 'main'));
|
|
266
|
+
await exportDefaultInc(cwd, fs);
|
|
253
267
|
}
|
|
254
268
|
DDE.exportAutoDloFiles = exportAutoDloFiles;
|
|
255
269
|
/**
|
|
@@ -270,12 +284,34 @@ var DDE;
|
|
|
270
284
|
// generate the api description for the library part of the project
|
|
271
285
|
if (isLibrary) {
|
|
272
286
|
const libPath = vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.dist.ddeApiPath, `${manifest.name}.yaml`);
|
|
273
|
-
|
|
274
|
-
|
|
287
|
+
const content = (0, api_1.generateAPIFromMap)(ddeMap, manifest, manifest.name);
|
|
288
|
+
if (content.length) {
|
|
289
|
+
await fs.writeFile(libPath, content);
|
|
290
|
+
console.log(`Generated`, defaultFiles_1.DefaultFiles.filePaths.dist.ddeApiPath + `${manifest.name}.yaml`);
|
|
291
|
+
}
|
|
275
292
|
}
|
|
276
293
|
}
|
|
277
294
|
DDE.exportOpenApi = exportOpenApi;
|
|
295
|
+
/**
|
|
296
|
+
* Generate and export the default.inc file
|
|
297
|
+
* @param cwd
|
|
298
|
+
* @param fs
|
|
299
|
+
* @internal
|
|
300
|
+
*/
|
|
301
|
+
async function exportDefaultInc(cwd, fs) {
|
|
302
|
+
const defaultIncPaht = vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.studio.auto.dlo.defaultInc);
|
|
303
|
+
const content = await (0, dlo_1.buildDefaultInc)(cwd, fs);
|
|
304
|
+
await fs.writeFile(defaultIncPaht, content);
|
|
305
|
+
console.log('Generated', defaultFiles_1.DefaultFiles.filePaths.studio.auto.dlo.defaultInc);
|
|
306
|
+
}
|
|
307
|
+
DDE.exportDefaultInc = exportDefaultInc;
|
|
278
308
|
})(DDE || (exports.DDE = DDE = {}));
|
|
309
|
+
/**
|
|
310
|
+
* Get dde files from any included library
|
|
311
|
+
* @param cwd
|
|
312
|
+
* @param fs
|
|
313
|
+
* @param manifest
|
|
314
|
+
*/
|
|
279
315
|
async function getDependencies(cwd, fs, manifest) {
|
|
280
316
|
const ddeFiles = [];
|
|
281
317
|
const allDependencies = await dependencies_1.Dependencies.getAll(manifest);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dlo.d.ts","sourceRoot":"","sources":["../../../src/dde/fileGenerators/dlo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C,OAAO,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;AAUlC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"dlo.d.ts","sourceRoot":"","sources":["../../../src/dde/fileGenerators/dlo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C,OAAO,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;AAUlC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,GAAG,EAAS,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAuBnC,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,UA+LlH;AAED,qBAAa,gBAAgB;IAWhB,OAAO,CAAC,MAAM;IAAW,OAAO,CAAC,OAAO;IAVpD,OAAO,CAAC,eAAe,CAAgB;IACvC,OAAO,CAAC,gBAAgB,CAAgB;IACxC,OAAO,CAAC,gBAAgB,CAAgB;IACxC,OAAO,CAAC,gBAAgB,CAAgB;IACxC,OAAO,CAAC,eAAe,CAAgB;IACvC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,oBAAoB,CAAgB;IAC5C,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,UAAU,CAA+F;gBAC7F,MAAM,EAAE,OAAO,EAAU,OAAO,EAAE,IAAI,GAAG,MAAM;IAGnE,OAAO,CAAC,IAAI;IAiBL,QAAQ;;;;IAoCf,OAAO,CAAC,eAAe;IAsBvB,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,gBAAgB;IAwBxB,OAAO,CAAC,8BAA8B;IAoEtC,OAAO,CAAC,uBAAuB;IAY/B,OAAO,CAAC,yBAAyB;IAgBjC,OAAO,CAAC,uBAAuB;IA8D/B,OAAO,CAAC,6BAA6B;IASrC,OAAO,CAAC,2BAA2B;IAmBnC;;;;;;OAMG;IACH,OAAO,CAAC,SAAS;IAcjB,OAAO,CAAC,0BAA0B;IA8BlC,OAAO,CAAC,mBAAmB;IAiD3B;;;;;;OAMG;IACH,OAAO,CAAC,4BAA4B;IAIpC,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,sBAAsB;IAmC9B,OAAO,CAAC,iBAAiB;IAoDzB;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;CA6B7B;AAGD,wBAAgB,4BAA4B,CAC3C,MAAM,EAAE,OAAO;AACf;;GAEG;AACH,gBAAgB,EAAE,MAAM,EAAE,UAsI1B;AAID,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,OAAO,UAqExD;AAqBD;;GAEG;AAEH;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,mBAmB1D"}
|
|
@@ -27,6 +27,7 @@ exports.AutoDDEGenerator = void 0;
|
|
|
27
27
|
exports.generateAutoIncFromMap = generateAutoIncFromMap;
|
|
28
28
|
exports.generateAutoUplinkIncFromMap = generateAutoUplinkIncFromMap;
|
|
29
29
|
exports.generateMainDDEIncFromMap = generateMainDDEIncFromMap;
|
|
30
|
+
exports.buildDefaultInc = buildDefaultInc;
|
|
30
31
|
const semver = __importStar(require("semver"));
|
|
31
32
|
const coreDefinitions_1 = require("../coreDefinitions");
|
|
32
33
|
const DeviceProfiles_1 = require("../../DeviceProfiles");
|
|
@@ -38,6 +39,9 @@ var CONFIG_CONTAINER = coreDefinitions_1.DDE_Core.CONFIG_CONTAINER;
|
|
|
38
39
|
var CONTAINER_DEF_DLO_CID_BASE = coreDefinitions_1.DDE_Core.CONTAINER_DEF_DLO_CID_BASE;
|
|
39
40
|
var CONTAINER_DEFS = coreDefinitions_1.DDE_Core.CONTAINER_DEFS;
|
|
40
41
|
var fieldTypeDefinitions = coreDefinitions_1.DDE_Core.fieldTypeDefinitions;
|
|
42
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
43
|
+
const defaultFiles_1 = require("../../defaultFiles");
|
|
44
|
+
const dependencies_1 = require("../../dependencies");
|
|
41
45
|
/** get effective field type for pawn access (may be overriden or skipped using attribute dlorw=...)
|
|
42
46
|
* @return {*} | 'skip' | null - null=error occured
|
|
43
47
|
*/
|
|
@@ -880,4 +884,55 @@ function generateMainDDEFunctionBody(pawnSource, containerDefinition, readWrite)
|
|
|
880
884
|
pawnSource(`\t#endif`);
|
|
881
885
|
}
|
|
882
886
|
}
|
|
887
|
+
/**
|
|
888
|
+
* Default INC handling
|
|
889
|
+
*/
|
|
890
|
+
/**
|
|
891
|
+
* Generate the default.inc file
|
|
892
|
+
* @param cwd
|
|
893
|
+
* @param fs
|
|
894
|
+
* @param dependencies
|
|
895
|
+
*/
|
|
896
|
+
async function buildDefaultInc(cwd, fs) {
|
|
897
|
+
const fileContent = [];
|
|
898
|
+
const dloLibs = await dependencies_1.Dependencies.getDloDependencies(cwd, fs);
|
|
899
|
+
await addInclude(cwd, fs, fileContent, defaultFiles_1.DefaultFiles.fileNames.autoInc);
|
|
900
|
+
const autoDdeIncs = await getAutoDDEIncludes(cwd, fs, dloLibs);
|
|
901
|
+
for (const dloLib of dloLibs) {
|
|
902
|
+
// todo use relative path as include?
|
|
903
|
+
fileContent.push(`#include <${dloLib.name}>`);
|
|
904
|
+
if (dloLib.name === 'dlo-core') {
|
|
905
|
+
fileContent.push(...autoDdeIncs);
|
|
906
|
+
await addInclude(cwd, fs, fileContent, defaultFiles_1.DefaultFiles.fileNames.autoDdeInc.replace('X', 'app'));
|
|
907
|
+
await addInclude(cwd, fs, fileContent, defaultFiles_1.DefaultFiles.fileNames.autoDdeInc.replace('X', 'main'));
|
|
908
|
+
await addInclude(cwd, fs, fileContent, defaultFiles_1.DefaultFiles.fileNames.autoUplinkInc);
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
return fileContent.join('\n');
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Get all <library-name>-dde.inc files
|
|
915
|
+
* @param cwd
|
|
916
|
+
* @param fs
|
|
917
|
+
* @param dependencies
|
|
918
|
+
*/
|
|
919
|
+
async function getAutoDDEIncludes(cwd, fs, dependencies) {
|
|
920
|
+
const includes = [];
|
|
921
|
+
for (const dependency of dependencies) {
|
|
922
|
+
const includePath = defaultFiles_1.DefaultFiles.filePaths.studio.auto.dlo.autoDdeInc.replace('X', dependency.name);
|
|
923
|
+
if (await fs.stat(vscode_uri_1.Utils.joinPath(cwd, includePath))) {
|
|
924
|
+
includes.push(`#include "${defaultFiles_1.DefaultFiles.fileNames.autoDdeInc.replace('X', dependency.name)}"`);
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
return includes;
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* Validate if the given file exist within the .studio/auto/dlo directory
|
|
931
|
+
*/
|
|
932
|
+
async function addInclude(cwd, fs, fileContent, fileName) {
|
|
933
|
+
const basePath = vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.studio.auto.dlo.path, fileName);
|
|
934
|
+
if (await fs.stat(basePath)) {
|
|
935
|
+
fileContent.push(`#include "${fileName}"`);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
883
938
|
//# sourceMappingURL=dlo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../src/dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAS,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../src/dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAS,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAOhC,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAE/C,yBAAiB,YAAY,CAAC;IAG7B;;;;;OAKG;IACH,SAAsB,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,UAAU,UAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAQ5G;IAED;;;;OAIG;IACH,SAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAE/D;IAED;;;;;OAKG;IACH,SAAgB,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,GAAG,GAAG,CAGpE;IAED;;;;OAIG;IACH,SAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,UAM7C;IAED;;;;;;OAMG;IACH,SAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,MAAM,QAKvF;IAED;;;;;;OAMG;IACH,SAAsB,sBAAsB,CAC3C,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,OAAO,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ode_uri_1 = require("vscode-uri");
|
|
|
28
28
|
const manifest_1 = require("./manifest");
|
|
29
29
|
const semver = __importStar(require("semver"));
|
|
30
30
|
const registryAPI_1 = require("./registryAPI");
|
|
31
|
+
const defaultFiles_1 = require("./defaultFiles");
|
|
31
32
|
const tinytar = require('tinytar-fix');
|
|
32
33
|
const pako = require('pako');
|
|
33
34
|
exports.LIB_DEPS_PATH = '.studio/libdeps';
|
|
34
35
|
var Dependencies;
|
|
35
36
|
(function (Dependencies) {
|
|
37
|
+
var isLibraryProject = manifest_1.Manifest.isLibraryProject;
|
|
36
38
|
/**
|
|
37
39
|
* Just combine all dependencies in one object
|
|
38
40
|
* Optional devDependencies can be excluded
|
|
@@ -294,6 +296,40 @@ var Dependencies;
|
|
|
294
296
|
}
|
|
295
297
|
}
|
|
296
298
|
Dependencies.uninstallDependency = uninstallDependency;
|
|
299
|
+
/**
|
|
300
|
+
* Get all libraries that have dlo source
|
|
301
|
+
* @param cwd
|
|
302
|
+
* @param fs
|
|
303
|
+
*/
|
|
304
|
+
async function getDloDependencies(cwd, fs) {
|
|
305
|
+
const manifest = await manifest_1.Manifest.read(cwd, fs);
|
|
306
|
+
const allDependencies = await getAll(manifest);
|
|
307
|
+
const dloDependencies = [];
|
|
308
|
+
for (const dependencyId in allDependencies) {
|
|
309
|
+
const depPath = Dependencies.dependencyToPath(cwd, dependencyId);
|
|
310
|
+
const name = Dependencies.dependencyIdToName(dependencyId);
|
|
311
|
+
const incPath = vscode_uri_1.Utils.joinPath(depPath, defaultFiles_1.DefaultFiles.filePaths.dlo.path, `${name}.inc`);
|
|
312
|
+
const exists = await fs.stat(incPath);
|
|
313
|
+
if (exists) {
|
|
314
|
+
dloDependencies.push({
|
|
315
|
+
name,
|
|
316
|
+
path: incPath
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
// add current project file if it is a library project
|
|
321
|
+
if (isLibraryProject(manifest)) {
|
|
322
|
+
const incPath = vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.dlo.path, `${manifest.name}.inc`);
|
|
323
|
+
if (await fs.stat(incPath)) {
|
|
324
|
+
dloDependencies.push({
|
|
325
|
+
name: manifest.name,
|
|
326
|
+
path: incPath
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return dloDependencies;
|
|
331
|
+
}
|
|
332
|
+
Dependencies.getDloDependencies = getDloDependencies;
|
|
297
333
|
})(Dependencies || (exports.Dependencies = Dependencies = {}));
|
|
298
334
|
async function fetchStudioJson(token, studioJsonURL) {
|
|
299
335
|
return await registryAPI_1.Registry.fetchLibraryContent(token, studioJsonURL, true);
|
package/out/main.js
CHANGED
|
@@ -57,12 +57,26 @@ program
|
|
|
57
57
|
.action(async (apmPart) => {
|
|
58
58
|
if (apmPart === 'dde') {
|
|
59
59
|
const result = await dde_1.DDE.compileDDE(cwd, cliFS_1.cliFS);
|
|
60
|
-
|
|
60
|
+
result.diagnostics.forEach(diagnostic => {
|
|
61
|
+
const message = `${diagnostic.file.path}: ${diagnostic.message}`;
|
|
62
|
+
if (diagnostic.level === 'error') {
|
|
63
|
+
console.error(message);
|
|
64
|
+
}
|
|
65
|
+
else if (diagnostic.level === 'warning') {
|
|
66
|
+
console.warn(message);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
console.log(message);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
61
72
|
if (result.ddeJSON) {
|
|
62
73
|
await dde_1.DDE.exportMyDatanetXML(cwd, cliFS_1.cliFS, result.ddeJSON);
|
|
63
74
|
await dde_1.DDE.exportHistoryJson(cwd, cliFS_1.cliFS, result.ddeJSON);
|
|
64
|
-
await dde_1.DDE.exportAutoDloFiles(cwd, cliFS_1.cliFS, result.ddeJSON);
|
|
65
75
|
await dde_1.DDE.exportOpenApi(cwd, cliFS_1.cliFS, result.ddeJSON);
|
|
76
|
+
await dde_1.DDE.exportAutoDloFiles(cwd, cliFS_1.cliFS, result.ddeJSON);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
console.error('Project has errors!');
|
|
66
80
|
}
|
|
67
81
|
}
|
|
68
82
|
});
|