xpipe-mirror/CONTRIBUTING.md
2023-10-05 11:53:52 +00:00

6.6 KiB

Development

Any contribution is welcomed! There are no real formal contribution guidelines right now, they will maybe come later.

Repository Structure

  • core - Shared core classes of the XPipe Java API, XPipe extensions, and the XPipe daemon implementation. This mainly concerns API classes not a lot of implementation.
  • beacon - The XPipe beacon component is responsible for handling all communications between the XPipe daemon and the client applications, for example APIs and the CLI
  • app - Contains the XPipe daemon implementation, the XPipe desktop application, and an API to create all different kinds of extensions for the XPipe platform
  • dist - Tools to create a distributable package of XPipe
  • ext - Available XPipe extensions. Essentially every concrete feature implementation is implemented as an extension

Modularity

All XPipe components target Java 21 and make full use of the Java Module System (JPMS). All components are modularized, including all their dependencies. In case a dependency is (sadly) not modularized yet, module information is manually added using moditect. Further, note that as this is a pretty complicated Java project that fully utilizes modularity, many IDEs still have problems building this project properly.

For example, you can't build this project in eclipse or vscode as it will complain about missing modules. The tested and recommended IDE is IntelliJ. When setting up the project in IntelliJ, make sure that the correct JDK (Java 20) is selected both for the project and for gradle itself.

Setup

You need to have an up-to-date version of XPipe installed on your local system in order to properly run XPipe in a development environment. This is due to the fact that some components are only included in the release version and not in this repository. XPipe is able to automatically detect your local installation and fetch the required components from it when it is run in a development environment.

You need to have GraalVM Community Edition for Java 21 installed as a JDK to compile the project. If you are on Linux or macOS, you can easily accomplish that by running the setup.sh script. On Windows, you have to manually install the JDK.

Building and Running

You can use the gradle wrapper to build and run the project:

  • gradlew app:run will run the desktop application. You can set various useful properties in app/build.gradle
  • gradlew dist will create a distributable production version in dist/build/dist/base.
  • gradlew <project>:test will run the tests of the specified project.

You are also able to properly debug the built production application through two different methods:

  • The dist/build/dist/base/app/scripts/xpiped_debug script will launch the application in debug mode and with a console attached to it
  • The dist/build/dist/base/app/scripts/xpiped_debug_attach script attaches a debugger with the help of AttachMe. Just make sure that the attachme process is running within IntelliJ, and the debugger should launch automatically once you start up the application.

Note that when any unit test is run using a debugger, the XPipe daemon process that is started will also attempt to connect to that debugger through AttachMe as well.

Contributing guide

Especially when starting out, it might be a good idea to start with easy tasks first. Here's a selection of suitable common tasks that are very easy to implement:

Implementing support for a new editor

All code for handling external editors can be found here. There you will find plenty of working examples that you can use as a base for your own implementation.

Implementing support for a new terminal

All code for handling external terminals can be found here. There you will find plenty of working examples that you can use as a base for your own implementation.

Adding more file icons for specific types

You can register file types here and add the respective icons here.

The existing file list and icons are taken from the vscode-icons project. Due to limitations in the file definition list compatibility, some file types might not be listed by their proper extension and are therefore not being applied correctly even though the images and definitions exist already.

Adding more context menu actions in the file browser

In case you want to implement your own actions for certain file types in the file browser, you can easily do so. You can find most existing actions here to get some inspiration. Once you created your custom classes, you have to register them in your module info, just like here.

Implementing custom actions for the connection hub

All actions that you can perform for certain connections in the connection overview tab are implemented using an Action API. You can find a sample implementation here and many common action implementations here.

Familiarising yourself with the shell and command API

The sample action shows the basics of working with shells and executing commands in them. For more references, just look for the usages of the API classes.

Implementing something else

if you want to work on something that was not listed here, you can still do so of course. You can reach out on the Discord server to discuss any development plans and get you started.