[英]How to setup a project with multiple levels of modules for local development
I have multiple app projects of of roughly this layout: 我有几个大致这种布局的应用程序项目:
All apps share the same main dependency (java Wrapper with additional functionality) and its dependency tree. 所有应用程序共享相同的主要依赖项(具有附加功能的java Wrapper)及其依赖关系树。 Now I am developing on each app all the way down to C++ code.
现在我正在开发每个应用程序一直到C ++代码。 They are managed as git submodules in their respective parent project.
它们在各自的父项目中作为git子模块进行管理。
As there is a high change rate along the whole process, I want the final example to be built for testing from all sources. 由于整个过程中的变化率很高,我希望构建最终的示例以便从所有来源进行测试。
I tried several approaches for tying this together into one gradle build: 我尝试了几种将这种方法绑定到一个gradle构建中的方法:
Now I want this full tree to be managed in one flutter build. 现在我希望在一个flutter构建中管理这个完整的树。 So I add the direct dependencies in each projects settings.gradle, just to learn that gradle only supports one toplevel
settings.gradle
. 所以我在每个项目settings.gradle中添加直接依赖项,只是为了了解gradle只支持一个顶级
settings.gradle
。 So this does not work. 所以这不起作用。 The presented solutions in aforementioned question mostly try to emulate support for multiple settings.gradle files.
上述问题中提出的解决方案主要尝试模拟对多个settings.gradle文件的支持。
Do I really have to include all subprojects manually in the toplevel settings.gradle
, when each of the subprojects knows its dependencies perfectly fine? 当每个子项目完全了解其依赖关系时,我是否真的必须在顶级
settings.gradle
手动包含所有子项目? Furthermore, since there are multiple projects depending on this, do I have to do this manually for each of them? 此外,由于有多个项目取决于此,我是否必须为每个项目手动执行此操作?
(And don't even get me startet about gradle not telling me, I have a wrong projectDir because I got a typo in the 100rth level of recursive descend!) (甚至不要让我告诉我不要告诉我,我有一个错误的项目,因为我在100rth级别的递归下降中得到一个错字!)
This will trigger the builds but now I have to resolve the build artifacts instead of the projects. 这将触发构建,但现在我必须解决构建工件而不是项目。 So same problem with other artifacts.
与其他工件一样的问题。
I did not try this because I find the idea abhorent: I want to test one small change in the C++ code and now have to push that to a repository and potentially do the same on every project above? 我没有尝试这个,因为我发现这个想法很有用:我想测试C ++代码中的一个小变化,现在必须将其推送到存储库,并且可能在上面的每个项目上都做同样的事情? This works for a stable project but not for flexible exploratory development.
这适用于稳定的项目,但不适用于灵活的探索性开发。 Sure, I want to publish something at the end but I don't want to publish every little step in between.
当然,我想在最后发布一些内容,但我不想发布它们之间的每一个小步骤。
This left me wondering: Am I doing something unusual? 这让我想知道:我做的事情不寻常吗? I mean: is there nobody who has the same requirements that gradle does not seem able to fit:
我的意思是:有没有人有同样的要求gradle似乎不适合:
What is the common practice in this case? 这种情况下的常见做法是什么?
After Lukas Körfer's comment I took a closer look at composite builds again and noticed that I had a misconception about them. 在LukasKörfer的评论之后,我再次仔细研究了复合构建,并注意到我对它们有一种误解。 I did not understand that their dependency resolution will solve the finding of the build artifacts for me.
我不明白他们的依赖解析会解决我的构建工件的发现。
Now I use the composite builds to tie together the whole build while using 现在我使用复合构建在使用时将整个构建绑定在一起
implementation 'my.group:project'
to import the code of the subprojects and 导入子项目的代码和
includeBuild '../path/to/subproject/'
to pull them in. 把他们拉进来
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.