Skip to content

Commit

Permalink
update: Made IDE compatible with Kraftkit
Browse files Browse the repository at this point in the history
Signed-off-by: sahil <mohdssahil1@gmail.com>
  • Loading branch information
MdSahil-oss committed Aug 18, 2023
1 parent 113f75f commit 5e44e19
Show file tree
Hide file tree
Showing 16 changed files with 940 additions and 673 deletions.
73 changes: 37 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ The Unikraft VSCode Extension extension facilitates the development of Unikraft

The command `Unikraft: Initialize project` from the command palette allows creating a new project in the opened directory. It can create the following project types:

#### Application
<!-- #### Application
An application can either be created from an existing template or it can be a blank one.
An application can have 2 layouts:
- the Unikraft hierarchy will be in `./.unikraft`, whereas the application source code will be in the opened directory;
- the application source code will be in the opened directory, but the Unikraft hierarchy will be in `~/.unikraft`.
- the application source code will be in the opened directory, but the Unikraft hierarchy will be in `~/.unikraft`. -->

#### Library

Expand All @@ -29,18 +29,9 @@ The user has to provide the extension with the following information in order to

The Unikraft hierarchy will be in `./.unikraft`, the library source code will be in `./unikraft/libs/$lib_name`, whereas the application for testing the library will be in the opened directory.

#### Core

The opened directory will be populated with the Unikraft hierarchy:
* archs
* apps
* libs
* plats
* unikraft.

### Project configuration

The command `Unikraft: Configure project` from the command palette allows configuring the project from the `kraft.yaml` file or interactively by opening a terminal with `menuconfig`.
The command `Unikraft: Configure project` from the command palette allows configuring the project interactively by opening a terminal with `menu`.

### Project building

Expand All @@ -55,13 +46,13 @@ If there are multiple images, the user has to choose one of them.
### External dependencies inspection

The `External libraries` view allows inspecting various types of external libraries:
* the ones that are specified in `kraft.yaml` and are also present in the project hierarchy (U icon);
* the ones that are only specified in `kraft.yaml` (red icon);
* the ones that are only present in the project hierarchy (green icon).
* the ones that are specified in `kraft.yaml` and are also present in the project hierarchy (represented with U icon);
* the ones that are only specified in `kraft.yaml` (represented with red icon);
* the ones that are only present in the project hierarchy (represented with green icon).

![libs](https://github.com/unikraft/ide-vscode/blob/prototype/media/libs.gif)

A new library can be added to the project from this view by clicking the `+` button and selecting the library and its version from a drop-down list.
A new library and core can be added to the project from this view by clicking the `+` button and selecting the library and its version from a drop-down list.

A library can either be removed from the project (it will still be stored on disk) or purged by clicking right on it.

Expand All @@ -88,33 +79,45 @@ A `.env` file is created and it contains the path to the Python source code. How
The following packages are required for `kraft`:
```
sudo apt-get install -y --no-install-recommends build-essential \
libncurses-dev libyaml-dev flex git wget bison \
unzip uuid-runtime
libncurses-dev \
libyaml-dev \
flex \
wget \
socat \
bison \
unzip \
uuid-runtime \
python3 \
python3-setuptools \
python3-pip \
qemu-kvm \
qemu-system-x86 \
qemu-system-arm \
sgabios \
curl
```

The package `kraft` is also required:
The CLI `kraft` is also required:
```
pip install git+https://github.com/unikraft/kraft.git
curl --proto '=https' --tlsv1.2 -sSf https://get.kraftkit.sh | sh
```

These are automatically installed if the `.kraftrc` file is not present in the user's home.
These are automatically installed if the `Kraftkit` is not installed on this system.

## Extension Settings

This extension contributes the following settings:

* `unikraft.githubToken`: contains the Github Token used by kraft
* `unikraft.ukWorkdir`: contains the UK_WORKDIR; its value is overridden by `Unikraft initialize`

* `unikraft.paused`: whether to start the unikernel in paused state (default is False)
* `unikraft.debug`: whether to start the unikernel in debug mode (default is False)
* `unikraft.gdb`: whether to attach gdb (default is False)
* `unikraft.gdb_port`: port for gdb (default is 4123)
* `unikraft.bridged`: whether to use a bridge or not (default is False)
* `unikraft.bridge_name`: bridge name (default is virbr0)
* `unikraft.ip4`: IP of the unikernel (default is 172.44.0.2)
* `unikraft.gateway_ip4`: IP of the gateway (default is 172.44.0)
* `unikraft.netmask4`: network mask (default is 255.255.255.0)
* `unikraft.sources`: Sets the environment variable `KRAFTKIT_PATHS_SOURCES` by default set by `~/.config/kraftkit/config.yaml` or ENV `KRAFTKIT_PATHS_SOURCES` that is further used by extension for `kraft` commands.
* `unikraft.manifests`: Sets the environment variable `KRAFTKIT_PATHS_MANIFESTS` by default set by `~/.config/kraftkit/config.yaml` or ENV `KRAFTKIT_PATHS_MANIFESTS` that is further used by extension for `kraft` commands.
* `unikraft.detach`: Whether to run unikernel in background (default is False).
* `unikraft.disableAccel`: Whether to disable acceleration of CPU (usually enables TCG) when running `kraft run` (default is False).
* `unikraft.symbolic`: Whether to use the debuggable (symbolic) unikernel when running `kraft run` (default is False).
* `unikraft.remove`: Whether to automatically remove the unikernel when it shutsdown (default is False).
* `unikraft.ip`: Assign the provided IP address when running `kraft run`.
* `unikraft.memory`: Assign MB memory to the unikernel (default is 64M) when running.
* `unikraft.network`: Attach instance to the provided network in the format `<driver>:<network>` when running `kraft run`.
* `unikraft.ports`: Publish a machine's port(s) to the host (An array of strings e.g ["8080"]) when running `kraft run`.

![helloworld](https://github.com/unikraft/ide-vscode/blob/prototype/media/httpreply.gif)

Expand All @@ -123,11 +126,9 @@ Besides using `settings.json`, these settings can also be edited when clicking C
## Known Issues

* The `External libraries` view is not automatically updated when the following are changed manually:
- `ukWorkdir`;
- `kraft.yaml`;
- `kraft.yaml`.
- the project hierarchy.
* The output of a shell command is not logged until the command exits.
* `Unikraft: Initialize project` sets `UK_WORKDIR` to a directory either from the project structure, or from the home of the user; it currently does not support initializing a project with a different `UK_WORKDIR`.
* Intellisense does not work yet in C for code portions from guarded definitions.
* Intellisense does not work in Python unless at least one build is performed. Moreover, for packages installed after the build, it does not work at all.
* At the moment, Intellisense works by parsing the directory structure and not by parsing `kraft.yaml` and the configuration files.
Expand Down
125 changes: 56 additions & 69 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "unikraft-ide-vscode",
"displayName": "Unikraft VSCode Extension",
"description": "Seamlessly build and manage Unikraft components from within VSCode!",
"description": "Seamlessly build and manage Unikraft components from within VSCode!",
"version": "0.1.1",
"publisher": "unikraft",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/unikraft/ide-vscode.git"
},
"homepage": "https://github.com/unikraft/ide-vscode/main/README.md",
"homepage": "https://github.com/unikraft/ide-vscode/main/README.md",
"engines": {
"vscode": "^1.59.0"
},
Expand All @@ -23,77 +23,67 @@
"activationEvents": [
"onView:externalLibraries"
],
"icon": "media/unikraft-logo.png",
"galleryBanner": {
"color": "#0E2F5F",
"theme": "dark"
},
"icon": "media/unikraft-logo.png",
"galleryBanner": {
"color": "#0E2F5F",
"theme": "dark"
},
"main": "./out/extension.js",
"contributes": {
"configuration": {
"type": "object",
"title": "Unikraft",
"properties": {
"unikraft.githubToken": {
"unikraft.sources": {
"type": "string",
"default": "",
"description": "Specifies the Github Token used by kraft."
"description": "Specifies the directory where all the packages are stored, By default it is set by environment variable KRAFTKIT_PATHS_SOURCES or file `$HOME/.config/kraftkit/config.yaml`."
},
"unikraft.ukWorkdir": {
"unikraft.manifests": {
"type": "string",
"default": "",
"description": "Specifies UK_WORKDIR."
"description": "Specifies the directory where all the manifests are stored, By default it is set by environment variable KRAFTKIT_PATHS_MANIFESTS or file `$HOME/.config/kraftkit/config.yaml`."
},
"unikraft.detach": {
"type": "boolean",
"default": false,
"description": "Whether to run unikernel in background"
},
"unikraft.disableAccel": {
"type": "boolean",
"default": false,
"description": "Whether to disable acceleration of CPU (usually enables TCG)"
},
"unikraft.paused": {
"type": "boolean",
"default": false,
"description": "Whether to start the unikernel in paused state."
},
"unikraft.debug": {
"type": "boolean",
"default": false,
"description": "Whether to start the unikernel in debug mode."
},
"unikraft.gdb": {
"type": "boolean",
"default": false,
"description": "Whether to attach gdb."
},
"unikraft.gdb_port": {
"type": "number",
"default": 4123,
"description": "Port for gdb."
},
"unikraft.create_bridge": {
"type": "boolean",
"default": false,
"description": "Whether to create a new bridge."
},
"unikraft.bridged": {
"type": "boolean",
"default": false,
"description": "Whether to use a bridge or not."
},
"unikraft.bridge_name": {
"type": "string",
"default": "virbr0",
"description": "Bridge name."
},
"unikraft.ip4": {
"type": "string",
"default": "172.44.0.2",
"description": "IP of the unikernel."
},
"unikraft.gateway_ip4": {
"type": "string",
"default": "172.44.0.1",
"description": "IP of the gateway."
},
"unikraft.netmask4": {
"type": "string",
"default": "255.255.255.0",
"description": "Network mask."
}
"unikraft.symbolic": {
"type": "boolean",
"default": false,
"description": "Whether to use the debuggable (symbolic) unikernel"
},
"unikraft.remove": {
"type": "boolean",
"default": false,
"description": "Whether to automatically remove the unikernel when it shutsdown"
},
"unikraft.ip": {
"type": "string",
"default": "",
"description": "Assign the provided IP address"
},
"unikraft.memory": {
"type": "string",
"default": "64M",
"description": "Assign MB memory to the unikernel"
},
"unikraft.network": {
"type": "string",
"default": "",
"description": "Attach instance to the provided network in the format <driver>:<network>"
},
"unikraft.ports": {
"type": "array",
"default": [],
"description": "Publish a machine's port(s) to the host"
}
}
},
"viewsContainers": {
Expand Down Expand Up @@ -165,11 +155,6 @@
"title": "Update",
"category": "Unikraft"
},
{
"command": "unikraft.editToken",
"title": "Edit the Github token",
"category": "Unikraft"
},
{
"command": "externalLibraries.addLibrary",
"title": "Add library",
Expand Down Expand Up @@ -208,9 +193,6 @@
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js"
},
"dependencies": {
"js-yaml": "^4.0.0"
},
"devDependencies": {
"@types/glob": "^7.1.3",
"@types/mocha": "^8.2.2",
Expand All @@ -224,5 +206,10 @@
"typescript": "^4.3.2",
"vscode-test": "^1.5.2",
"winston": "^3.3.3"
},
"dependencies": {
"command-exists": "^1.2.9",
"js-yaml": "^4.1.0",
"yaml": "^2.3.1"
}
}
File renamed without changes
File renamed without changes
Loading

0 comments on commit 5e44e19

Please sign in to comment.