Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Gradle's configuration cache #1120

Open
Goooler opened this issue Dec 1, 2022 · 1 comment
Open

Support Gradle's configuration cache #1120

Goooler opened this issue Dec 1, 2022 · 1 comment
Labels
PR welcome 欢迎贡献代码

Comments

@Goooler
Copy link

Goooler commented Dec 1, 2022

https://docs.gradle.org/7.5.1/userguide/configuration_cache.html

@shifujun shifujun added the PR welcome 欢迎贡献代码 label Dec 1, 2022
shifujun added a commit to shifujun/Shadow that referenced this issue Dec 1, 2022
保持一致,否则gradle configuration cache会因为多次加载这个文件,
认为useAndroidX属性在变化。

Tencent#1120
shifujun added a commit to shifujun/Shadow that referenced this issue Dec 1, 2022
invocation of 'Task.project' at execution time is unsupported.

Tencent#1120
shifujun added a commit to shifujun/Shadow that referenced this issue Dec 1, 2022
为解决configuration cache在复合构建中存在到bug。

升级后执行了`./gradlew wrapper`命令覆盖修改了相关文件。

gradle/gradle#21467
Tencent#1120
@shifujun
Copy link
Collaborator

shifujun commented Dec 1, 2022

虽然这是个一句话需求,但我对Gradle这个新特性还是比较感兴趣,所以看了看。

configuration cache对于Shadow这种模块特别多的项目提高构建速度是非常有用的,每次构建能节约最多20秒的样子。

这个特性目前还处于预览状态,特别是对于复合构建场景有bug。所以要升级Gradle版本。

升级Gradle版本会连带升级编译期环境中的kotlin版本,因为Gradle打包了它。那就需要升级kotlin版本。升级kotlin版本影响就比较大了。还要改动很多代码。

另外从 https://kotlinlang.org/docs/gradle-configure-project.html 可以看到kotlin的gradle插件最高只完整支持gradle到7.1.1版本。但是7.1.1版本的configuration cache特性还有bug。而且kotlin到gradle插件本身也需要适配configuration cache。而且似乎在复合构建场景上还是有bug。

因此目前来看,Shadow项目要想利用上configuration cache特性还比较困难。

如果有同学愿意尝试这个特性,欢迎交流。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR welcome 欢迎贡献代码
Projects
None yet
Development

No branches or pull requests

2 participants