Project Templates in the DVT Eclipse IDE - How to Create Templates
Overview
This video shows how to create a Project Template from which you can generate entire projects, including the directory layout, the skeleton of your source code, configuration files, run scripts and so on.
Explore the design and verification tools: https://www.dvteclipse.com
Or request a license: https://www.dvteclipse.com/request-license
Details
Introduction
When you start working on a new design or verification component, DVT can easily generate your entire project structure from a template, including the directory layout, the skeleton of your source code, configuration files, run scripts, and so on. This approach helps you enforce methodology from the very beginning, minimizes project bring-up time, and scales in time as you can later on generate more copies of sub-components of the original template.
A Project Template is basically a parameterized file system tree. Parameters are words surrounded by double underscores (e.g., __parameter__
), and they will be substituted with user input values at template generation time, in the content of all text files, like source code, scripts, configuration files and in file or directory names. You can also use x_
and _x
to delineate parameters. Predefined parameters like __user__
for the username and __date__
for the project generation date are also available.
Since parameters are legal code identifiers, you can compile the template code and use all DVT features while building the template, for example:
- Errors reported as you type
- Quick fixes
- Hyperlinks and views to navigate the template code
- Advanced editing such as context-sensitive Autocomplete and Refactoring
Note: A good practice is to mark the sections of code that should be filled in or modified after generation using Task Tags embedded in comments.
Note: Optionally, you can create a template config file in the template directory in order to specify default values and detailed descriptions for specific parameters.
Generating a Project from the Template
In order to generate a project from the template, point the File -> New -> DVT Project from Template to the template location, then follow the wizard steps.
Predefined Templates and Contributing Your Own
Some predefined templates are built into DVT. For quick access, you can contribute your own templates to this list. Simply point an environment variable starting with DVT_PREDEFINED_PROJECTS_EXT to the directory containing templates. Note that the templates shared this way require the presence of a template config file.