1 Star 0 Fork 4

风中人/ComposingBuildDemo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

ComposingBuildDemo

初识 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\

空文件

简介

统一管理插件和依赖库信息 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/1030/ComposingBuildDemo.git
git@gitee.com:1030/ComposingBuildDemo.git
1030
ComposingBuildDemo
ComposingBuildDemo
master

搜索帮助