领域gradle任务 [英] Realm gradle tasks

查看:78
本文介绍了领域gradle任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的assembleDebug gradle任务的配置文件报告中,我发现了两个与领域相关的gradle子任务,这需要花费大量时间:

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

问题:

  • 那些与领域相关的gradle子任务到底做了什么?我可以在某个时候跳过它们吗?
  • 为什么他们花了这么长时间? (22 + 10 = 32秒)

更新

作为解决方法,我通过-x脚本参数跳过了任务

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

assembleDebug -x transformClassesWithRealmOptionalAPITransformerForDebug

推荐答案

transformClassesWithRealmOptionalAPITransformerForDebug是为了删除与RxJava相关的API而创建的,因为它在某些情况下可能会造成麻烦(需要反思的情况,例如 https://github.com/realm/realm-java/issues/3033 https://github.com/realm/realm-java/issues/3022 .因此,它将在v1.0.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是Realm依赖的核心部分.基本上,它通过字节码操作来替换Realm访问器对RealmObject的字段访问.您可以查看此帖子以获得更多详细信息.因此,不能跳过此任务.

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.创建了一个问题来跟踪变压器速度的提高.

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

这篇关于领域gradle任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆