Rush • A new and improved way of building extensions

I got to know an extension builder - Rush.
But I don't know how to use it.
Can anybody tell me about how to use it(Better if it is easy to understand).

Read the first post in this topic.

i use ai2 offline so i need JDK 11.
and other path for other softwer.
now what is the solution?

Each time you would need to switch manually. On linux, if you use it, you may get some advantage (there are specialized tools to switch JDKs)

1. Create a batch file.

@echo off
if "%~1" == "11" (
   set "JAVA_HOME=C:\Program Files\Amazon Corretto\jdk11.0.19_7"
) else (
   set "JAVA_HOME=C:\Program Files\Amazon Corretto\jdk1.8.0_372" 
)
 set "Path=%JAVA_HOME%\bin;%Path%"
java -version

2. Save it somewhere on disk with .bat extension. (Like SJV.bat )
3. Add file's parent dir path to Path env variable.
4. Add JDK 11 to Path env variable.
5. Whenever you need to compile aix using JDK8, open cmd and enter SJV.
JDK 8 will be used in that cmd session.

5 Likes

but i installed C:\Program Files\Eclipse Adoptium\jdk-11.0.22.7-hotspot
can need to replace with C:\Program Files\Amazon Corretto\jdk11.0.19_7 to C:\Program Files\Eclipse Adoptium\jdk-11.0.22.7-hotspot ?

worked. :hugs: thanks @vknow360

In version 2.0 beta I found this bug. If we have a setter and return property with the same name, an entry is created twice in the components.json file, read-write and write-only. If we have a setter and return property, one read-write entry is enough.

"blockProperties": [
            {
                "rw": "write-only",
                "deprecated": "false",
                "name": "Orientation",
                "description": "Sets and returns the image orientation every 90 degrees.",
                "type": "number"
            },
            {
                "rw": "read-write",
                "deprecated": "false",
                "name": "Orientation",
                "description": "Sets and returns the image orientation every 90 degrees.",
                "type": "number"
            },
            {
                "rw": "write-only",
                "deprecated": "false",
                "name": "FlipHorizontal",
                "description": "Flips the image horizontally. In other words, mirror reflection.",
                "type": "boolean"
            },
            {
                "rw": "read-write",
                "deprecated": "false",
                "name": "FlipHorizontal",
                "description": "Returns whether the image is horizontally flipped.",
                "type": "boolean"
            },
            {
                "rw": "write-only",
                "deprecated": "false",
                "name": "FlipVertical",
                "description": "Flips the image vertically.",
                "type": "boolean"
            },
            {
                "rw": "read-write",
                "deprecated": "false",
                "name": "FlipVertical",
                "description": "Returns whether the image is vertically flipped.",
                "type": "boolean"
            },
            {
                "rw": "read-only",
                "deprecated": "false",
                "name": "Width",
                "description": "Returns the width of the image.",
                "type": "number"
            },
            {
                "rw": "read-only",
                "deprecated": "false",
                "name": "Height",
                "description": "Returns the height of the image.",
                "type": "number"
            }
        ],
1 Like

after updated, it showing 1.2.4, but letest version 1.2.5
anyone tell me what is the problem.

Screenshot 2024-04-15 163411

The version number update may have been forgotten....

I get a different build date to you (on Linux)

image

1 Like

That's right, when a property has both a getter and a setter then read-write is enough. This should be an easy fix, if anyone's interested in contributing let me know and I'd be happy to walk you through the Rush codebase.

1 Like

You're using the latest version, released on 11 Dec, 2021. As mentioned by Tim already, I forgot to update the version string in that release.

I've already tried c++, java, js, php, opengl shading, some kotlin, swift and python :joy:. Do you think it's time to learn darts?

You won't need Dart for this specific issue, but why not? One more weapon to your arsenal! :wink:

2 Likes

I'm trying to make an extension (again) and its failing

I believe you are using wrong Java version.

When you run java -vesion && javac -version, you need to get a valid output this way, representing Java 1.8 (8)

[kumaraswamy@melon ~]$ java -version && javac -version
openjdk version "1.8.0_402"
OpenJDK Runtime Environment (build 1.8.0_402-b06)
OpenJDK 64-Bit Server VM (build 25.402-b06, mixed mode)
javac 1.8.0_402

I don't have javac..... that could be why
edit: javac installed

tails2012tim@penguin:~/test$ rush build
                      __
     _______  _______/ /_
    / ___/ / / / ___/ __ \
   / /  / /_/ (__  / / / /
  /_/   \__,_/____/_/ /_/

• Build initialized

┌ Checking project files
│ info Checking metadata file (rush.yml)
│ info Checking AndroidManifest.xml file
└ done
┌ Compiling sources
│ info Picked 1 source file
└ done
┌ Processing the extension
│ info Linking extension assets
│ info Generating DEX bytecode
│      Compilation failed with an internal error.
│      java.lang.IllegalArgumentException: Unsupported class file major version 66
│       at com.android.tools.r8.A.a.a.f.<init>(:10)
│       at com.android.tools.r8.A.a.a.f.<init>(:2)
│       at com.android.tools.r8.A.a.a.f.<init>(:1)
│       at com.android.tools.r8.A.a.a.f.<init>(:107)
│       at com.android.tools.r8.graph.x0.a(:24)
│       at com.android.tools.r8.dex.a$a.a(:12)
│       at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
│       at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
│       at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1067)
│       at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1703)
│       at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:172)
└ failed

• Build failed [1s 35ms] []
tails2012tim@penguin:~/test$ 

edit: finally, after too long of putting info in to orcale

1 Like

Could anyone help me with this warning in rush?

I do not understand it except that it only makes one block that is just itself.

Output


                     __
     _______  _______/ /_
    / ___/ / / / ___/ __ \
   / /  / /_/ (__  / / / /
  /_/   \__,_/____/_/ /_/

• Build initialized

┌ Checking project files
│ info Checking metadata file (rush.yml)
│ info Checking AndroidManifest.xml file
└ done
┌ Compiling sources
│ info Picked 1 source file
│ 
│ warn No declaration of any block annotation found
└ done
┌ Processing the extension
│ info Linking extension assets
│ info Generating DEX bytecode
└ done
┌ Finalizing the build
│ info Packing com.tails2012timprograms.learningextensions.aix
└ done

• Build successful [1s 178ms] [1 warning]
tails2012tim@penguin:~/learning-extensions$ 

Code


package com.tails2012timprograms.learningextensions;

import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.errors.YailRuntimeError;
import com.google.appinventor.components.runtime.util.YailList;

public class LearningExtensions extends AndroidNonvisibleComponent {

  public LearningExtensions(ComponentContainer container) {
    super(container.$form());
  }

  @SimpleFunction(description = "Returns the sum of the given list of integers.")
  public int SumAll(YailList integers) {
    int sum = 0;

    for (final Object o : integers.toArray()) {
      try {
        sum += Integer.parseInt(o.toString());
      } catch (NumberFormatException e) {
        throw new YailRuntimeError(e.toString(), "NumberFormatException");
      }
    }
    return sum;
  }
}

Any help would be greatly appreciated!