@microtronics/studio-cli 0.12.1 → 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 +25 -0
- package/dist/studio-cli.d.ts +68 -21
- 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 -55
- package/out/package/apm.js +3 -3
- package/out/package/package.js +27 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
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
|
+
|
|
21
|
+
## 0.12.2 (2025-01-27)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* **studio-cli:** only validate publish related settings during publishing ([82a624a](https://bitbucket.org/microtronics-core/vscode-studio/commits/82a624a3937f0382f096a940f05720b41b3d658a))
|
|
27
|
+
|
|
3
28
|
## 0.12.1 (2025-01-21)
|
|
4
29
|
|
|
5
30
|
|
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
|
};
|
|
@@ -2053,13 +2097,15 @@ export declare namespace Manifest {
|
|
|
2053
2097
|
* @param manifest
|
|
2054
2098
|
* @param env
|
|
2055
2099
|
*/
|
|
2056
|
-
export function
|
|
2057
|
-
export function validateLibraryName(libraryName: string):
|
|
2058
|
-
export function validateProjectName(name: string, isLibrary?: boolean):
|
|
2059
|
-
export function validateDescription(description: string):
|
|
2060
|
-
export function validatePublisherId(publisher: string):
|
|
2061
|
-
export function validatePublisherOnline(token: Registry.AuthToken, publisher: string): Promise<string |
|
|
2062
|
-
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;
|
|
2063
2109
|
}
|
|
2064
2110
|
|
|
2065
2111
|
export declare namespace Package {
|
|
@@ -2113,10 +2159,11 @@ export declare namespace Package {
|
|
|
2113
2159
|
export function getChangelogFile(cwd: URI, fs: LocalFS): Promise<Uint8Array>;
|
|
2114
2160
|
/**
|
|
2115
2161
|
* Validate manifest settings that are required for the APM
|
|
2162
|
+
* @param cwd
|
|
2163
|
+
* @param fs
|
|
2116
2164
|
* @param token
|
|
2117
|
-
* @param manifest
|
|
2118
2165
|
*/
|
|
2119
|
-
export function
|
|
2166
|
+
export function validatePublishSettings(cwd: URI, fs: LocalFS, token: Registry.AuthToken): Promise<void>;
|
|
2120
2167
|
}
|
|
2121
2168
|
|
|
2122
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;
|
|
@@ -101,22 +107,15 @@ var Manifest;
|
|
|
101
107
|
* @param manifest
|
|
102
108
|
* @param env
|
|
103
109
|
*/
|
|
104
|
-
async function
|
|
110
|
+
async function validateBasicManifest(cwd, fs, manifest, env = globals_1.Globals.ENV.production) {
|
|
105
111
|
if (!manifest) {
|
|
106
112
|
manifest = await read(cwd, fs);
|
|
107
113
|
}
|
|
108
114
|
validateProjectVersion(manifest, env);
|
|
109
115
|
validatePOVSettings(manifest);
|
|
110
116
|
validateBLOSettings(manifest);
|
|
111
|
-
if (!manifest.library) {
|
|
112
|
-
validateEngineSettings(manifest);
|
|
113
|
-
// only validate if the
|
|
114
|
-
if (manifest.registry?.id) {
|
|
115
|
-
await validateApplicationIcon(cwd, fs, manifest);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
117
|
}
|
|
119
|
-
Manifest.
|
|
118
|
+
Manifest.validateBasicManifest = validateBasicManifest;
|
|
120
119
|
function validateLibraryName(libraryName) {
|
|
121
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.`;
|
|
122
121
|
const valid = libraryName.match(/^[a-z0-9-_]+$/);
|
|
@@ -132,10 +131,10 @@ var Manifest;
|
|
|
132
131
|
if (libraryName.length < 3 || libraryName.length > 20) {
|
|
133
132
|
return `The library name is beyond permissible length of 20 characters.`;
|
|
134
133
|
}
|
|
135
|
-
return
|
|
134
|
+
return null;
|
|
136
135
|
}
|
|
137
136
|
Manifest.validateLibraryName = validateLibraryName;
|
|
138
|
-
|
|
137
|
+
function validateProjectName(name, isLibrary) {
|
|
139
138
|
if (isLibrary) {
|
|
140
139
|
return validateLibraryName(name);
|
|
141
140
|
}
|
|
@@ -153,20 +152,20 @@ var Manifest;
|
|
|
153
152
|
if (invalidChars.includes(name[0]) || invalidChars.includes(name[name.length - 1])) {
|
|
154
153
|
return errorMessage;
|
|
155
154
|
}
|
|
156
|
-
return
|
|
155
|
+
return null;
|
|
157
156
|
}
|
|
158
157
|
}
|
|
159
158
|
Manifest.validateProjectName = validateProjectName;
|
|
160
|
-
|
|
159
|
+
function validateDescription(description) {
|
|
161
160
|
if (description.length < 5) {
|
|
162
161
|
return `The description must have at least 5 characters.`;
|
|
163
162
|
}
|
|
164
163
|
else {
|
|
165
|
-
return
|
|
164
|
+
return null;
|
|
166
165
|
}
|
|
167
166
|
}
|
|
168
167
|
Manifest.validateDescription = validateDescription;
|
|
169
|
-
|
|
168
|
+
function validatePublisherId(publisher) {
|
|
170
169
|
if (!publisher) {
|
|
171
170
|
return `No publisher set yet`;
|
|
172
171
|
}
|
|
@@ -178,7 +177,7 @@ var Manifest;
|
|
|
178
177
|
return errorMessage;
|
|
179
178
|
}
|
|
180
179
|
}
|
|
181
|
-
return
|
|
180
|
+
return null;
|
|
182
181
|
}
|
|
183
182
|
Manifest.validatePublisherId = validatePublisherId;
|
|
184
183
|
async function validatePublisherOnline(token, publisher) {
|
|
@@ -186,7 +185,7 @@ var Manifest;
|
|
|
186
185
|
if (!exists) {
|
|
187
186
|
return `Publisher '${publisher}' does not exist.`;
|
|
188
187
|
}
|
|
189
|
-
return
|
|
188
|
+
return null;
|
|
190
189
|
}
|
|
191
190
|
Manifest.validatePublisherOnline = validatePublisherOnline;
|
|
192
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,}$/;
|
|
@@ -205,9 +204,45 @@ var Manifest;
|
|
|
205
204
|
else if (!allowedBackends?.match(REGEX_SERVER_DOMAIN) && allowedBackends !== '*') {
|
|
206
205
|
return `Invalid value for "allowedBackends"`;
|
|
207
206
|
}
|
|
208
|
-
return
|
|
207
|
+
return null;
|
|
209
208
|
}
|
|
210
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;
|
|
211
246
|
})(Manifest || (exports.Manifest = Manifest = {}));
|
|
212
247
|
function validatePOVSettings(manifest) {
|
|
213
248
|
const { pov } = manifest;
|
|
@@ -239,15 +274,6 @@ function validateBLOSettings(manifest) {
|
|
|
239
274
|
throw new Error(`Only "${Manifest.BloAccessLevel.restricted}" or "${Manifest.BloAccessLevel.global}" are allowed as value for "blo.accessLevel"!`);
|
|
240
275
|
}
|
|
241
276
|
}
|
|
242
|
-
function validateEngineSettings(manifest) {
|
|
243
|
-
const { engines } = manifest;
|
|
244
|
-
// validate vor server versions >=52v006
|
|
245
|
-
if (engines?.backend &&
|
|
246
|
-
!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,})$/)) {
|
|
247
|
-
throw new Error('Setting "engines.backend" is invalid');
|
|
248
|
-
}
|
|
249
|
-
validateHwFwOrProductId(manifest);
|
|
250
|
-
}
|
|
251
277
|
function validateHwFwOrProductId(manifest) {
|
|
252
278
|
const { backend, productId, hwfw } = manifest.engines;
|
|
253
279
|
if (backend && backend >= '52v007') {
|
|
@@ -259,31 +285,6 @@ function validateHwFwOrProductId(manifest) {
|
|
|
259
285
|
throw new Error('"engines.productId" requires "engines.backend" to be ">=52v007"');
|
|
260
286
|
}
|
|
261
287
|
}
|
|
262
|
-
async function validateApplicationIcon(cwd, fs, manifest) {
|
|
263
|
-
const iconPath = manifest.icon;
|
|
264
|
-
if (!iconPath) {
|
|
265
|
-
throw new Error('App icon is required for publishing an application!');
|
|
266
|
-
}
|
|
267
|
-
const iconUri = vscode_uri_1.Utils.joinPath(cwd, iconPath);
|
|
268
|
-
const iconExist = await fs.stat(iconUri);
|
|
269
|
-
if (!iconExist) {
|
|
270
|
-
throw new Error(`Could not load icon "${iconPath}"`);
|
|
271
|
-
}
|
|
272
|
-
const iconData = await fs.readFile(iconUri);
|
|
273
|
-
const dimensions = (0, image_dimensions_1.imageDimensionsFromData)(iconData);
|
|
274
|
-
if (!dimensions) {
|
|
275
|
-
throw new Error(`App icon could not be validated!`);
|
|
276
|
-
}
|
|
277
|
-
if (dimensions?.width !== dimensions?.height) {
|
|
278
|
-
throw new Error(`App icon has to be a square!`);
|
|
279
|
-
}
|
|
280
|
-
if (dimensions.width > 512 || dimensions.width < 75) {
|
|
281
|
-
throw new Error(`App icon size should be between 75px and 512px!`);
|
|
282
|
-
}
|
|
283
|
-
if (!(0, file_type_checker_1.isPNG)(iconData)) {
|
|
284
|
-
throw new Error(`App icon has to be of type PNG!`);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
288
|
/**
|
|
288
289
|
* Check based on the current env if the given version string is correct
|
|
289
290
|
* @param manifest
|
|
@@ -301,4 +302,30 @@ function validateProjectVersion(manifest, env) {
|
|
|
301
302
|
}
|
|
302
303
|
}
|
|
303
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
|
+
}
|
|
304
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}`;
|
|
@@ -190,7 +199,7 @@ async function buildDDE(cwd, fs) {
|
|
|
190
199
|
console.log(message);
|
|
191
200
|
}
|
|
192
201
|
});
|
|
193
|
-
|
|
202
|
+
throwIfDiagnosticsHaveError(apm_1.APM.Part.dde, result.diagnostics);
|
|
194
203
|
if (result.ddeJSON) {
|
|
195
204
|
await dde_1.DDE.exportMyDatanetXML(cwd, fs, result.ddeJSON);
|
|
196
205
|
await dde_1.DDE.exportHistoryJson(cwd, fs, result.ddeJSON);
|
|
@@ -203,11 +212,17 @@ 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);
|
|
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);
|
|
209
224
|
}
|
|
210
|
-
function
|
|
225
|
+
function throwIfDiagnosticsHaveError(apmPart, diagnostics) {
|
|
211
226
|
diagnostics.forEach(diagnostic => {
|
|
212
227
|
if (diagnostic.level === 'error') {
|
|
213
228
|
throw new Error(`APM part '${apmPart}' has errors. Aborted.`);
|