Task Entry Point
Introduction
To demonstrate the process of Extension development, a sample Extension will be created and deployed using Visual Studio Code with the UIP Visual Studio Code Extension. The UIP Visual Studio Code Extension relies heavily on functionality provided by the uip-cli
tool to enhance the UIP development experience. Therefore, a similar experience can be achieved with other code editors using uip-cli manually. This alternative use scenario will be documented as well.
The functionality of this sample Extension is contrived and serves no real purpose other than to illustrate the process of developing an extension that supports and utilizes all features available. The sample Extension, however, can be a good starting point for creating more complex Extensions.
On this page, we will cover the following:
- Introduce the UIP Visual Studio Code Extension and
uip-cli
that will be used to create and configure the sample Extension. - Deploy the initial Extension without any changes and review the output.
- Modify the sample Extension.
- Deploy the modified Extension to the Controller and review the output.
Note that it is assumed the latest version 2.0.0 of UIP Visual Studio Code Extension and uip-cli
are already installed. See the previous document for installation instructions.
Step 1 - Create a New Extension Project using the UIP VS Code Extension
As mentioned in Development Environment Set-Up, this tutorial will be using Visual Studio Code running in Windows and connected to a WSL (Windows Subsystem for Linux) project environment.
Initializing a new UIP project is a multi-step process.
Select a folder for VS Code to open for the new UIP project.
Select a starter template for the UIP project.
Iterate over the template parameters.
To begin, create a project directory (for example, ~/dev/extensions/sample-task) in the WSL file system where the Universal Extension will be created.
Select project folder
Next, Use Visual Studio Code to open the sample-task folder in WSL:
- Open the Remote Window command pallet.
- Select "Open Folder in WSL...".
In the resulting dialog, navigate to the sample-task folder and click on Select Folder:
Selecting starter template
Now that VS Code is in the WSL environment, navigate to the activity bar on the left hand size and click the Stonebranch logo.
This will expand the menu and you should see a list of all the available extension templates. Go ahead and click the icon shown below to initialize the ue-task template:
Setting template parameter values for selected starter template
A few seconds after clicking the icon shown above, a sequence of input boxes will shown up containing the parameters for the ue-task starter template. The parameters allow you to supply project specific values into boilerplate template code at creation time.
For this tutorial, all parameters are suitable so, just pressing 'Enter' to select the default for each parameter would be sufficient. However, in the series of images below, the 'Extension Owner' parameter was modified to use a value of "SampleOwner" (step 6/8). Notice that the dialog title will update to indicate which step you are on and how many steps are left to complete the dialog - (2/8), (3/8), (4/8), etc..
After hitting enter on the last parameter:
A notification pops up to indicate the new project has been created.
The new project is created
The uip.yml project configuration file is opened in an editor.
The generated extension.py source file is opened in an editor.
When the “UIP: Initialize New Project” command completes, a project will be initialized in the selected folder with the following structure:
|-- sample-task # Sample project directory |--setup.py # Setup file for packaging extension |--setup.cfg # Configuration file for configuring setup |--__init__.py | |--.uip # Folder used by CLI to validate directory | |--config # Configuration File Folder | |--uip.yml # Local Configuration File | |--src # Source directory for Extension implementation |--extension.py # Extension implementation |--extension.yml # Extension metadata |--__init__.py | |--templates |--template.json # Universal Template JSON Definition File
At this point, the project is fully initialized.