/metadata-generator

Eclipse Kura™ Metadata Generator

Primary LanguagePythonEclipse Public License 2.0EPL-2.0

Eclipse Kura™ Metadata Generator

This project is a simple tool to generate Eclipse IDE metadata for Kura projects. Its main goal is to provide a simple to use solution to generate the metadata files required by VSCode to provide code completion and validation for Kura projects.

How to use

Installation

To use this tool, you need to have Python 3 installed in your system. You can download it from the official website.

After installing Python, you can download the latest release of this tool from the releases page. Simply install the tool by running the following command:

pip3 install metadata_generator-<version>.whl

Usage

usage: kura-gen [-h] [-d] [--dry-run] [-t TARGET_PLATFORM] [--patch-target-platform]

Kura projects metadata generator

options:
  -h, --help            show this help message and exit
  -d, --debug           Print debug information
  --dry-run             Dry run. Do not write any files to disk
  -t, --target-platform TARGET_PLATFORM
                        Path to the target platform file
  --patch-target-platform
                        Patch the target platform file with the correct paths

Note

The --patch-target-platform option is used to substitute the ${git_work_tree} variable in the target platform file with the path of the git repository root. This is only needed for the Kura repository.

Generating metadata files

To generate the metadata files, you need to change the current working directory to the root directory of your Kura project. You can do this by running the following command:

Important

A successfull maven build is required before running the metadata generator.

cd /path/to/your/kura/project

After changing the working directory, you can run the following command to generate the metadata files:

kura-gen

The tool will generate the following files:

  • javaConfig.json at the root of the project. This config file is used to tell the PDE extension about the locations of the sub projects and target platform file.
  • .project file in each sub project. This file is used by Eclipse to identify the project type and dependencies.
  • .classpath file in each sub project. This file is used by Eclipse to identify the classpath of the project.
  • if the --patch-target-platform option is used the script will also update the target platform file with the correct paths (i.e. substitute the ${git_work_tree} variable with the path of the git repository root).

After generating the metadata files, you can open the project in VSCode and install the required extensions. The following extensions are required to provide code completion and validation for Kura projects:

Example setup

Here follows an example of how to setup a project in VSCode using the metadata generator:

  1. Clone the project repository
git clone https://github.com/my-awesome-kura-project.git && cd my-awesome-kura-project
  1. Build the project
mvn clean install
  1. Generate the metadata files (assuming the kura-gen tool is installed)
kura-gen
  1. Open the project in VSCode
code .
  1. Install the required extensions

  2. ...and you're done!

Development environment setup

Install uv

Take a look at the official documentation here

Run the tool

uv run generator.py

Build the sources and wheels archives

uv build