Skip to main content

Library Repository

When CODESYS 4 is installed, a variety of extensions are also installed with it. Each extension can contain a library repository. These library repositories are automatically active and available. They do not need to be entered into the LibraryRepositories.prefs.json file.

Creating your own library repositories

In CODESYS 4, you can create any number of your own library repositories. 

Custom repositories are configured in the LibraryRepositories.prefs.json file. On Linux, this file is located at ~/.config/CODESYS-4/LibraryRepositories.prefs.json. On Windows, this file is located at %APPDATA%\CODESYS-4\LibraryRepositories.prefs.json. The format of the repository configuration is defined by the deployment server.

Example 8. Example of LibraryRepositories.prefs.json
{
  "storages": [
    {
      "name": "LocalStorage",
      "kind": "FileSystem",
      "rootDirectory": "D:\\GoLibRepo"
    }
  ],
  "c4LibraryRepositories": [
    { "name": "LocalRepository",
      "isPublic": true,
      "kind": "Local",
      "storage": "LocalStorage"
    }
  ]
}


For more information, see the following: Libraries.json and Resolve Libraries, Resolve All Libraries

Libraries – Storage format on hard drive

Library repositories are managed via the infrastructure of the deployment server, whereby the local storage module is used for local repositories. The format on the hard drive is therefore canonically defined by the deployment server, but it is simple and is reproduced here for the sake of completeness.

The folder hierarchy within the repository is structured according as follows: Company/Title/Version/FileName.Suffix

Company

The Company entry from the project information

  • Leading and trailing spaces are removed.

  • The separators , (, and ) are not allowed.

  • Some special characters, including control characters, are encoded using object model encoding.

    Certain special characters – especially non-printable control characters – are not stored directly, but are represented by a special string of the object model.

Title

The Title entry from the project information

  • Leading and trailing spaces are removed.

  • The separators , (, and ) are not allowed.

  • Some special characters, including control characters, are encoded using object model encoding.

Version

The Version entry from the project information

  • This must be a valid 4-part semver.

  • Prerelease designations are part of the version. This is not build metadata because it is not part of the identity.

  • The fourth numerical part of the version is only written if it is not 0.

FileName

Identical to Title

Suffix

One of the 4 allowed suffixes:

  • .compiled-library

  • .compiled-library-ge33

  • .compiled-library-v3

  • .fbslibpack

This format allows for easy location of a specific library as well as browsing of all available versions of a library without index files.

Easy configuration

In the localRepositories section, you specify a local repository as a "Name": "Path" pair. When starting for the first time, a repository named Default will be created.

Example 9. Example of the localRepositories section
{  
    "localRepositories": {
        "AllLibs": "D:\\C4LibRepo",
        "Default": "C:\\Users\\h.mustermann\\AppData\\Local\\CODESYS-4\\managed-libraries"
    }
}
...


Overlay and suppression

The user-specific level inherits the definitions of the system-wide layer and the extensions. You use this options service to overlay these definitions.

  • Inherit: Unless otherwise specified, the inherited definitions remain unchanged.

  • Extend: A section name preceded by + extends the inherited list instead of replacing it, for example "+storages".

  • Suppress: The value null without quotation marks suppresses an inherited definition. This is how you disable an inherited repository or the Default repository.

Example 10. Example 
{  
    "localRepositories": {
        "AllLibs": "/home/mustermann/allLibs",    
        "_Extension_ExampleExtension_1.2.3.4": null  
    }
}
...

In the example, the AllLibs repository is defined and the libraries provided by the ExampleExtension extension in version 1.2.3.4 are suppressed.



For more information, see the following: Restore and Library Cache and Resolving Library Dependencies