gpt4 book ai didi

android - 什么被视为 "decoupled project"(Gradle)?

转载 作者:行者123 更新时间:2023-11-29 18:30:46 26 4
gpt4 key购买 nike

大家好,我正在制作一个 Cocos2d-x 游戏,其中包含 gradle 文件,我一直在寻找提高构建时间的方法,我尝试谷歌搜索,甚至查看 Gradle 文档,但我似乎无法理解“到底是什么”解耦”项目是?在我的 gradle.properties 中它指出了这一点

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
#org.gradle.parallel=true

对于不熟悉 Cocos2d-x 的人来说,Android Studio Cocos2d-x 项目的 Gradle Scripts 文件夹中有 3 个 build.gradle 文件:

  • (项目:proj.android)
  • (模块:MyGame)
  • (模块:libcocos2dx)

随后是gradle-wrapper.propertiesproguard-rules.pro(MyGame)proguard-rules.pro(libcocos2dx)gradle.propertiessettings.gradlelocal.properties

话虽如此,我的项目是否被视为解耦项目?取消注释 org.gradle.parallel=true 会缩短构建时间吗?或者我会注意到什么不同?

最佳答案

通过运行以下命令检查应用程序的项目列表。

gradlew -q projects

它的输出将是这样的

------------------------------------------------------------
Root project
------------------------------------------------------------

Root project 'MyApplication'
+--- Project ':app'
\--- Project ':mylibrary'

根据 gradle link

Two projects are said to be decoupled if they do not directly access each other’s project model. Decoupled projects may only interact in terms of declared dependencies: project dependencies and/or task dependencies. Any other form of project interaction (i.e. by modifying another project object or by reading a value from another project object) causes the projects to be coupled.

如果应用程序使用类似的依赖项

dependencies {

implementation project(":mylibrary")
}

然后就解耦了。

关于android - 什么被视为 "decoupled project"(Gradle)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56420559/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com