同步操作将从 沉璧浮光/ComposingBuildDemo 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
初识 Composing builds 是从这篇文章:再见吧 buildSrc, 拥抱 Composing builds 提升 Android 编译速度,在这里衷心感谢文章的作者:HiDhl。
本项目在 ComposingBuilds-vs-buildSrc 基础上结合个人想法做了一些小修改,下面介绍一下使用方法:
1、Clone 本项目,复制 plugin_version 文件夹到项目目录下(Ps:见 ①);
2、在 settings.gradle 中引入该插件模块:includeBuild 'plugin_version' ;
3、在项目根目录下的 build.gradle 中添加:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
...
}
//The use of apply false adds the plugin to the overall project, but does not add it to the root project.
plugins {
id 'plugin.version' apply true
}
经过前面三步就已经完成了版本管理插件的引入,接下来就可以像 buildSrc 那样引用依赖了:
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation Deps.kotlinStdlibJdk7
implementation Deps.appcompat
implementation Deps.constraintLayout
}
这里的版本管理延续了 BuildSrcDemo 里的方式,在 plugin_version 模块中的 versions.gradle 中配置依赖/插件信息进行统一管理修改版本, 因为其中可以看到依赖/插件是否有新版本的提示,通过执行 task:updateDenpendencies 把 versions.gradle 中的配置信息同步到 Deps.groovy 中供模块 build.gradle 使用。
Ps:
①:把插件模块放入到项目目录中,在执行 'Clean Project' 操作的时候会有以下提示,但是并不影响操作的执行,所以我还是选择像 buildSrc 一样把它放到项目目录中:
Project directory 'E:\workspace\AndroidStudio\ComposingBuildDemo\plugin_version' is not part of the build defined by settings file 'E:\workspace\
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。