@microtronics/studio-cli 0.12.2 → 0.13.0
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 +18 -0
- package/dist/studio-cli.d.ts +68 -22
- package/out/api.js +3 -1
- package/out/cliFS.js +10 -0
- package/out/dde/fileGenerators/dlo.js +2 -1
- package/out/dependencies.js +13 -8
- package/out/dfiles/dfiles.js +188 -0
- package/out/dlo/compiler.js +2 -1
- package/out/main.js +1 -1
- package/out/manifest.js +82 -56
- package/out/package/apm.js +3 -3
- package/out/package/package.js +24 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
## 0.13.0 (2025-01-29)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **studio-cli:** add `FS.copy` as filesystem function ([59c252c](https://bitbucket.org/microtronics-core/vscode-studio/commits/59c252cb2afd223a43376a2b220c20bd2d7c1761))
|
|
9
|
+
* **studio-cli:** allow processing dfiles from the cli ([6162326](https://bitbucket.org/microtronics-core/vscode-studio/commits/6162326b30412a05cb62ebd40a272e644bd0d970))
|
|
10
|
+
* **studio-cli:** generate error message if the dfile sync_mode is invalid ([87ae69b](https://bitbucket.org/microtronics-core/vscode-studio/commits/87ae69b4bcf3a928892335dadba7e49668b1a6e1))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **studio-cli:** cliFS interface did not create target path during copy ([641886d](https://bitbucket.org/microtronics-core/vscode-studio/commits/641886d776e2fe158314effc00760b12cca514bd))
|
|
16
|
+
* **studio-cli:** copy dfiles from libraries ([e746dcd](https://bitbucket.org/microtronics-core/vscode-studio/commits/e746dcd31a8095226ef22434b5612536c987a595))
|
|
17
|
+
* **studio-cli:** invalidate manifest cache if file path changes (only needed for tests) ([db30907](https://bitbucket.org/microtronics-core/vscode-studio/commits/db309072028d59ece85167a03f3a77b9a1575f59))
|
|
18
|
+
* **studio-cli:** invalidate manifest cache if filesize doesn't match ([daeb437](https://bitbucket.org/microtronics-core/vscode-studio/commits/daeb4371696de9e13608cbe6f3bab1ae1c01da24))
|
|
19
|
+
* **studio-cli:** invalidate manifest cache if filesize doesn't match ([30947ab](https://bitbucket.org/microtronics-core/vscode-studio/commits/30947ab55152ceb5c269dda695cd3f262cae82b9))
|
|
20
|
+
|
|
3
21
|
## 0.12.2 (2025-01-27)
|
|
4
22
|
|
|
5
23
|
|
package/dist/studio-cli.d.ts
CHANGED
|
@@ -17,7 +17,8 @@ export declare namespace APM {
|
|
|
17
17
|
dde = "dde",
|
|
18
18
|
dlo = "dlo",
|
|
19
19
|
pov = "pov",
|
|
20
|
-
blo = "blo"
|
|
20
|
+
blo = "blo",
|
|
21
|
+
dfiles = "dfiles"
|
|
21
22
|
}
|
|
22
23
|
export interface TagHeader extends ApplicationTagInformation {
|
|
23
24
|
author: string;
|
|
@@ -1612,7 +1613,7 @@ export declare namespace Dependencies {
|
|
|
1612
1613
|
* @param libraryName
|
|
1613
1614
|
*/
|
|
1614
1615
|
export function uninstallDependency(cwd: URI, fs: LocalFS, publisherId: string, libraryName: string): Promise<void>;
|
|
1615
|
-
export interface
|
|
1616
|
+
export interface APMPartLibrary {
|
|
1616
1617
|
name: string;
|
|
1617
1618
|
path: URI;
|
|
1618
1619
|
}
|
|
@@ -1620,12 +1621,56 @@ export declare namespace Dependencies {
|
|
|
1620
1621
|
* Get all libraries that have dlo source
|
|
1621
1622
|
* @param cwd
|
|
1622
1623
|
* @param fs
|
|
1624
|
+
* @param apmPart currently only dlo and dfiles are supported
|
|
1623
1625
|
*/
|
|
1624
|
-
export function
|
|
1626
|
+
export function getApmPartDependencies(cwd: URI, fs: LocalFS, apmPart: APM.Part.dlo | APM.Part.dfiles): Promise<APMPartLibrary[]>;
|
|
1625
1627
|
}
|
|
1626
1628
|
|
|
1627
1629
|
export declare const DeviceProfiles: any;
|
|
1628
1630
|
|
|
1631
|
+
export declare namespace DFILES {
|
|
1632
|
+
export enum Type {
|
|
1633
|
+
static = "static",
|
|
1634
|
+
dynamic = "dynamic"
|
|
1635
|
+
}
|
|
1636
|
+
export enum SyncLogic {
|
|
1637
|
+
crcStamp = "crc_stamp",
|
|
1638
|
+
stampOnly = "stamp_only",
|
|
1639
|
+
onlyDown = "only_down",
|
|
1640
|
+
onlyUp = "only_up"
|
|
1641
|
+
}
|
|
1642
|
+
export enum Force {
|
|
1643
|
+
down = "down",
|
|
1644
|
+
up = "up",
|
|
1645
|
+
off = "off"
|
|
1646
|
+
}
|
|
1647
|
+
export interface Property {
|
|
1648
|
+
type: Type;
|
|
1649
|
+
size: number;
|
|
1650
|
+
sync_logic: SyncLogic;
|
|
1651
|
+
force: Force;
|
|
1652
|
+
readable: boolean;
|
|
1653
|
+
crc: string;
|
|
1654
|
+
stamp: number;
|
|
1655
|
+
library: string | null;
|
|
1656
|
+
}
|
|
1657
|
+
export interface PropertyList {
|
|
1658
|
+
[key: string]: Property;
|
|
1659
|
+
}
|
|
1660
|
+
export function process(cwd: URI, fs: LocalFS): Promise<Diagnostics.File[]>;
|
|
1661
|
+
/**
|
|
1662
|
+
*
|
|
1663
|
+
* @param fs
|
|
1664
|
+
* @param fileUri
|
|
1665
|
+
* @param libraryName
|
|
1666
|
+
* @private
|
|
1667
|
+
*/
|
|
1668
|
+
export function parseYamlFile(fs: LocalFS, fileUri: URI, libraryName: string | null): Promise<{
|
|
1669
|
+
properties: DFILES.PropertyList;
|
|
1670
|
+
diagnostics: Diagnostics.File[];
|
|
1671
|
+
}>;
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1629
1674
|
export declare namespace Diagnostics {
|
|
1630
1675
|
const CODE: {
|
|
1631
1676
|
ddeFieldLength: string;
|
|
@@ -1963,6 +2008,14 @@ declare interface LocalFS {
|
|
|
1963
2008
|
* {@link workspace.workspaceFolders workspace folders} are opened.
|
|
1964
2009
|
*/
|
|
1965
2010
|
findFiles: (cwd: URI, include: GlobPattern, exclude?: GlobPattern) => Promise<URI[]>;
|
|
2011
|
+
/**
|
|
2012
|
+
* Copy files or folders.
|
|
2013
|
+
* Overwrites existing file
|
|
2014
|
+
*
|
|
2015
|
+
* @param source The existing file.
|
|
2016
|
+
* @param target The destination location.
|
|
2017
|
+
*/
|
|
2018
|
+
copy: (source: URI, target: URI) => Promise<any>;
|
|
1966
2019
|
}
|
|
1967
2020
|
|
|
1968
2021
|
export declare namespace Manifest {
|
|
@@ -1983,10 +2036,6 @@ export declare namespace Manifest {
|
|
|
1983
2036
|
library?: boolean;
|
|
1984
2037
|
libraryDependencies?: Dependencies;
|
|
1985
2038
|
libraryDevDependencies?: Dependencies;
|
|
1986
|
-
/**
|
|
1987
|
-
* @deprecated replaced with libraryDependencies
|
|
1988
|
-
*/
|
|
1989
|
-
libdeps?: string[];
|
|
1990
2039
|
dlo?: {
|
|
1991
2040
|
mainFile: string;
|
|
1992
2041
|
compileOptions: string[];
|
|
@@ -1994,12 +2043,7 @@ export declare namespace Manifest {
|
|
|
1994
2043
|
registry?: {
|
|
1995
2044
|
id?: string;
|
|
1996
2045
|
allowedBackends?: null | '*' | string[];
|
|
1997
|
-
target?: 'myDatanet' | 'ONE' | 'MT360';
|
|
1998
2046
|
};
|
|
1999
|
-
/**
|
|
2000
|
-
* @deprecated moved to registry
|
|
2001
|
-
*/
|
|
2002
|
-
target?: 'myDatanet' | 'ONE' | 'MT360';
|
|
2003
2047
|
pov?: {
|
|
2004
2048
|
details?: ApmPartScripts;
|
|
2005
2049
|
};
|
|
@@ -2052,15 +2096,16 @@ export declare namespace Manifest {
|
|
|
2052
2096
|
* @param fs
|
|
2053
2097
|
* @param manifest
|
|
2054
2098
|
* @param env
|
|
2055
|
-
* @param publish - validate publish related options
|
|
2056
2099
|
*/
|
|
2057
|
-
export function
|
|
2058
|
-
export function validateLibraryName(libraryName: string):
|
|
2059
|
-
export function validateProjectName(name: string, isLibrary?: boolean):
|
|
2060
|
-
export function validateDescription(description: string):
|
|
2061
|
-
export function validatePublisherId(publisher: string):
|
|
2062
|
-
export function validatePublisherOnline(token: Registry.AuthToken, publisher: string): Promise<string |
|
|
2063
|
-
export function validateRegistryAllowedBackends(allowedBackends: undefined | null | string | string[]): Promise<string |
|
|
2100
|
+
export function validateBasicManifest(cwd: URI, fs: LocalFS, manifest: Manifest.Manifest | null, env?: Globals.ENV): Promise<void>;
|
|
2101
|
+
export function validateLibraryName(libraryName: string): "Library name can only contain 'a' through 'z', '0' through '9', '_' and '-'. The Library name must start with an alphabetic or numeric character." | "The library name is beyond permissible length of 20 characters." | null;
|
|
2102
|
+
export function validateProjectName(name: string, isLibrary?: boolean): "Library name can only contain 'a' through 'z', '0' through '9', '_' and '-'. The Library name must start with an alphabetic or numeric character." | "The library name is beyond permissible length of 20 characters." | "Project name can only contain 'A' through 'Z', 'a' through 'z', '0' through '9', ' ', '_' and '-'. The Project name must start with an alphabetic or numeric character." | "The project name is beyond permissible length of 40 characters." | null;
|
|
2103
|
+
export function validateDescription(description: string): "The description must have at least 5 characters." | null;
|
|
2104
|
+
export function validatePublisherId(publisher: string): "No publisher set yet" | "Publisher can only contain 'A' through 'Z', 'a' through 'z', '0' through '9' and '-'. The Publisher start with an alphabetic or numeric character." | null;
|
|
2105
|
+
export function validatePublisherOnline(token: Registry.AuthToken, publisher: string): Promise<string | null>;
|
|
2106
|
+
export function validateRegistryAllowedBackends(allowedBackends: undefined | null | string | string[]): Promise<string | null>;
|
|
2107
|
+
export function validateApplicationIcon(cwd: URI, fs: LocalFS, manifest: Manifest.Manifest): Promise<void>;
|
|
2108
|
+
export function validateEngineSettings(manifest: Manifest.Manifest): void;
|
|
2064
2109
|
}
|
|
2065
2110
|
|
|
2066
2111
|
export declare namespace Package {
|
|
@@ -2114,10 +2159,11 @@ export declare namespace Package {
|
|
|
2114
2159
|
export function getChangelogFile(cwd: URI, fs: LocalFS): Promise<Uint8Array>;
|
|
2115
2160
|
/**
|
|
2116
2161
|
* Validate manifest settings that are required for the APM
|
|
2162
|
+
* @param cwd
|
|
2163
|
+
* @param fs
|
|
2117
2164
|
* @param token
|
|
2118
|
-
* @param manifest
|
|
2119
2165
|
*/
|
|
2120
|
-
export function
|
|
2166
|
+
export function validatePublishSettings(cwd: URI, fs: LocalFS, token: Registry.AuthToken): Promise<void>;
|
|
2121
2167
|
}
|
|
2122
2168
|
|
|
2123
2169
|
/**
|
package/out/api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Library = exports.APM = exports.Package = exports.DLO = exports.Globals = exports.DeviceProfiles = exports.DefaultFiles = exports.Diagnostics = exports.Helper = exports.DDE = exports.DDE_Core = exports.Registry = exports.Manifest = exports.Dependencies = void 0;
|
|
3
|
+
exports.DFILES = exports.Library = exports.APM = exports.Package = exports.DLO = exports.Globals = exports.DeviceProfiles = exports.DefaultFiles = exports.Diagnostics = exports.Helper = exports.DDE = exports.DDE_Core = exports.Registry = exports.Manifest = exports.Dependencies = void 0;
|
|
4
4
|
const dependencies_1 = require("./dependencies");
|
|
5
5
|
Object.defineProperty(exports, "Dependencies", { enumerable: true, get: function () { return dependencies_1.Dependencies; } });
|
|
6
6
|
const manifest_1 = require("./manifest");
|
|
@@ -29,4 +29,6 @@ const apm_1 = require("./package/apm");
|
|
|
29
29
|
Object.defineProperty(exports, "APM", { enumerable: true, get: function () { return apm_1.APM; } });
|
|
30
30
|
const library_1 = require("./package/library");
|
|
31
31
|
Object.defineProperty(exports, "Library", { enumerable: true, get: function () { return library_1.Library; } });
|
|
32
|
+
const dfiles_1 = require("./dfiles/dfiles");
|
|
33
|
+
Object.defineProperty(exports, "DFILES", { enumerable: true, get: function () { return dfiles_1.DFILES; } });
|
|
32
34
|
//# sourceMappingURL=api.js.map
|
package/out/cliFS.js
CHANGED
|
@@ -56,6 +56,16 @@ exports.cliFS = {
|
|
|
56
56
|
const posix = file.replace(/\\/g, '/');
|
|
57
57
|
return vscode_uri_1.URI.parse(`file:///${posix}`);
|
|
58
58
|
});
|
|
59
|
+
},
|
|
60
|
+
async copy(source, target) {
|
|
61
|
+
const stat = await promises_1.default.stat(source.fsPath);
|
|
62
|
+
await promises_1.default.mkdir(vscode_uri_1.Utils.dirname(target).fsPath, { recursive: true });
|
|
63
|
+
if (stat.isDirectory()) {
|
|
64
|
+
return promises_1.default.cp(source.fsPath, target.fsPath, { force: true, recursive: true });
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
return promises_1.default.copyFile(source.fsPath, target.fsPath);
|
|
68
|
+
}
|
|
59
69
|
}
|
|
60
70
|
};
|
|
61
71
|
//# sourceMappingURL=cliFS.js.map
|
|
@@ -44,6 +44,7 @@ const vscode_uri_1 = require("vscode-uri");
|
|
|
44
44
|
const defaultFiles_1 = require("../../defaultFiles");
|
|
45
45
|
const dependencies_1 = require("../../dependencies");
|
|
46
46
|
var isNumeric = helper_1.Helper.isNumeric;
|
|
47
|
+
const apm_1 = require("../../package/apm");
|
|
47
48
|
/** get effective field type for pawn access (may be overriden or skipped using attribute dlorw=...)
|
|
48
49
|
* @return {*} | 'skip' | null - null=error occured
|
|
49
50
|
*/
|
|
@@ -916,7 +917,7 @@ function generateMainDDEFunctionBody(pawnSource, containerDefinition, readWrite)
|
|
|
916
917
|
*/
|
|
917
918
|
async function buildDefaultInc(cwd, fs) {
|
|
918
919
|
const fileContent = [];
|
|
919
|
-
const dloLibs = await dependencies_1.Dependencies.
|
|
920
|
+
const dloLibs = await dependencies_1.Dependencies.getApmPartDependencies(cwd, fs, apm_1.APM.Part.dlo);
|
|
920
921
|
await addInclude(cwd, fs, fileContent, defaultFiles_1.DefaultFiles.fileNames.autoInc);
|
|
921
922
|
const autoDdeIncs = await getAutoDDEIncludes(cwd, fs, dloLibs);
|
|
922
923
|
for (const dloLib of dloLibs) {
|
package/out/dependencies.js
CHANGED
|
@@ -29,6 +29,7 @@ const manifest_1 = require("./manifest");
|
|
|
29
29
|
const semver = __importStar(require("semver"));
|
|
30
30
|
const registryAPI_1 = require("./registryAPI");
|
|
31
31
|
const defaultFiles_1 = require("./defaultFiles");
|
|
32
|
+
const apm_1 = require("./package/apm");
|
|
32
33
|
const tinytar = require('tinytar-fix');
|
|
33
34
|
const pako = require('pako');
|
|
34
35
|
exports.LIB_DEPS_PATH = '.studio/libdeps';
|
|
@@ -300,18 +301,22 @@ var Dependencies;
|
|
|
300
301
|
* Get all libraries that have dlo source
|
|
301
302
|
* @param cwd
|
|
302
303
|
* @param fs
|
|
304
|
+
* @param apmPart currently only dlo and dfiles are supported
|
|
303
305
|
*/
|
|
304
|
-
async function
|
|
306
|
+
async function getApmPartDependencies(cwd, fs, apmPart) {
|
|
305
307
|
const manifest = await manifest_1.Manifest.read(cwd, fs);
|
|
306
308
|
const allDependencies = await getAll(manifest);
|
|
307
|
-
const
|
|
309
|
+
const apmDependencies = [];
|
|
310
|
+
// @ts-ignore
|
|
311
|
+
const defaultApmPath = defaultFiles_1.DefaultFiles.filePaths[apmPart].path;
|
|
312
|
+
const includeExtension = apmPart === apm_1.APM.Part.dlo ? 'inc' : 'dfiles';
|
|
308
313
|
for (const dependencyId in allDependencies) {
|
|
309
314
|
const depPath = Dependencies.dependencyToPath(cwd, dependencyId);
|
|
310
315
|
const name = Dependencies.dependencyIdToName(dependencyId);
|
|
311
|
-
const incPath = vscode_uri_1.Utils.joinPath(depPath,
|
|
316
|
+
const incPath = vscode_uri_1.Utils.joinPath(depPath, defaultApmPath, `${name}.${includeExtension}`);
|
|
312
317
|
const exists = await fs.stat(incPath);
|
|
313
318
|
if (exists) {
|
|
314
|
-
|
|
319
|
+
apmDependencies.push({
|
|
315
320
|
name,
|
|
316
321
|
path: incPath
|
|
317
322
|
});
|
|
@@ -319,17 +324,17 @@ var Dependencies;
|
|
|
319
324
|
}
|
|
320
325
|
// add current project file if it is a library project
|
|
321
326
|
if (isLibraryProject(manifest)) {
|
|
322
|
-
const incPath = vscode_uri_1.Utils.joinPath(cwd,
|
|
327
|
+
const incPath = vscode_uri_1.Utils.joinPath(cwd, defaultApmPath, `${manifest.name}.${includeExtension}`);
|
|
323
328
|
if (await fs.stat(incPath)) {
|
|
324
|
-
|
|
329
|
+
apmDependencies.push({
|
|
325
330
|
name: manifest.name,
|
|
326
331
|
path: incPath
|
|
327
332
|
});
|
|
328
333
|
}
|
|
329
334
|
}
|
|
330
|
-
return
|
|
335
|
+
return apmDependencies;
|
|
331
336
|
}
|
|
332
|
-
Dependencies.
|
|
337
|
+
Dependencies.getApmPartDependencies = getApmPartDependencies;
|
|
333
338
|
})(Dependencies || (exports.Dependencies = Dependencies = {}));
|
|
334
339
|
async function fetchStudioJson(token, studioJsonURL) {
|
|
335
340
|
return await registryAPI_1.Registry.fetchLibraryContent(token, studioJsonURL, true);
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DFILES = void 0;
|
|
4
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
5
|
+
const dependencies_1 = require("../dependencies");
|
|
6
|
+
const helper_1 = require("../helper");
|
|
7
|
+
const yaml_1 = require("yaml");
|
|
8
|
+
const apm_1 = require("../package/apm");
|
|
9
|
+
const defaultFiles_1 = require("../defaultFiles");
|
|
10
|
+
var convertBlobToString = helper_1.Helper.convertBlobToString;
|
|
11
|
+
var yamlRangeToLineInformation = helper_1.Helper.yamlRangeToLineInformation;
|
|
12
|
+
var DFILES;
|
|
13
|
+
(function (DFILES) {
|
|
14
|
+
let Type;
|
|
15
|
+
(function (Type) {
|
|
16
|
+
Type["static"] = "static";
|
|
17
|
+
Type["dynamic"] = "dynamic";
|
|
18
|
+
})(Type = DFILES.Type || (DFILES.Type = {}));
|
|
19
|
+
let SyncLogic;
|
|
20
|
+
(function (SyncLogic) {
|
|
21
|
+
SyncLogic["crcStamp"] = "crc_stamp";
|
|
22
|
+
SyncLogic["stampOnly"] = "stamp_only";
|
|
23
|
+
SyncLogic["onlyDown"] = "only_down";
|
|
24
|
+
SyncLogic["onlyUp"] = "only_up";
|
|
25
|
+
})(SyncLogic = DFILES.SyncLogic || (DFILES.SyncLogic = {}));
|
|
26
|
+
let Force;
|
|
27
|
+
(function (Force) {
|
|
28
|
+
Force["down"] = "down";
|
|
29
|
+
Force["up"] = "up";
|
|
30
|
+
Force["off"] = "off";
|
|
31
|
+
})(Force = DFILES.Force || (DFILES.Force = {}));
|
|
32
|
+
async function process(cwd, fs) {
|
|
33
|
+
const allProperties = {};
|
|
34
|
+
const allDiagnostics = [];
|
|
35
|
+
const libraryFiles = await dependencies_1.Dependencies.getApmPartDependencies(cwd, fs, apm_1.APM.Part.dfiles);
|
|
36
|
+
for (const library of libraryFiles) {
|
|
37
|
+
const { properties, diagnostics } = await parseYamlFile(fs, library.path, library.name);
|
|
38
|
+
Object.assign(allProperties, properties);
|
|
39
|
+
allDiagnostics.push(...diagnostics);
|
|
40
|
+
}
|
|
41
|
+
const { properties, diagnostics } = await parseYamlFile(fs, vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.dfiles.mainDFILES), null);
|
|
42
|
+
Object.assign(allProperties, properties);
|
|
43
|
+
allDiagnostics.push(...diagnostics);
|
|
44
|
+
const distDir = vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.dist.dfilesPath);
|
|
45
|
+
// clear dist directory beforehand
|
|
46
|
+
if (await fs.stat(distDir)) {
|
|
47
|
+
await fs.rm(distDir);
|
|
48
|
+
}
|
|
49
|
+
// copy all files to dist directory
|
|
50
|
+
// copy all files to the dist directory
|
|
51
|
+
for (const [dfileName, dfileInfo] of Object.entries(allProperties)) {
|
|
52
|
+
await copyDfilesToDist(cwd, fs, dfileName, dfileInfo, libraryFiles);
|
|
53
|
+
}
|
|
54
|
+
// do not write the properties file if there aren't any dfiles
|
|
55
|
+
if (!Object.keys(allProperties).length) {
|
|
56
|
+
return allDiagnostics;
|
|
57
|
+
}
|
|
58
|
+
console.log(`${Object.keys(allProperties).length} dfiles processed.`);
|
|
59
|
+
await fs.writeFile(vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.dist.dfilesProperties), JSON.stringify(allProperties, null, '\t'));
|
|
60
|
+
return allDiagnostics;
|
|
61
|
+
}
|
|
62
|
+
DFILES.process = process;
|
|
63
|
+
/**
|
|
64
|
+
*
|
|
65
|
+
* @param fs
|
|
66
|
+
* @param fileUri
|
|
67
|
+
* @param libraryName
|
|
68
|
+
* @private
|
|
69
|
+
*/
|
|
70
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
71
|
+
async function parseYamlFile(fs, fileUri, libraryName) {
|
|
72
|
+
const compilerDiagnostics = [];
|
|
73
|
+
const dfileProperties = {};
|
|
74
|
+
if (!(await fs.stat(fileUri))) {
|
|
75
|
+
return {
|
|
76
|
+
properties: dfileProperties,
|
|
77
|
+
diagnostics: compilerDiagnostics
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const fileBlob = await fs.readFile(fileUri);
|
|
81
|
+
const yamlString = convertBlobToString(fileBlob);
|
|
82
|
+
const lineCounter = new yaml_1.LineCounter();
|
|
83
|
+
const yamlDoc = (0, yaml_1.parseDocument)(yamlString, { lineCounter });
|
|
84
|
+
const fileNodes = yamlDoc.contents || new yaml_1.YAMLMap();
|
|
85
|
+
for (const fileNode of fileNodes.items) {
|
|
86
|
+
const fileName = fileNode.key.value;
|
|
87
|
+
const fileValues = fileNode.value;
|
|
88
|
+
const yamlFileNameRange = yamlRangeToLineInformation(lineCounter, fileNode.key.range);
|
|
89
|
+
const hasSyncMode = fileValues.value !== null ? fileNode.value.has('syncMode') : false;
|
|
90
|
+
const syncMode = hasSyncMode
|
|
91
|
+
? fileNode.value.get('syncMode')
|
|
92
|
+
: SyncLogic.crcStamp;
|
|
93
|
+
if (hasSyncMode) {
|
|
94
|
+
const values = Object.values(DFILES.SyncLogic);
|
|
95
|
+
if (!values.includes(syncMode)) {
|
|
96
|
+
const syncModeItem = fileNode.value.items.find(item => {
|
|
97
|
+
return item.key.value === 'syncMode';
|
|
98
|
+
});
|
|
99
|
+
const yamlSyncModeRange = yamlRangeToLineInformation(lineCounter, syncModeItem.key.range);
|
|
100
|
+
compilerDiagnostics.push({
|
|
101
|
+
file: fileUri,
|
|
102
|
+
code: '',
|
|
103
|
+
message: `Property syncMode does not match any of "${values.join(', ')}"`,
|
|
104
|
+
line: yamlSyncModeRange.line,
|
|
105
|
+
startCharacter: yamlSyncModeRange.startCharacter,
|
|
106
|
+
endCharacter: yamlSyncModeRange.endCharacter,
|
|
107
|
+
level: 'error'
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
compilerDiagnostics.push({
|
|
113
|
+
file: fileUri,
|
|
114
|
+
code: '',
|
|
115
|
+
message: `Property "syncMode" missing`,
|
|
116
|
+
line: yamlFileNameRange.line,
|
|
117
|
+
startCharacter: yamlFileNameRange.startCharacter,
|
|
118
|
+
endCharacter: yamlFileNameRange.endCharacter,
|
|
119
|
+
level: 'error'
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
if (!fileName.match(/^[a-z0-9._-]*$/)) {
|
|
123
|
+
compilerDiagnostics.push({
|
|
124
|
+
file: fileUri,
|
|
125
|
+
code: '',
|
|
126
|
+
message: 'Filename does not match pattern "a-z0-9._-"',
|
|
127
|
+
line: yamlFileNameRange.line,
|
|
128
|
+
startCharacter: yamlFileNameRange.startCharacter,
|
|
129
|
+
endCharacter: yamlFileNameRange.endCharacter,
|
|
130
|
+
level: 'error'
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
const dfilePath = vscode_uri_1.Utils.joinPath(vscode_uri_1.Utils.dirname(fileUri), fileName);
|
|
134
|
+
const exists = await getFileStat(fs, dfilePath);
|
|
135
|
+
if (!exists) {
|
|
136
|
+
const yamlRange = yamlRangeToLineInformation(lineCounter, fileNode.key.range);
|
|
137
|
+
compilerDiagnostics.push({
|
|
138
|
+
file: fileUri,
|
|
139
|
+
code: '',
|
|
140
|
+
message: `Could not find file "${fileName}"`,
|
|
141
|
+
line: yamlRange.line,
|
|
142
|
+
startCharacter: yamlRange.startCharacter,
|
|
143
|
+
endCharacter: yamlRange.endCharacter,
|
|
144
|
+
level: 'error'
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
dfileProperties[fileName] = {
|
|
149
|
+
crc: exists.crc,
|
|
150
|
+
force: Force.off,
|
|
151
|
+
readable: false,
|
|
152
|
+
size: exists.size,
|
|
153
|
+
stamp: exists.stamp,
|
|
154
|
+
sync_logic: syncMode,
|
|
155
|
+
type: Type.static,
|
|
156
|
+
library: libraryName
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
properties: dfileProperties,
|
|
162
|
+
diagnostics: compilerDiagnostics
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
DFILES.parseYamlFile = parseYamlFile;
|
|
166
|
+
})(DFILES || (exports.DFILES = DFILES = {}));
|
|
167
|
+
async function getFileStat(fs, filePath) {
|
|
168
|
+
const stat = await fs.stat(filePath);
|
|
169
|
+
if (!stat) {
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
const blob = await fs.readFile(filePath);
|
|
173
|
+
return {
|
|
174
|
+
size: stat.size,
|
|
175
|
+
stamp: Math.trunc(stat.ctime),
|
|
176
|
+
crc: helper_1.Helper.generateCRC32ForFileContent(blob)
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
async function copyDfilesToDist(cwd, fs, fileName, property, libraryFiles) {
|
|
180
|
+
const isLibrary = property.library !== null;
|
|
181
|
+
const sourcePath = isLibrary
|
|
182
|
+
? vscode_uri_1.Utils.dirname(libraryFiles.find(lib => lib.name === property.library).path)
|
|
183
|
+
: vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.dfiles.path);
|
|
184
|
+
const destinationDir = vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.dist.dfilesPath, fileName);
|
|
185
|
+
const sourceDir = vscode_uri_1.Utils.joinPath(sourcePath, fileName);
|
|
186
|
+
await fs.copy(sourceDir, destinationDir);
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=dfiles.js.map
|
package/out/dlo/compiler.js
CHANGED
|
@@ -34,6 +34,7 @@ const dependencies_1 = require("../dependencies");
|
|
|
34
34
|
const iconv = __importStar(require("iconv-lite"));
|
|
35
35
|
const helper_1 = require("../helper");
|
|
36
36
|
var convertBlobToStringArray = helper_1.Helper.convertBlobToStringArray;
|
|
37
|
+
const apm_1 = require("../package/apm");
|
|
37
38
|
const DLO_MODULE = require('./dlocc.js');
|
|
38
39
|
class DloCompiler {
|
|
39
40
|
preCompiler = new preCompiler_1.DloPreCompiler();
|
|
@@ -295,7 +296,7 @@ async function generateConfigFile(cwd, fs, manifest) {
|
|
|
295
296
|
];
|
|
296
297
|
const defaultIncPath = vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.studio.auto.dlo.defaultInc);
|
|
297
298
|
compileOptions.push(`-p${uriToMemFsPath(defaultIncPath)}`);
|
|
298
|
-
const dloLibs = await dependencies_1.Dependencies.
|
|
299
|
+
const dloLibs = await dependencies_1.Dependencies.getApmPartDependencies(cwd, fs, apm_1.APM.Part.dlo);
|
|
299
300
|
for (const dloLib of dloLibs) {
|
|
300
301
|
const dirName = vscode_uri_1.Utils.dirname(dloLib.path);
|
|
301
302
|
compileOptions.push(`-i${uriToMemFsPath(dirName)}`);
|
package/out/main.js
CHANGED
|
@@ -73,7 +73,7 @@ program
|
|
|
73
73
|
});
|
|
74
74
|
program
|
|
75
75
|
.command('build')
|
|
76
|
-
.addOption(new commander_1.Option('-p --part <APM part>', 'APM part that should be build').choices(
|
|
76
|
+
.addOption(new commander_1.Option('-p --part <APM part>', 'APM part that should be build').choices(Object.values(apm_1.APM.Part)))
|
|
77
77
|
.action(async (opts) => {
|
|
78
78
|
await package_1.Package.buildAll(cwd, cliFS_1.cliFS, opts.part);
|
|
79
79
|
});
|
package/out/manifest.js
CHANGED
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Manifest = void 0;
|
|
7
|
-
exports.validateProjectVersion = validateProjectVersion;
|
|
8
7
|
const vscode_uri_1 = require("vscode-uri");
|
|
9
8
|
const helper_1 = require("./helper");
|
|
10
9
|
const image_dimensions_1 = require("image-dimensions");
|
|
@@ -12,6 +11,7 @@ const file_type_checker_1 = require("file-type-checker");
|
|
|
12
11
|
const registryAPI_1 = require("./registryAPI");
|
|
13
12
|
const globals_1 = require("./globals");
|
|
14
13
|
const preload_1 = __importDefault(require("semver/preload"));
|
|
14
|
+
const DeviceProfiles_1 = require("./DeviceProfiles");
|
|
15
15
|
var isNumeric = helper_1.Helper.isNumeric;
|
|
16
16
|
const STUDIO_JSON_NAME = 'studio.json';
|
|
17
17
|
// Cache to reduce the disk read requests
|
|
@@ -58,11 +58,15 @@ var Manifest;
|
|
|
58
58
|
const manifestUri = vscode_uri_1.Utils.joinPath(cwd, STUDIO_JSON_NAME);
|
|
59
59
|
const manifestStat = await fs.stat(manifestUri);
|
|
60
60
|
// if the manifest was modified, reload the cache
|
|
61
|
-
if (manifestCache.manifest === null ||
|
|
61
|
+
if (manifestCache.manifest === null ||
|
|
62
|
+
manifestUri?.fsPath !== manifestCache.stat?.path.fsPath ||
|
|
63
|
+
manifestStat?.ctime !== manifestCache.stat?.ctime ||
|
|
64
|
+
manifestStat?.mtime !== manifestCache.stat?.mtime ||
|
|
65
|
+
manifestStat?.size !== manifestCache.stat?.size) {
|
|
62
66
|
const localManifest = await fs.readFile(manifestUri);
|
|
63
67
|
const manifestString = convertBlobToString(localManifest);
|
|
64
68
|
manifestCache.manifest = JSON.parse(manifestString);
|
|
65
|
-
manifestCache.stat = manifestStat;
|
|
69
|
+
manifestCache.stat = { ...manifestStat, path: manifestUri };
|
|
66
70
|
}
|
|
67
71
|
return manifestCache.manifest;
|
|
68
72
|
}
|
|
@@ -84,6 +88,8 @@ var Manifest;
|
|
|
84
88
|
*/
|
|
85
89
|
async function write(cwd, fs, manifest) {
|
|
86
90
|
manifestCache.clear();
|
|
91
|
+
// patch the options if they are not valid for a specific device profile
|
|
92
|
+
patchDloCompileOptionsBasedOnDpid(manifest);
|
|
87
93
|
return fs.writeFile(vscode_uri_1.Utils.joinPath(cwd, STUDIO_JSON_NAME), JSON.stringify(manifest, null, '\t'));
|
|
88
94
|
}
|
|
89
95
|
Manifest.write = write;
|
|
@@ -100,24 +106,16 @@ var Manifest;
|
|
|
100
106
|
* @param fs
|
|
101
107
|
* @param manifest
|
|
102
108
|
* @param env
|
|
103
|
-
* @param publish - validate publish related options
|
|
104
109
|
*/
|
|
105
|
-
async function
|
|
110
|
+
async function validateBasicManifest(cwd, fs, manifest, env = globals_1.Globals.ENV.production) {
|
|
106
111
|
if (!manifest) {
|
|
107
112
|
manifest = await read(cwd, fs);
|
|
108
113
|
}
|
|
109
114
|
validateProjectVersion(manifest, env);
|
|
110
115
|
validatePOVSettings(manifest);
|
|
111
116
|
validateBLOSettings(manifest);
|
|
112
|
-
if (!manifest.library) {
|
|
113
|
-
validateEngineSettings(manifest);
|
|
114
|
-
// only validate during publish process
|
|
115
|
-
if (publish) {
|
|
116
|
-
await validateApplicationIcon(cwd, fs, manifest);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
117
|
}
|
|
120
|
-
Manifest.
|
|
118
|
+
Manifest.validateBasicManifest = validateBasicManifest;
|
|
121
119
|
function validateLibraryName(libraryName) {
|
|
122
120
|
const errorMessage = `Library name can only contain 'a' through 'z', '0' through '9', '_' and '-'. The Library name must start with an alphabetic or numeric character.`;
|
|
123
121
|
const valid = libraryName.match(/^[a-z0-9-_]+$/);
|
|
@@ -133,10 +131,10 @@ var Manifest;
|
|
|
133
131
|
if (libraryName.length < 3 || libraryName.length > 20) {
|
|
134
132
|
return `The library name is beyond permissible length of 20 characters.`;
|
|
135
133
|
}
|
|
136
|
-
return
|
|
134
|
+
return null;
|
|
137
135
|
}
|
|
138
136
|
Manifest.validateLibraryName = validateLibraryName;
|
|
139
|
-
|
|
137
|
+
function validateProjectName(name, isLibrary) {
|
|
140
138
|
if (isLibrary) {
|
|
141
139
|
return validateLibraryName(name);
|
|
142
140
|
}
|
|
@@ -154,20 +152,20 @@ var Manifest;
|
|
|
154
152
|
if (invalidChars.includes(name[0]) || invalidChars.includes(name[name.length - 1])) {
|
|
155
153
|
return errorMessage;
|
|
156
154
|
}
|
|
157
|
-
return
|
|
155
|
+
return null;
|
|
158
156
|
}
|
|
159
157
|
}
|
|
160
158
|
Manifest.validateProjectName = validateProjectName;
|
|
161
|
-
|
|
159
|
+
function validateDescription(description) {
|
|
162
160
|
if (description.length < 5) {
|
|
163
161
|
return `The description must have at least 5 characters.`;
|
|
164
162
|
}
|
|
165
163
|
else {
|
|
166
|
-
return
|
|
164
|
+
return null;
|
|
167
165
|
}
|
|
168
166
|
}
|
|
169
167
|
Manifest.validateDescription = validateDescription;
|
|
170
|
-
|
|
168
|
+
function validatePublisherId(publisher) {
|
|
171
169
|
if (!publisher) {
|
|
172
170
|
return `No publisher set yet`;
|
|
173
171
|
}
|
|
@@ -179,7 +177,7 @@ var Manifest;
|
|
|
179
177
|
return errorMessage;
|
|
180
178
|
}
|
|
181
179
|
}
|
|
182
|
-
return
|
|
180
|
+
return null;
|
|
183
181
|
}
|
|
184
182
|
Manifest.validatePublisherId = validatePublisherId;
|
|
185
183
|
async function validatePublisherOnline(token, publisher) {
|
|
@@ -187,7 +185,7 @@ var Manifest;
|
|
|
187
185
|
if (!exists) {
|
|
188
186
|
return `Publisher '${publisher}' does not exist.`;
|
|
189
187
|
}
|
|
190
|
-
return
|
|
188
|
+
return null;
|
|
191
189
|
}
|
|
192
190
|
Manifest.validatePublisherOnline = validatePublisherOnline;
|
|
193
191
|
const REGEX_SERVER_DOMAIN = /^(((?!-))(xn--)?[a-z0-9\-_]{0,61}[a-z0-9]{1,1}\.)*(xn--)?([a-z0-9-]{1,61}|[a-z0-9-]{1,30})\.[a-z]{2,}$/;
|
|
@@ -206,9 +204,45 @@ var Manifest;
|
|
|
206
204
|
else if (!allowedBackends?.match(REGEX_SERVER_DOMAIN) && allowedBackends !== '*') {
|
|
207
205
|
return `Invalid value for "allowedBackends"`;
|
|
208
206
|
}
|
|
209
|
-
return
|
|
207
|
+
return null;
|
|
210
208
|
}
|
|
211
209
|
Manifest.validateRegistryAllowedBackends = validateRegistryAllowedBackends;
|
|
210
|
+
async function validateApplicationIcon(cwd, fs, manifest) {
|
|
211
|
+
const iconPath = manifest.icon;
|
|
212
|
+
if (!iconPath) {
|
|
213
|
+
throw new Error('App icon is required for publishing an application!');
|
|
214
|
+
}
|
|
215
|
+
const iconUri = vscode_uri_1.Utils.joinPath(cwd, iconPath);
|
|
216
|
+
const iconExist = await fs.stat(iconUri);
|
|
217
|
+
if (!iconExist) {
|
|
218
|
+
throw new Error(`Could not load icon "${iconPath}"`);
|
|
219
|
+
}
|
|
220
|
+
const iconData = await fs.readFile(iconUri);
|
|
221
|
+
const dimensions = (0, image_dimensions_1.imageDimensionsFromData)(iconData);
|
|
222
|
+
if (!dimensions) {
|
|
223
|
+
throw new Error(`App icon could not be validated!`);
|
|
224
|
+
}
|
|
225
|
+
if (dimensions?.width !== dimensions?.height) {
|
|
226
|
+
throw new Error(`App icon has to be a square!`);
|
|
227
|
+
}
|
|
228
|
+
if (dimensions.width > 512 || dimensions.width < 75) {
|
|
229
|
+
throw new Error(`App icon size should be between 75px and 512px!`);
|
|
230
|
+
}
|
|
231
|
+
if (!(0, file_type_checker_1.isPNG)(iconData)) {
|
|
232
|
+
throw new Error(`App icon has to be of type PNG!`);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
Manifest.validateApplicationIcon = validateApplicationIcon;
|
|
236
|
+
function validateEngineSettings(manifest) {
|
|
237
|
+
const { engines } = manifest;
|
|
238
|
+
// validate vor server versions >=52v006
|
|
239
|
+
if (engines?.backend &&
|
|
240
|
+
!engines.backend.match(/(^[5-9][2-9]|[6-9]\d+|\d{3,})v(0(0[6-9]|[1-9]\d)|[1-9]\d{2}|[1-9]\d{3,})$/)) {
|
|
241
|
+
throw new Error('Setting "engines.backend" is invalid');
|
|
242
|
+
}
|
|
243
|
+
validateHwFwOrProductId(manifest);
|
|
244
|
+
}
|
|
245
|
+
Manifest.validateEngineSettings = validateEngineSettings;
|
|
212
246
|
})(Manifest || (exports.Manifest = Manifest = {}));
|
|
213
247
|
function validatePOVSettings(manifest) {
|
|
214
248
|
const { pov } = manifest;
|
|
@@ -240,15 +274,6 @@ function validateBLOSettings(manifest) {
|
|
|
240
274
|
throw new Error(`Only "${Manifest.BloAccessLevel.restricted}" or "${Manifest.BloAccessLevel.global}" are allowed as value for "blo.accessLevel"!`);
|
|
241
275
|
}
|
|
242
276
|
}
|
|
243
|
-
function validateEngineSettings(manifest) {
|
|
244
|
-
const { engines } = manifest;
|
|
245
|
-
// validate vor server versions >=52v006
|
|
246
|
-
if (engines?.backend &&
|
|
247
|
-
!engines.backend.match(/(^[5-9][2-9]|[6-9]\d+|\d{3,})v(0(0[6-9]|[1-9]\d)|[1-9]\d{2}|[1-9]\d{3,})$/)) {
|
|
248
|
-
throw new Error('Setting "engines.backend" is invalid');
|
|
249
|
-
}
|
|
250
|
-
validateHwFwOrProductId(manifest);
|
|
251
|
-
}
|
|
252
277
|
function validateHwFwOrProductId(manifest) {
|
|
253
278
|
const { backend, productId, hwfw } = manifest.engines;
|
|
254
279
|
if (backend && backend >= '52v007') {
|
|
@@ -260,31 +285,6 @@ function validateHwFwOrProductId(manifest) {
|
|
|
260
285
|
throw new Error('"engines.productId" requires "engines.backend" to be ">=52v007"');
|
|
261
286
|
}
|
|
262
287
|
}
|
|
263
|
-
async function validateApplicationIcon(cwd, fs, manifest) {
|
|
264
|
-
const iconPath = manifest.icon;
|
|
265
|
-
if (!iconPath) {
|
|
266
|
-
throw new Error('App icon is required for publishing an application!');
|
|
267
|
-
}
|
|
268
|
-
const iconUri = vscode_uri_1.Utils.joinPath(cwd, iconPath);
|
|
269
|
-
const iconExist = await fs.stat(iconUri);
|
|
270
|
-
if (!iconExist) {
|
|
271
|
-
throw new Error(`Could not load icon "${iconPath}"`);
|
|
272
|
-
}
|
|
273
|
-
const iconData = await fs.readFile(iconUri);
|
|
274
|
-
const dimensions = (0, image_dimensions_1.imageDimensionsFromData)(iconData);
|
|
275
|
-
if (!dimensions) {
|
|
276
|
-
throw new Error(`App icon could not be validated!`);
|
|
277
|
-
}
|
|
278
|
-
if (dimensions?.width !== dimensions?.height) {
|
|
279
|
-
throw new Error(`App icon has to be a square!`);
|
|
280
|
-
}
|
|
281
|
-
if (dimensions.width > 512 || dimensions.width < 75) {
|
|
282
|
-
throw new Error(`App icon size should be between 75px and 512px!`);
|
|
283
|
-
}
|
|
284
|
-
if (!(0, file_type_checker_1.isPNG)(iconData)) {
|
|
285
|
-
throw new Error(`App icon has to be of type PNG!`);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
288
|
/**
|
|
289
289
|
* Check based on the current env if the given version string is correct
|
|
290
290
|
* @param manifest
|
|
@@ -302,4 +302,30 @@ function validateProjectVersion(manifest, env) {
|
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
|
+
/**
|
|
306
|
+
* Some devices doesn't support compression. this function does patch the option if it's not supported
|
|
307
|
+
* @param manifest
|
|
308
|
+
*/
|
|
309
|
+
function patchDloCompileOptionsBasedOnDpid(manifest) {
|
|
310
|
+
if (!manifest.dpid) {
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
const deviceProfile = DeviceProfiles_1.DeviceProfiles[manifest.dpid];
|
|
314
|
+
const compileRestrictions = deviceProfile?.dlo?.compileRestrictions || {};
|
|
315
|
+
const { compileOptions } = manifest.dlo || {};
|
|
316
|
+
if (compileOptions) {
|
|
317
|
+
compileOptions.forEach((param, idx) => {
|
|
318
|
+
try {
|
|
319
|
+
const paramType = param.substring(0, 2);
|
|
320
|
+
const paramValue = param.substring(2);
|
|
321
|
+
if (Object.hasOwn(compileRestrictions, paramType) && `${paramValue}` !== `${compileRestrictions[paramType]}`) {
|
|
322
|
+
compileOptions[idx] = `${paramType}${compileRestrictions[paramType]}`;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
catch (e) {
|
|
326
|
+
// todo?
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
}
|
|
305
331
|
//# sourceMappingURL=manifest.js.map
|
package/out/package/apm.js
CHANGED
|
@@ -29,6 +29,7 @@ var APM;
|
|
|
29
29
|
Part["dlo"] = "dlo";
|
|
30
30
|
Part["pov"] = "pov";
|
|
31
31
|
Part["blo"] = "blo";
|
|
32
|
+
Part["dfiles"] = "dfiles";
|
|
32
33
|
})(Part = APM.Part || (APM.Part = {}));
|
|
33
34
|
/**
|
|
34
35
|
* Create new release tag
|
|
@@ -141,7 +142,7 @@ var APM;
|
|
|
141
142
|
const manifest = await manifest_1.Manifest.read(cwd, fs);
|
|
142
143
|
if (!preventCreation) {
|
|
143
144
|
// throws if the specific setting is invalid
|
|
144
|
-
await package_1.Package.
|
|
145
|
+
await package_1.Package.validatePublishSettings(cwd, fs, token);
|
|
145
146
|
}
|
|
146
147
|
const { registry } = manifest;
|
|
147
148
|
let applicationId = registry?.id;
|
|
@@ -186,8 +187,7 @@ var APM;
|
|
|
186
187
|
}
|
|
187
188
|
manifest.registry = {
|
|
188
189
|
id: projectId,
|
|
189
|
-
allowedBackends: newApplication.allowedBackends
|
|
190
|
-
target: backendTarget
|
|
190
|
+
allowedBackends: newApplication.allowedBackends
|
|
191
191
|
};
|
|
192
192
|
// write the updated manifest to disk
|
|
193
193
|
await manifest_1.Manifest.write(cwd, fs, manifest);
|
package/out/package/package.js
CHANGED
|
@@ -13,6 +13,7 @@ const scriptRunner_1 = require("../scriptRunner");
|
|
|
13
13
|
const manifest_1 = require("../manifest");
|
|
14
14
|
const globals_1 = require("../globals");
|
|
15
15
|
const library_1 = require("./library");
|
|
16
|
+
const dfiles_1 = require("../dfiles/dfiles");
|
|
16
17
|
var Package;
|
|
17
18
|
(function (Package) {
|
|
18
19
|
/**
|
|
@@ -28,6 +29,9 @@ var Package;
|
|
|
28
29
|
if (!apmPart || apmPart === apm_1.APM.Part.dlo) {
|
|
29
30
|
await buildDLO(cwd, fs);
|
|
30
31
|
}
|
|
32
|
+
if (!apmPart || apmPart === apm_1.APM.Part.dfiles) {
|
|
33
|
+
await buildDfiles(cwd, fs);
|
|
34
|
+
}
|
|
31
35
|
if (!apmPart || apmPart === apm_1.APM.Part.pov) {
|
|
32
36
|
await scriptRunner_1.Shell.tryBuildPov(cwd, fs);
|
|
33
37
|
}
|
|
@@ -67,7 +71,7 @@ var Package;
|
|
|
67
71
|
if (!Object.values(apm_1.APM.TagPhase).includes(releasePhase)) {
|
|
68
72
|
throw new Error(`ReleasePhase: ${releasePhase} is not a valid release phase`);
|
|
69
73
|
}
|
|
70
|
-
await manifest_1.Manifest.
|
|
74
|
+
await manifest_1.Manifest.validateBasicManifest(cwd, fs, null, env);
|
|
71
75
|
const application = await apm_1.APM.validateAccess(cwd, fs, token, false, env);
|
|
72
76
|
if (!application) {
|
|
73
77
|
return;
|
|
@@ -90,8 +94,8 @@ var Package;
|
|
|
90
94
|
*/
|
|
91
95
|
async function releaseLibrary(cwd, fs, token, env = globals_1.Globals.ENV.production) {
|
|
92
96
|
const manifest = await manifest_1.Manifest.read(cwd, fs);
|
|
93
|
-
await manifest_1.Manifest.
|
|
94
|
-
await
|
|
97
|
+
await manifest_1.Manifest.validateBasicManifest(cwd, fs, manifest, env);
|
|
98
|
+
await validatePublishSettings(cwd, fs, token);
|
|
95
99
|
// build the complete project
|
|
96
100
|
await buildAll(cwd, fs);
|
|
97
101
|
const archive = await library_1.Library.createArchive(cwd, fs);
|
|
@@ -144,32 +148,36 @@ var Package;
|
|
|
144
148
|
Package.getChangelogFile = getChangelogFile;
|
|
145
149
|
/**
|
|
146
150
|
* Validate manifest settings that are required for the APM
|
|
151
|
+
* @param cwd
|
|
152
|
+
* @param fs
|
|
147
153
|
* @param token
|
|
148
|
-
* @param manifest
|
|
149
154
|
*/
|
|
150
|
-
async function
|
|
155
|
+
async function validatePublishSettings(cwd, fs, token) {
|
|
156
|
+
const manifest = await manifest_1.Manifest.read(cwd, fs);
|
|
151
157
|
const { name, publisher, description, registry } = manifest;
|
|
152
|
-
const invalidName =
|
|
158
|
+
const invalidName = manifest_1.Manifest.validateProjectName(name, manifest_1.Manifest.isLibraryProject(manifest));
|
|
153
159
|
if (invalidName) {
|
|
154
160
|
throw new Error(`name: ${invalidName}`);
|
|
155
161
|
}
|
|
156
|
-
const invalidDescription =
|
|
162
|
+
const invalidDescription = manifest_1.Manifest.validateDescription(description);
|
|
157
163
|
if (invalidDescription) {
|
|
158
164
|
throw new Error(`description: ${invalidDescription}`);
|
|
159
165
|
}
|
|
160
|
-
const invalidPublisher =
|
|
166
|
+
const invalidPublisher = manifest_1.Manifest.validatePublisherId(publisher) || (await manifest_1.Manifest.validatePublisherOnline(token, publisher));
|
|
161
167
|
if (invalidPublisher) {
|
|
162
168
|
throw new Error(`publisher: ${invalidPublisher}`);
|
|
163
169
|
}
|
|
164
170
|
// only validate if the project is not a library project
|
|
165
171
|
if (!manifest_1.Manifest.isLibraryProject(manifest)) {
|
|
172
|
+
await manifest_1.Manifest.validateApplicationIcon(cwd, fs, manifest);
|
|
173
|
+
manifest_1.Manifest.validateEngineSettings(manifest);
|
|
166
174
|
const invalidBackends = await manifest_1.Manifest.validateRegistryAllowedBackends(registry?.allowedBackends);
|
|
167
175
|
if (invalidBackends) {
|
|
168
176
|
throw new Error(`registry: ${invalidBackends}`);
|
|
169
177
|
}
|
|
170
178
|
}
|
|
171
179
|
}
|
|
172
|
-
Package.
|
|
180
|
+
Package.validatePublishSettings = validatePublishSettings;
|
|
173
181
|
})(Package || (exports.Package = Package = {}));
|
|
174
182
|
/**
|
|
175
183
|
* Generates all needed files out of the dde declaration
|
|
@@ -177,6 +185,7 @@ var Package;
|
|
|
177
185
|
* @param fs
|
|
178
186
|
*/
|
|
179
187
|
async function buildDDE(cwd, fs) {
|
|
188
|
+
console.log('Processing DDE...');
|
|
180
189
|
const result = await dde_1.DDE.compileDDE(cwd, fs);
|
|
181
190
|
result.diagnostics.forEach(diagnostic => {
|
|
182
191
|
const message = `${diagnostic.file.path}: ${diagnostic.message}`;
|
|
@@ -203,10 +212,16 @@ async function buildDDE(cwd, fs) {
|
|
|
203
212
|
}
|
|
204
213
|
}
|
|
205
214
|
async function buildDLO(cwd, fs) {
|
|
215
|
+
console.log('Processing DLO...');
|
|
206
216
|
const compiler = new compiler_1.DloCompiler();
|
|
207
217
|
const { diagnostics } = await compiler.compile(cwd, fs);
|
|
208
218
|
throwIfDiagnosticsHaveError(apm_1.APM.Part.dlo, diagnostics);
|
|
209
219
|
}
|
|
220
|
+
async function buildDfiles(cwd, fs) {
|
|
221
|
+
console.log('Processing DFILES...');
|
|
222
|
+
const diagnostics = await dfiles_1.DFILES.process(cwd, fs);
|
|
223
|
+
throwIfDiagnosticsHaveError(apm_1.APM.Part.dfiles, diagnostics);
|
|
224
|
+
}
|
|
210
225
|
function throwIfDiagnosticsHaveError(apmPart, diagnostics) {
|
|
211
226
|
diagnostics.forEach(diagnostic => {
|
|
212
227
|
if (diagnostic.level === 'error') {
|