Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Add devfile and doc for developing of Che Theia remote plugin mechanism
Browse files Browse the repository at this point in the history
Signed-off-by: Mykola Morhun <[email protected]>
  • Loading branch information
mmorhun committed Sep 2, 2019
1 parent a72bdb8 commit ffb7258
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 27 deletions.
44 changes: 42 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
Contribute to Che-Theia
================

Table of content
- [Introduction](#Introduction)
- [Devfiles](#Devfiles)
- [Step 1: Start the workspace](#Step-1_-Start-the-workspace)
- [Step 2: Decorate Theia with Che-theia extensions: che-theia init](#Step-2--Decorate-Theia-with-Che-theia-extensions--che-theia-init)
- [Step 3: Code che-theia extensions](#Step-3--Code-che-theia-extensions)
- [Step 4: Compile Che-Theia](#Step-4--Compile-Che-Theia)
- [Step 5: Code che-theia plugins](#Step-5--Code-che-theia-plugins)
- [Step 6: Compile your plugin](#Step-6--Compile-your-plugin)
- [Step 7: Run che-theia + plugin](#Step-7--Run-che-theia-+-plugin)
- [Step 7bis: Run che-theia + plugin in dev mode](#Step-7bis--Run-che-theia-+-plugin-in-dev-mode)
- [Just want to build the plugin and run with the existing Theia image](#Just-want-to-build-the-plugin-and-run-with-the-existing-Theia-image)
- [Contributing to other parts of Che Theia](#Contributing-to-other-parts-of-Che-Theia)
- [How to develop Che Theia remote plugin mechanism](#How-to-develop-Che-Theia-remote-plugin-mechanism)

## Introduction

There are 3 contribution points:
- Theia
- Che-Theia extensions
Expand Down Expand Up @@ -129,10 +146,33 @@ To start che-theia in `dev-mode` with yarn (not using the production che-theia g
Running dev theia would be located in the che-dev container and `theia-dev-flow` endpoint:
![Che-Theia-dev-endpoint](https://raw.githubusercontent.com/eclipse/che-theia/assets/theia-dev-flow-endpoint.png)



### Just want to build the plugin and run with the existing Theia image
If you do not have any changes on Theia or Che-theia extension, you could just build the plugins with `build ... containers-plugin` or `build ... factory-plugin`
and run these plugins with the existing che-theia app:
`run ... HOSTED che-theia + container-plugin` or `run ... HOSTED che-theia + factory-plugin`

## Contributing to other parts of Che Theia

### How to develop Che Theia remote plugin mechanism

_Please note, this section provides a flow how to develop remote plugin mechanism in Che Theia, but not a remote plugin._

First, create a workspace from prepared [devfile](https://github.com/eclipse/che-theia/blob/master/extensions/eclipse-che-theia-plugin-remote/devfile.yaml), which could be found in the `eclipse-che-theia-plugin-remote` extension folder.
When workspace is ready:
- Init Che Theia. This could be done with `che:theia init` command in `/projects/theia` folder or run the init command.
Che Theia sources will be awailable at `/projects/theia/che/che-theia`.
- Now one may make changes in Che Theia remote plugin mechanism in both (Che Theia and Remote plugin) sides.
- Build Che Theia from `theia-dev` container by executing `yarn` in `/projects/theia` folder or by running corresponding command.
- Put your remote plugin(s) into `/projects/remote-plugins/` directory.
Note that the plugin(s) shouldn't have any external dependencies.
For example, [this sample plugin](https://github.com/eclipse/che-theia-samples/tree/master/samples/hello-world-backend-plugin) might be used.
- Run dev Che Theia and Remote plugins endpoint in `theia-dev` and `theia-remote-runtime-dev` containers correspondingly.
One may use predefined commands to start them.
- Open `theia-dev` route from `My Workspace` panel and test chenges.

Also it is possible to run watchers for remote plugin mechanism.
In `theia-dev` container run `npx run watch @eclipse-che/theia-remote` from `/projects/theia` folder to recompile the extension on changes made.
Also run `yarn watch` in `/projects/theia/examples/assembly` to bring the changes to Che Theia binaries.
If needed one may start watchers in plugin API extension: `npx run watch @theia/plugin-ext` from `/projects/theia` directory.
The commands for these actions are also available.
But please note, you have to restart server to which changes is made.
21 changes: 0 additions & 21 deletions extensions/eclipse-che-theia-plugin-remote/README.md

This file was deleted.

22 changes: 18 additions & 4 deletions extensions/eclipse-che-theia-plugin-remote/devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ components:
id: eclipse/che-machine-exec-plugin/next
- type: chePlugin
id: che-incubator/typescript/latest
memoryLimit: 2Gi
- type: dockerimage
image: eclipse/che-theia-dev:next
alias: theia-dev
Expand All @@ -37,25 +38,38 @@ commands:
actions:
- type: exec
component: theia-dev
command: che:theia init
command: 'che:theia init'
workdir: /projects/theia
- name: Clean Che Theia
actions:
- type: exec
component: theia-dev
command: che:theia clean
command: 'che:theia clean'
workdir: /projects/theia
- name: Build Che Theia
actions:
- type: exec
component: theia-dev
command: yarn
command: 'yarn'
workdir: /projects/theia
- name: Watch changes in Theia Remote Extension
actions:
- type: exec
component: theia-dev
command: 'cd /projects/theia && npx run watch @eclipse-che/theia-remote & cd /projects/theia/examples/assembly && yarn watch'
command: 'npx run watch @eclipse-che/theia-remote'
workdir: /projects/theia
- name: Watch changes in Theia Plugin API Extension
actions:
- type: exec
component: theia-dev
command: 'npx run watch @theia/plugin-ext'
workdir: /projects/theia
- name: Watch changes in Theia assembly
actions:
- type: exec
component: theia-dev
command: 'yarn watch'
workdir: /projects/theia/examples/assembly
- name: Run Dev Theia
actions:
- type: exec
Expand Down

0 comments on commit ffb7258

Please sign in to comment.