https://github.com/alibaba/ARouter/blob/master/README_CN.md
https://github.com/Tangpj/calces-gradle-plugin#功能介绍
每个module都是一个library不能独立运行
每个module都是一个组件(application)可以独立运行->模块化测试;
按照业务拆分->商城;用户;社区;资讯
模块化不能独立运行组件化可以独立运行
自动化构建module-.组合不同应用程序
官网地址:https://github.com/Tangpj/calces-gradle-plugin
a.添加calces插件:
plugins {
id “calces.modules” version “1.0.11”
}
b.修改module 下gradle文件插件
c,项目下的gradle文件中配置项目中的组件
project的gradle配置
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id "calces.appconfig" version "1.0.11"
}
//calces组件化配置
appConfig{
//debug测试模式->开发阶段为true->各个子模块单独运行测试
debugEnable true
//组件化架构中,第三层不同业务路基组件
apps{
app{
modules ':news',':user'
}
}
modules{
//新闻资讯
news {
name ':news'
mainActivity ".MainActivity"
applicationId "com.example.news"
isRunAlone false
//是否可以单独运行
}
//用户
user {
name ':user'
mainActivity ".MainActivity"
applicationId "com.example.user"
isRunAlone false
//是否可以单独运行
}
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
module的gradle配置
apply plugin: 'calces.modules'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}