Skip to content

Instantly share code, notes, and snippets.

@fahad-israr
Last active September 12, 2020 15:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fahad-israr/7e246013ebfc858d8af05fe21e38d715 to your computer and use it in GitHub Desktop.
Save fahad-israr/7e246013ebfc858d8af05fe21e38d715 to your computer and use it in GitHub Desktop.
A Summary of My GSoC'2020 Project StarFix working under Redhat.

GSoC


Project Summary @GSoC'20

StarFix: Simplifying The Devflow

@Fahad Israr(the developer,that’s me)

@Max Rydahl Andersen(the mentor,#this_guy_is_awesome)

@RedHat (JBoss)(the organization)


About GSoC

GSoC is more than just an open source program. It gives wings to your ideas and let you bring them to reality. It’s focussed around ideation and innovation. You’ve found a real life problem and want to solve it?GSoC is the best place to make it happen OR you’ve got ideas to improve the existing technologies? Simply propose your ideas,convince the organizations that you can make it happen and then get yourselves funded by Google and mentored by the most esteemed organizations of this world. Yeah thats one of the best parts of GSoC other being the exposure you receive while working with such experienced and senior developers.(Offcourse the handsome stipend you receive is an awesome part as well).

The Awesome Mentor

I never even dreamt of being mentored by a Distinguished Engineer at Redhat. And the way he mentored me was more than I ever expected. As an undergrad I was quite a newbie to Software Developement(I knew some but here I felt like a noob) and little did I know about SDLC. But Max never let that thing affect my performance and output. To bridge the gap he regularly gave me appropriate examples to refer and resources to go through. There were things I didn’t ever know before but I learnt them and implemented them in a very short period of time(I had never ever setup CI/CD from scratch before, nor I ever wrote Units Test in JUNIT5). Apart from being very friendly he is also flexible, highly intellectual and open minded. He always gave space for my thoughts and ideas,and was always open to discussion on the choice of technology and methodology I should proceeed with, thus helping me clear even the smallest of my doubts.

TL;DR? Max is supercool and just Awesome.

Learn more about him: @maxandersen



Intro

Would it not be nice if..

You could open your IDE on any file from any app?

OR

Open a repository/file from a browser in your editor of choice?

OR

Start a debugger locally from your web browser?

StarFix is a cross-platform client-side application that would let you open a file in Editor of your choice (vscode, eclipse, intellij, emacs, vi, etc.) and other commands locally directly from the browser or file system. This will enable an option to “Open in IDE” through browser extension on various websites like Github, Gitlab, etc similar to the one you see in this demo below.


Starfish Demo





“Open in Desktop” on Github offers a feature to open the repository in Github Desktop. Its issue is that it is Tied to one vendor and locked to a single tool. StarFix on other hand overcomes all those limitations and offers you to open up the repository in the Editor of your choice directly from the Browser on multiple sites(Github,Gitlab).



Approach

Native Executable with Quarkus

The StarFix Native Binary is built as a native executable with Quarkus. The reason for going with this is that anything other than this(like node or python bound)would require additional setup. On other hand Java or Native is something that can be shipped fairly lightweight. Furthermore we need a cross-platform application(Linux,Windows and MacOS). Thus Quarkus was the best choice.

User Configurations

StarFix uses a .yaml file to store user configurations. Currently it stores the preferred editor/ide and the preferred cloning path.

Custom Protocol Handler

The operating system has to be informed how to handle protocols. By default, all of the current operating systems know that http should be handled by the default web browser, and mailto should be handled by the default mail client. Sometimes when applications are installed, they register with the OS and tell it to launch the applications for a specific protocol.We wanted to set up a type of link where if a user clicks on it, it will launch the StarFix application. Instead of having http as the prefix, we need to designate a custom protocol, such as ‘ide’. Ideally we wanted a link that looks like: ide://some/info/here. StarFix includes a custom URL Handler to handle ide:// on the user’s machine. Whenever a URI with scheme ide:// is encountered StarFix app is launched with arguement as the URI. As we have three target Operating Systems we had to adapt different methodology for each one of them. On Windows we have achieved that by modifying the Windows Registry. On Linux this has been achieved by using a .desktop file . For macOS we’ve created a .app bundle that is configured to launch our application.

Browser Extension

To be able to add an "Open In IDE" button on Web Pages and launching the protocol handler we needed a browser extension. The extension also acts as the integration between web and desktop.The extension has been written with plain HTML/CSS/JS and supports loading unpacked. It’d soon be published on the webstore making it easier to install for the users.

CLI Tool

Starfix is as much a Command Line tool as much an Integrated app. To make the command starfix ..arguments.. work on the commandline there are differnt methodologies that have been adopted.On Linux and macOS the native executable is moved to /use/local/bin and being made an excutable it starts working as a CLI. On Windows, the file is moved to a suitable directory in user’s home and then this location is added to the environment variable: path.

Testing

As Quarkus supports JUIT5, we’ve used it for our unit testing

Packaging and Installation

Maven Assembly has been used for packaging. OS specific installers are generated which mainly include the script files that put the binary in place, register the protcol handler and modify system paths.

CI/CD

Github actions has been used for CI/CD. The reason for choosing it is that it’s the simplest and most convenient tool as it comes Integrated with Github and also provide the necessary features. The workflow are configured to trigger build on Pull Requests and Pushing to the master. The necessary artifacts are generated along with it. Creation of draft release on pushing with tags is configured. And Offcourse,on creating releases the workflow are setup to build and generate the the packages for distribution.



Merged Pull Requests

  • Added Starfish Description

  • Workflow

  • Necessary Utilities

  • Targeted Websites

  • Target Platform

  • Technology for Development

  • Core Starfix (The CLI) was built.

  • Using Fast Jackson for modifying .yaml file.

  • Tested the native binary to run with arguments successfully

  • Squashed and meregd by the @maxandersen.

  • Implements CI with Github Actions for [Starfish Project](https://github.com/maxandersen/starfish/)

  • Runs on all three platforms (Linux,Windows and MacOS)

  • Separate jobs defined for Release and Push/PR.

  • Jobs:

    • Installs graalvm and native image

    • Sets version as tag_name(in case of release) and sha (incase of a Push or PR )

    • Builds native executable

    • Uploads native executable as assets(in case of Release) and generates artifacts(incase of a Push or PR)

  • Launching ide on windows(incase of Vscode) had an issue on windows as it needed .cmd extension to launch.

  • Now we have made a separate function that checks if the os is windows.

  • Based on that decision we add or don’t add .cmd (in case of vscode).

  • Added tests for urlValidator() and runCommand() function .

  • Protocol handler for Linux and Windows added

  • Handles ide://.. scheme and launches up the StarFix application on encountering such scheme.

  • Added quick commands for running the project

  • Added reference to command mode in Quarkus

  • moved mvn/quarkus project to cli folder

  • updated github workflows

  • setup workflow that on git tag v* (i.e. git tag v0.0.1) builds and creates a draft release.

  • Issue: #22

  • Support for SSH added: User can choose between which Protocol to use (HTTPS or SSH) by selecting in the extension Pop-up: starfish_extension

  • Added Relevant Description and a temporary Icon

  • Help and Troubleshooting: Added Link to HELP Page which will assist user with features and usage of Starfish along with Troubleshooting

  • Renamed Starfish → Starfix

  • Windows Installer improved

  • Tested to run on Ubuntu-20 and Windows-10

  • Used the README.adoc on project source directory for Documentations.

  • Added Demos,Table of Content, Contribution guide along with other parts of user docs.

  • moved starfix.cmd to Starfix sub-directory which would then be moved to the user’s home directory.

  • renamed Starfix→starfix

  • Tested to work on win-64


DEMO

As a CLI Tool

CLI


Fully Integrated

Starfix



Configuration Editor

Config





Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment