Realm gradle tasks

北城余情 提交于 2020-01-01 09:50:08

问题


During my profile report of assembleDebug gradle task I discovered two realm related gradle sub-tasks which takes quite big amount of time:

assembleDebug - 1m21.44s
- transformClassesWithRealmOptionalAPITransformerForDebug - 22.386s
- transformClassesWithRealmTransformerForIdeDebug - 10.062s

Questions:

  • what exactly those realm related gradle sub tasks do? Can I skip them at some point?
  • why they took so long? (22 + 10 = 32 sec)

Update

As a workaround I am skipping task via -x script parameter

assembleDebug -x transformClassesWithRealmOptionalAPITransformerForDebug

回答1:


transformClassesWithRealmOptionalAPITransformerForDebug is created for removing RxJava related APIs since it might create troubles for some cases (cases which need reflection like https://realm.io/docs/java/latest/#jackson-databind) which doesn't have the RxJava dependency. But we found it doesn't play well in some occasions like https://github.com/realm/realm-java/issues/3033 and https://github.com/realm/realm-java/issues/3022 . So it will be disabled in the next release after v1.0.1.

transformClassesWithRealmTransformerForIdeDebug is the core part Realm relies on. Basically it replace the field access to the RealmObject with Realm accessors by bytecode manipulating. You can see this post for a bit more details. Thus, this task cannot be skipped.

PS. an issue is created to track the transformer speed improvement.



来源:https://stackoverflow.com/questions/37928953/realm-gradle-tasks

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!