-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement the packaging of the plugin, embedding the backend server #1
Comments
Update of the issue, please refer to this comment instead of the issue description Recap of the issueWe would provide the plugin to users with a version containing a ready-to-work backend server. While having an external, common backend installed can have some advantages — considering this configuration works properly (notably assuring that the current version of the backend remains supported by the plugin) — it should not be the only alternative. Plugin installation with extracted backendThis is a requirement to be able to run the backend packaged along with the plugin. In fact the export of the plugin is even more simple than that, Eclipse supports two forms of packaging for a plugin:
Then it's just a matter of exporting it properly, and if this export is automated — and it should be — take care of configuring this task the same way. In any case, it should take care of not creating a Then, it depends on how the plugin is distributed. I don't know if the Eclipse update sites (see #16) require a jar version of the plugin, in which case we should configure the site to extract it at installation. How to embed the plugin during export?I don't know yet which technology to choose to automate this — Ant, grunt, ... — so I will focus on the theory.
|
Note that there is already a task in the backlog for the backend to create a build system: ariatemplates/editor-backend#21 |
Please update this comment to develop the final solution instead of concealing it over multiple comments Missing stuff
Final solutionHave files extracted in the plugin installation#16 tells we will have to create a feature, so there is an option to do that. Embed the serverComment above indicates there should be something available from the backend to build it, but for the time being implement the third solution. Solution 3 specificationsRequirements:
Procedure: # 1 ----------
# Create a temp folder, let's say 'temp'
cd temp
# 2 ----------
# Install the backend inside it, with the specified version
npm install https://github.com/ariatemplates/editor-backend#vX.X.X # of course replace with any git hash pointing to the wanted version
#3 ----------
# Build the backend
cd node_modules
cd editor-backend
npm run-script build
# 4 ----------
# Put the final result into the wanted folder: take the files directly, without the wrapping folder ('editor-backend')
# For instance, from the root of the project, inside 'resources/backend'
Of course this (incomplete) script is just to give an idea, it would be better to use an automation tool like grunt.js:
Access the server files during runtime
|
Now the plugin/product is ready to be distributed through an Eclipse Update Site. For that I created both: - an Update Site project: to deliver the product - a Feature project: to put it in the update site (can't put plugins directly) Proper documentation has been added, especially as building the site has some quirks (with the basic tool one can't choose the export folder for instance). Note that the export of the site embeds an instance of the Node.js program. Grunt has also been added (along with npm package definition to do things well) in order to create a cleaning task, especially for the update site which gets generated locally. I also added the main project (Plugin project) files to version control, since it's in fact part of the project configuration and not a user preference. And honestly most people will use Eclipse to work on this project, since PDE (Plugin Development Environment) is easier to use through it. Finally, documentation has been updated, and things cleaned a little. Here are some other technical changes: - the Backend class has been refactored a lot, and a dedicated ProcessRunner class has been introduced (more powerful than the standard one). - added a grunt task to configure automatically the port used by the backend to match the one used in the plugin - changed this port arbitrary to 50000 Implements most of #1 (except maybe a proper interaction with the backend regarding its initialization - like for the port number), and all of #16. closes #16
Now the plugin/product is ready to be distributed through an Eclipse Update Site. For that I created both: - an Update Site project: to deliver the product - a Feature project: to put it in the update site (can't put plugins directly) Proper documentation has been added, especially as building the site has some quirks (with the basic tool one can't choose the export folder for instance). Note that the export of the site embeds an instance of the Node.js program. Grunt has also been added (along with npm package definition to do things well) in order to create a cleaning task, especially for the update site which gets generated locally. I also added the main project (Plugin project) files to version control, since it's in fact part of the project configuration and not a user preference. And honestly most people will use Eclipse to work on this project, since PDE (Plugin Development Environment) is easier to use through it. Finally, documentation has been updated, and things cleaned a little. Here are some other technical changes: - the Backend class has been refactored a lot, and a dedicated ProcessRunner class has been introduced (more powerful than the standard one). - added a grunt task to configure automatically the port used by the backend to match the one used in the plugin - changed this port arbitrary to 50000 Implements most of #1 (except maybe a proper interaction with the backend regarding its initialization - like for the port number), and all of #16. fixes #16 closes #20
The plugin must be able to embed the code of the backend server and to launch and manage an instance of it properly.
For now it's easier for the Eclipse plugin to communicate with an already running backend instance, that is launched externally.
There is still some work to do to enable the plugin to launch a backend packaged with it, especially because it is developed externally.
There are two kinds of environments to consider:
For development, the sources of the server are available, and can be put inside the project. Therefore to launch it ( without hardcoding paths!! ), there is just a need to resolve the relative paths inside the project (i.e. equivalent to programatically find the path of the project).
For production, the problem is different.
First, once installed, the plugin will reside in the Eclipse installation, among every other bundles. The thing would be - as it is for development - to resolve the path of the plugin (but in this case it's not in the context of the project but the one of the Eclipse installation). Have a look at
FileLocator.find
: theBundle
required in this method can be taken from theActivator
class of this project.But then there is a problem due to the fact a plugin is packaged in an archive by default. If the Java system works fine with binaries contained in archives, it is not the case of the externally made server. It relies on a standard file system access.
For that there are two solutions:
NB: to bring files from the backend project into the Eclipse Plugin project without versioning issues, Git Submodules can be used (I think this is more suitable in this case than the alternative solution to handle subprojects that are Subtrees)
The text was updated successfully, but these errors were encountered: