Rush • A new and improved way of building extensions

Nope, that’s not yet possible. Fyi, it’s not something that can be implemented entirely through Rush; some changes are necessary on the upstream (AI2) to support the use of XML resources in extensions.

3 Likes

Hello @Shreyash . First of all thanks for really great project Rush.
I’m very new to rush and commands. and I tried to create extension by using Rush. It created my extension folder successfully but I got some errors on build.

  • I have no spaces in my directory or in filename.
  • I’ve tried on desktop and D drive to make my project. (same error everywhere)
  • I’m using Windows PowerShell

As you can see java & rush versions on my machine and successfully created extension project folder :point_down:

But I’m getting this error while building my project :point_down: by using rush build -r

Your help will be appreciated :kodular:

1 Like

Also getting this error with version 1.2.0 :point_down:

If it says “Failed” just try again, it’ll normally resolved… From my experiences. On the other hand, is your project empty?

The problem is with your JDK installation. You don’t have any version of JDK installed on your system. Download and install JDK 8 and try again.

1 Like

can we use kotlin and java both together?

Already answered here

1 Like

ok thx :grinning: :smile: :smile: :grin: :smiley: :slightly_smiling_face:

Is there a problem installing the latest java or it has to be 8.x

it has to be the 8 or build will get failed @laboratoriodosfundos

1 Like

According to Rush wiki it has to be Java JDK version 8

3 Likes

An error…

Microsoft Windows [Version 10.0.18363.1556]
(c) 2019 Microsoft Corporation. All rights reserved.
C:\Users\user\Desktop\Rush codes\tasks>rush build
                      __
     _______  _______/ /_
    / ___/ / / / ___/ __ \
   / /  / /_/ (__  / / / /
  /_/   \__,_/____/_/ /_/

• Build initialized

┌ Checking project files
Unhandled exception:
HiveError: This should not happen. Please open an issue on GitHub.
#0      BinaryReaderImpl.readFrame (package:hive/src/binary/binary_reader_impl.dart:250)
#1      FrameHelper.framesFromBytes (package:hive/src/binary/frame_helper.dart:21)
#2      FrameIoHelper.framesFromFile (package:hive/src/io/frame_io_helper.dart:42)
<asynchronous suspension>
#3      StorageBackendVm.initialize (package:hive/src/backend/vm/storage_backend_vm.dart:86)
<asynchronous suspension>
#4      HiveImpl._openBox (package:hive/src/hive_impl.dart:116)
<asynchronous suspension>
#5      HiveImpl.openBox (package:hive/src/hive_impl.dart:145)
<asynchronous suspension>
#6      BuildCommand.run (package:rush_cli/commands/build_command/build_command.dart:118)
<asynchronous suspension>
#7      CommandRunner.runCommand (package:args/command_runner.dart:196)
<asynchronous suspension>

C:\Users\user\Desktop\Rush codes\tasks>rush build -r
                      __
     _______  _______/ /_
    / ___/ / / / ___/ __ \
   / /  / /_/ (__  / / / /
  /_/   \__,_/____/_/ /_/

• Build initialized

┌ Checking project files
Unhandled exception:
HiveError: This should not happen. Please open an issue on GitHub.
#0      BinaryReaderImpl.readFrame (package:hive/src/binary/binary_reader_impl.dart:250)
#1      FrameHelper.framesFromBytes (package:hive/src/binary/frame_helper.dart:21)
#2      FrameIoHelper.framesFromFile (package:hive/src/io/frame_io_helper.dart:42)
<asynchronous suspension>
#3      StorageBackendVm.initialize (package:hive/src/backend/vm/storage_backend_vm.dart:86)
<asynchronous suspension>
#4      HiveImpl._openBox (package:hive/src/hive_impl.dart:116)
<asynchronous suspension>
#5      HiveImpl.openBox (package:hive/src/hive_impl.dart:145)
<asynchronous suspension>
#6      BuildCommand.run (package:rush_cli/commands/build_command/build_command.dart:118)
<asynchronous suspension>
#7      CommandRunner.runCommand (package:args/command_runner.dart:196)
<asynchronous suspension>

C:\Users\user\Desktop\Rush codes\tasks>clear

C:\Users\user\Desktop\Rush codes\tasks>rush build
                      __
     _______  _______/ /_
    / ___/ / / / ___/ __ \
   / /  / /_/ (__  / / / /
  /_/   \__,_/____/_/ /_/

• Build initialized

┌ Checking project files
Unhandled exception:
HiveError: This should not happen. Please open an issue on GitHub.
#0      BinaryReaderImpl.readFrame (package:hive/src/binary/binary_reader_impl.dart:250)
#1      FrameHelper.framesFromBytes (package:hive/src/binary/frame_helper.dart:21)
#2      FrameIoHelper.framesFromFile (package:hive/src/io/frame_io_helper.dart:42)
<asynchronous suspension>
#3      StorageBackendVm.initialize (package:hive/src/backend/vm/storage_backend_vm.dart:86)
<asynchronous suspension>
#4      HiveImpl._openBox (package:hive/src/hive_impl.dart:116)
<asynchronous suspension>
#5      HiveImpl.openBox (package:hive/src/hive_impl.dart:145)
<asynchronous suspension>
#6      BuildCommand.run (package:rush_cli/commands/build_command/build_command.dart:118)
<asynchronous suspension>
#7      CommandRunner.runCommand (package:args/command_runner.dart:196)
<asynchronous suspension>

C:\Users\user\Desktop\Rush codes\tasks>clear

C:\Users\user\Desktop\Rush codes\tasks>rush build -r
                      __
     _______  _______/ /_
    / ___/ / / / ___/ __ \
   / /  / /_/ (__  / / / /
  /_/   \__,_/____/_/ /_/

• Build initialized

┌ Checking project files
Unhandled exception:
HiveError: This should not happen. Please open an issue on GitHub.
#0      BinaryReaderImpl.readFrame (package:hive/src/binary/binary_reader_impl.dart:250)
#1      FrameHelper.framesFromBytes (package:hive/src/binary/frame_helper.dart:21)
#2      FrameIoHelper.framesFromFile (package:hive/src/io/frame_io_helper.dart:42)
<asynchronous suspension>
#3      StorageBackendVm.initialize (package:hive/src/backend/vm/storage_backend_vm.dart:86)
<asynchronous suspension>
#4      HiveImpl._openBox (package:hive/src/hive_impl.dart:116)
<asynchronous suspension>
#5      HiveImpl.openBox (package:hive/src/hive_impl.dart:145)
<asynchronous suspension>
#6      BuildCommand.run (package:rush_cli/commands/build_command/build_command.dart:118)
<asynchronous suspension>
#7      CommandRunner.runCommand (package:args/command_runner.dart:196)
<asynchronous suspension>

How do I fix this? I’m using the latest version.

Hmm… Just deleted the data.hive as Shreyash had told me earlier to do so, found only this file contained data…so deleted and it was fine.

I saw a bug in rush, even If I didn’t mentioned deps in rush.yml, my aix compiled successfully with all classes

:thinking:

@Shreyash Correct me If I am wrong

No, how can they be compiled?
Even if its compiled, it maybe missing the library.

No, that is not a bug. It’s one of the few design decisions Rush has taken from the extension-template.

Rush, by default, assumes every JAR library in the deps directory as the project’s compile-only dependency. And only the libraries that are defined in the metadata file (rush.yml) are packed with the AIX and made available during the extension’s runtime (in the companion or the exported APK).

So, even if your extension did compile without defining the runtime libraries in the metadata file, it won’t work when you use it in an actual app or the companion.

I could have made it mandatory to define the compile-time dependencies in the metadata file, but that would have only made things more verbose than they should be. For example, if one of your extension’s dependencies have 10 compile-time dependencies, you would have to list out each of it in the metadata file, making it unnecessarily big.

6 Likes

Helllo @Shreyash ,
I’ve used some of the classes written in Kotlin and my main extension class is written in Java . I got this error. Should i have to write main extension class in Kotlin too if i was using Kotlin classes ?? or How can I enable kotlin in rush.yml ??

Kotlin files detected. Please enable Kotlin in rush.yml

1 Like

You can enable it by writing a small code in metadata file.
Like this

build:
  desugar:
    enable: true
    desugar_deps: false

  kotlin:
    enable: true

And see the here wiki for more info

5 Likes

Thankyou Sumit. Extension is successfully built.

5 Likes

Building the extension with -r flag or -o flag probably splits the Service file changing its package with the one mentioned in the XML and causes the above error. Any way to prevent it? Or keep the service file as it is?