Skip to content
Shreyash Saitwal edited this page Mar 12, 2021 · 13 revisions

Overview

Rush is a CLI tool built to be a complete replacement for the existing way of developing extensions. It attempts to improve the overall developer experience and reduce the amount of boilerplate code you need to write to make extensions.

With Rush, you no longer need to use annotations to define your extension's metadata and Android manifest tags. Instead, you get a separate metadata file, rush.yml, and direct support for AndroidManifest.xml (more on that below).

Not just that, Rush sports a beautiful interactive CLI that accompanies you from scaffolding to building production-ready optimized builds of your extension. For an overview of all the features Rush provides, check out this wiki.

Getting started

Installation

Your very first Rush project

Once you've Rush installed on your system, fire up a terminal app, cd to the directory you wish to create the extension in, and then run rush create <your_extension_name>. Answer the prompted questions, and woo-hoo, you have a brand new Rush project ready! 🥳

Note

If you're on Windows, refrain from using CMD (Command Prompt). There's an issue with Rush which causes unexpected behavior when used with CMD.

Now, cd into the created directory and run rush build. Once the build is complete, you'll find your extension in the out directory. Voila! You just built your very first Rush extension!

Understanding the fundamentals

If you take a look at the generated Java file for your extension, you'll find that there are no DesignerComponent and SimpleObject annotations in there. In fact, there is not a single class-level annotation. So, where did all these annotations go?

The metadata file (rush.yml)

All the annotations related to defining the extension's metadata, like, its name, description, minimum Android SDK, license, etc. are replaced by the metadata file -- rush.yml. It also keeps an entry of all the external libraries and assets required by your extensions. To know more, check out this wiki.

Note

Dependencies and assets defined in rush.yml are required to be added to ./deps and ./assets directories respectively.

AndroidManifest.xml

Believe it or not, nothing is worse than having to use Java annotations to define your extension's Android manifest elements. You know the pain if you've ever written large manifest tags using those annotations. Even writing a single one could be ridiculously tedious.

But worry not, with Rush you get out-of-the-box support for directly using an AndroidManifest.xml file. It is located inside the src directory and is generated automatically when you scaffold your extension with the rush create command. It's time to say goodbye to the ugly annotations!

Note

Because of the restrictions imposed by App Inventor's extension system, you can't use every manifest tag. For a detailed list of supported tags, check out this wiki.

Code Optimization and Obfuscation

When you build your extension with the --release flag (-r), Rush obfuscates, shrinks, and optimizes your extension's Java code using ProGuard. You can use the ProGuard rules file (proguard-rules.pro), located inside the src directory, to modify the default behavior.

To turn off the optimization pass --no-optimize flag along with the --release flag. Similarly, you can optimize your code without the --release flag by passing --optimize flag (-o) as well.

Clone this wiki locally