dart-backend / angel

A polished, production-ready backend framework in Dart for the VM, AOT, and Flutter.
https://github.com/dukefirehawk/angel
BSD 3-Clause "New" or "Revised" License
173 stars 21 forks source link

it can't comiple to native #50

Open jiangyubao opened 2 years ago

jiangyubao commented 2 years ago

`Info: Compiling with sound null safety

error: import of dart:mirrors is not supported in the current Dart runtime

Error: AOT compilation failed Generating AOT snapshot failed!`

dart version: 2.5.3 os: macos

debuggerx01 commented 2 years ago

https://github.com/angel-dart/angel/issues/103

Remove MirrorsReflector from prod.dart , remove angel_jael dependency and other any dependency contains dart: mirrors will solve this problem

dukefirehawk commented 2 years ago

Any packages that uses dart:mirrors for reflections won't be able to compile and run in AOT mode. They can only be run in JIT mode. This is the limitation of AOT, see https://dart.dev/tools/dart-compile for more details.

outersky commented 2 years ago

So is there any plan to replace mirrors with reflectable package?

dukefirehawk commented 2 years ago

Unfortunately reflectable is not a drop in replacement of mirror. It uses code generation instead of reflection. Basically, need to regenerate the code every time something is changed, this is not ideal for development. Can try out angel3_container_generator which use reflectable instead of mirror to see if it works for you.

outersky commented 2 years ago

According to debuggerx01 's answer: https://github.com/angel-dart/angel/issues/103 , I add angel3_container_generator and remove angel3_jael from config.dart , now it can compile to native , GREAT!!!

atreeon commented 2 years ago

just for info, if you're using Angel as an ORM and for its database connectivity features, using only those dependencies, it can be compiled