Build NativeScript Apps Remotely from Windows or Linux


Have you ever wondered how to:

  • build NativeScript apps for iOS, on Windows or Linux?
  • setup a stable CI for your NativeScript apps?
  • avoid iOS code signing management?

If so, the NativeScript Remote Builds Plugin is just for you! 🚀

How does it work?

The plugin uses several NativeScript CLI hooks and modifies its behavior by:

  • Skipping the local native tooling[1] requirements.
  • Skipping the native resources handling during the CLI prepare phase - they will be handled remotely.
  • Replacing the CLI local build with the build method of the selected remote.

At the time of writing, the plugin supports a Circle CI remote build.

The rest of the CLI logic works as usual, for example, the tns debug command prepares the JavaScript files, uploading to the connected devices, showing logs, opening debug sockets, showing a URL for debugging and so on.

The video below demonstrates how to run a NativeScript app on iOS from a Windows machine:


Why did we choose Circle CI?

Implementing a remote requires a few methods - mainly handling environment variables and downloading the build result. Circle CI has a simple API for these operations and offers a good number of free Linux and macOS machines for open-source projects.

However, the plugin abstractions don't depend on Circle CI and implementing a new remote should take just a few days. For example, we already have initial POC remotes with another cloud solution - Travis CI and local ssh connections to a macOS machine in the same network. Feel free to open feature requests and even pull requests for implementing new remotes in the plugin GitHub repository.

How does it differ from the NativeScript CLI Cloud extension?

Let's compare the cloud builds that are part of the NativeScript Cloud extension and this NativeScript Remote Builds plugin, as they look similar.

The main differences come from the fact that the NativeScript Remote Builds plugin enables the existing NativeScript CLI commands on environments without any native tooling[1] requirements instead of providing additional commands like the tns cloud ones. The Remote Builds plugin is also designed to be stable and reliable in a CI environement.

Here's a comparison table between the NativeScript Cloud Extension and the NativeScript Remote Builds plugin:

Cloud Extension Remote Builds Plugin
Build, Run and Publish without native tooling[1]
Debug without native tooling[1]     [2]
Run Unit Tests without native tooling[1]
Automatic iOS Signing Management[3]
Full CI Support[4]
Full Environment Information[5]
Full Environment Control[6]
Just the default NativeScript CLI commands
Free     [7]     [8]

The comparison is based on the CircleCI remote of the NativeScript Remote Builds Plugin

native tooling[1]
Any native environment requirements like Java, Android SDK, Android Studio, macOS, Xcode, Cocoapods, Docker and so on.
cloud extension debug support[2]
It is available only through NativeScript Sidekick.
iOS signing management[3]
If the end-user is responsible for passing the `--provision` flag and picking the proper certificate based on the current build configuration. In the Remote Builds plugin, this is handled out of the box by the Fastlane Match service.
full CI support[4]
If the user can build and run tests on pull requests or commits. In other words, if it is supported to build multiple versions of the same app in parallel.
full environment information[5]
If the full environment information is available to the users (e.g. the versions of the OS and the native tooling[1].
full environment control[6]
If the environment setup can be controlled by the user (e.g. change the versions of the os and the native tooling[1].
cloud extension price[7]
The NativeScript Cloud extensions is providing a limited number of free builds.
remote builds plugin price[8]
The Circle CI provider of the NativeScript Remote Builds plugin is just depending on the Circle CI pricing. It provides a limited number of free Android Builds for everyone and a limited number of free iOS builds for open-source projects.

How Do I Get Started?

Step 1: Update to NativeScript 6.4 or later

During plugin development, we had to expose a few more NativeScript CLI hooks and edit the iOS native project template in our iOS Runtime. The required changes are available in NativeScript CLI and iOS Runtime 6.4.

Step 2: Follow the plugin installation and setup guide

The up-to-date installation info, setup guide, and available remotes are available in the plugin's README.

Step 3: We love your feedback

Leave a comment or open an issue with your feedback. Your comments and suggestions are very important to us!

Comments


Comments are disabled in preview mode.
NativeScript is licensed under the Apache 2.0 license
© 2020 All Rights Reserved.