When creating an application, one of the most difficult aspects is choosing a language/framework that will meet all requirements. The VT Anywhere team has learned this first hand, hence the title of the application VT Anywhere. VT Anywhere is split into two parts: User interface and Server. The languages of choice are JavaScript and Rust respectively.
Programming Languages
The choice to use JavaScript was a simple one; JavaScript works anywhere a browser is able to run. This can be practically any mobile device. This gives the capability to have the user interface run anywhere – iOS and Android devices, along with any general purpose computer. Rust is the more interesting choice of the two. Rust can be cross compiled to just about any architecture imaginable; click here to see a comprehensive list. This made the choice of Rust for the server a no-brainer.
Development and Testing
While it’s easy to cross compile Rust for different architectures, there are no guarantees that changes made to source code produce the correct result. This is where Windows Subsystem for Linux (WSL) comes in handy. WSL is a compatibility layer that translates system calls of Linux programs into the Windows equivalent. It is a native Windows alternative to programs such as Cygwin. This feature has been included in Windows 10 since the Fall Creators update in 2017, it just has to be enabled. Click here for instructions on how to enable WSL. There has also been a recent update to the WSL ecosystem – Windows 10 version 2004 or higher has the ability to enable WSL2. There is only one difference between WSL and WSL2, which is the compatibility layer is replaced with an actual Linux Kernel!
Now the Linux version of VT Anywhere can run on the same machine as the development environment without the need of a virtual machine! This aides in much faster development and testing because there is no need to move files between machines.
Application Packaging
Most applications are installed with a one click executable, but this process is slightly different depending on what operating system is running the application. VT Anywhere offers two different versions, a server version, and a standalone all-in-one application. When it comes to the server version, cross platform compatibility is not a big issue since it is invoked on the command line.
The all-in-one application requires more thought. VT Anywhere uses two JavaScript packages, Electron and Electron-builder, to consolidate the user interface and server into one easy to install package.
While electron-builder will do most of the work for packaging applications for different operating systems, there are a few extra steps. Debian Linux targets require a .postinst and .postrm scripts to set file permissions and file cleanup when installing and removing Debian packages. This is an extra step to consider compared to the Windows equivalent NSIS.
While creating an application that will run on anything is a daunting task, there are plenty of free and open source tools that can help set you up for success.