Libraries.json
This is a manifest file containing the direct library references which have been explicitly declared by the developer of the application or library. It is valid in the main directory of an application and in the root directory of a library project. The same library cannot be referenced with two different namespaces within the same Libraries.json file.
The file consists of three sections:
The first section
referencescontains a JSON dictionary whose key is the namespace of the library reference and whose values are objects that describe the details of the reference. The$typemember is used to distinguish between the different reference types.The second section
placeholderOverridescontains a JSON dictionary where the keys are the placeholder names and the values are the library IDs or patterns that override the placeholder.The third section
libraryParameterscontains a JSON dictionary of key/value pairs. The keys of the outer dictionary can contain the following values:A placeholder prepended with a hash sign (
#) to reference the placeholder libraryA
LibraryIdto reference the managed libraryA relative path to reference the library project
The internal dictionaries contain the library parameters as a key and the respective values as a value.
Member | Valid for | Required | Default Value | Description |
|---|---|---|---|---|
| Yes | Type of library reference
| ||
| All |
| If the value is | |
| All |
| If the value is | |
| All |
| If the value is | |
| All |
| If the value is | |
|
| Yes | The path of the library, relative to the location of the current | |
|
| Yes | The library ID of the managed library, whereby the version part can be a pattern. The format of the pattern is defined in section Referencing libraries. | |
|
|
| If the value is If the value is | |
|
| Yes | The placeholder for a referenced library. It is resolved to the library ID via placeholder resolution. | |
|
|
| Optional: If this option is enabled, then all POUs will use this version (or version pattern) of the library. |
{
"references" : {
"TESTEXTERNALS": {
"$type": "RelativePath",
"path": "../../../TestLib.fbslib/",
"optional": true,
"linkAllContent": true
},
"SysTime": {
"$type": "Placeholder",
"placeholder": "SysTime"
},
"Standard": {
"$type": "ManagedLibrary",
"libraryId": "Standard, 3.5.18.0 (System)"
},
"AcmeTools": {
"$type": "ManagedLibrary",
"libraryId": "Acme Tools, 3.5.* (Acme International Inc.)",
"publishSymbolsInContainer": true, // comments and trailing commas are tolerated
},
"WsCompiled": {
"$type": "RelativePath",
"path": "../../../pipeline-assets/Some library.compiled-library",
"noHash": true
}
},
"placeholderOverrides": {
"SysTime" : "SysTime, 3.5.17.0 (System)",
"OtherPlaceholder" : "SomeToolsLib, >=1.2.0 (SomeTools Company)"
},
"libraryParameters": {
"#SysTime": {
"ParamOne": "250",
"ParamTwo": "true"
},
"Acme Tools, 3.5.* (Acme International Inc.)": {
"ParamOne": "125"
},
"../../../TestLib.fbslib/": {
"ParamThree": "125"
}
}
}Referencing libraries
Just like in CODESYS 3, libraries in CODESYS 4 can be referenced via placeholders, exact library IDs, or library IDs with version patterns. Furthermore, source libraries which are available as editable libraries can also be referenced via their relative path to the Libraries.json file,
Version Pattern
Sample Syntax | Description |
|---|---|
1.2.3.4 | Corresponds exactly to the specified version 1.2.3.4 |
1.2.3 | This corresponds exactly to version 1.2.3 or 1.2.3.0. |
* x X | The latest available released version, but no prerelease versions. |
1.2.* 1.2.*.* 1.2.x 1.2.X | The latest released patch level of version 1.2 |
>=1.2.3-alpha.2 | Version 1.2.3 or later, including prerelease versions of 1.2.3 from alpha.2 and higher |
1.0.0 - 2.0.0 1 - 2 >=1.0.0 <=2.0.0 | Matches versions from 1.0.0.0 up to and including 2.0.0.0, but excluding prerelease versions Note: Ranges with "-" require spaces around the operator in order to distinguish them from prerelease indicators: 1.0.0-2.0.0 != 1.0.0 - 2.0.0
|
>=1.2.3 <1.5 | Accepts any version from 1.2.3 and higher, but excluding 1.5 |
>=1.0 | Minimum version 1.0 (including) |
>=1.0 <1.5||>=1.5.1 <2 | All 1.x versions excluding version 1.5.0 |