2019-09-27 21:53:02 +08:00
|
|
|
|
apply plugin: 'com.android.component'
|
|
|
|
|
|
|
|
|
|
|
|
component {
|
|
|
|
|
|
|
2019-09-30 18:36:46 +08:00
|
|
|
|
//注意:下面使用到的模块命等同于 setting 中申明的模块名,严格遵守规范
|
|
|
|
|
|
|
|
|
|
|
|
//申明插件的作用域,用于有 include 和 exclude
|
|
|
|
|
|
//生效的模块会自动添加组件依赖 core,可使用 component(:{projectName}) 使用其他组件提供的sdk,同时可在 componentSdks 中配置自己模块暴露的sdk
|
2019-10-21 21:17:47 +08:00
|
|
|
|
exclude 'libraryWithoutPlugin,component-core'
|
2019-09-30 18:36:46 +08:00
|
|
|
|
|
|
|
|
|
|
// 上述 语句等价于下面语句
|
2019-10-09 19:07:37 +08:00
|
|
|
|
// include ':app,library,libraryKotlin,debugModule'
|
2019-09-30 18:36:46 +08:00
|
|
|
|
|
2019-10-23 18:59:37 +08:00
|
|
|
|
|
2019-10-23 20:22:48 +08:00
|
|
|
|
sdk {
|
2019-09-30 18:36:46 +08:00
|
|
|
|
|
2019-10-23 18:59:37 +08:00
|
|
|
|
//编译版本
|
|
|
|
|
|
compileSdkVersion 27
|
|
|
|
|
|
|
|
|
|
|
|
//java编译版本
|
|
|
|
|
|
compileOptions {
|
|
|
|
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
|
|
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
2019-09-30 18:36:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-10-23 18:59:37 +08:00
|
|
|
|
configuration {
|
|
|
|
|
|
|
|
|
|
|
|
'library' {
|
|
|
|
|
|
groupId 'com.effective.android'
|
|
|
|
|
|
artifactId 'librarySdk'
|
|
|
|
|
|
dependencies {
|
|
|
|
|
|
// 只支持 compileOnly 和 implementation
|
|
|
|
|
|
implementation 'com.google.code.gson:gson:2.8.1'
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
'libraryKotlin' {
|
|
|
|
|
|
groupId 'com.effective.android'
|
|
|
|
|
|
artifactId 'libraryKotlinSdk'
|
|
|
|
|
|
dependencies {
|
|
|
|
|
|
implementation 'com.google.code.gson:gson:2.8.1'
|
|
|
|
|
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
|
|
|
|
}
|
2019-09-30 18:36:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2019-09-27 21:53:02 +08:00
|
|
|
|
}
|
2019-10-03 00:04:46 +08:00
|
|
|
|
|
2019-10-23 20:22:48 +08:00
|
|
|
|
pin {
|
|
|
|
|
|
|
|
|
|
|
|
configuration {
|
|
|
|
|
|
'library' {
|
|
|
|
|
|
codeCheckEnabled true
|
|
|
|
|
|
include ':p_base'
|
|
|
|
|
|
include ':p_common'
|
|
|
|
|
|
include ':p_home'
|
|
|
|
|
|
|
|
|
|
|
|
export ':main', ':p_home'
|
|
|
|
|
|
export ':p_common'
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-10-04 18:08:34 +08:00
|
|
|
|
//组件调试声明
|
|
|
|
|
|
debug {
|
2019-10-03 00:04:46 +08:00
|
|
|
|
|
2019-10-04 18:08:34 +08:00
|
|
|
|
//调试模块,随意在当前项目新建一个module用于调试即可
|
|
|
|
|
|
targetModuleName 'debugModule'
|
2019-10-03 00:04:46 +08:00
|
|
|
|
|
2019-10-04 18:08:34 +08:00
|
|
|
|
//申明调试模块运行时链接组件的资源,表明运行 debugModule 时使用目录资源
|
2019-10-09 19:07:37 +08:00
|
|
|
|
// targetDebugName 'libraryWithoutPlugin'
|
2019-10-03 00:04:46 +08:00
|
|
|
|
|
2019-10-04 18:08:34 +08:00
|
|
|
|
configuration {
|
2019-10-03 00:04:46 +08:00
|
|
|
|
|
2019-10-04 18:08:34 +08:00
|
|
|
|
'library' {
|
|
|
|
|
|
dependencies {
|
|
|
|
|
|
//只支持 implementation,足够了
|
|
|
|
|
|
implementation component(':library')
|
|
|
|
|
|
}
|
2019-10-03 00:04:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-10-04 18:08:34 +08:00
|
|
|
|
'libraryKotlin' {
|
|
|
|
|
|
dependencies {
|
|
|
|
|
|
implementation component(':libraryKotlin')
|
|
|
|
|
|
}
|
2019-10-03 00:04:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-10-09 19:07:37 +08:00
|
|
|
|
'libraryWithoutPlugin' {
|
2019-10-04 18:08:34 +08:00
|
|
|
|
dependencies {
|
2019-10-09 19:07:37 +08:00
|
|
|
|
implementation project(':libraryWithoutPlugin')
|
2019-10-04 18:08:34 +08:00
|
|
|
|
}
|
2019-10-03 00:04:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-10-04 18:08:34 +08:00
|
|
|
|
'customDebug' {
|
|
|
|
|
|
dependencies {
|
|
|
|
|
|
implementation component(':library')
|
|
|
|
|
|
implementation component(':libraryKotlin')
|
|
|
|
|
|
}
|
2019-10-03 00:04:46 +08:00
|
|
|
|
}
|
2019-10-04 18:08:34 +08:00
|
|
|
|
|
2019-10-03 00:04:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2019-09-27 21:53:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-09-29 20:35:26 +08:00
|
|
|
|
|
2019-10-23 18:59:37 +08:00
|
|
|
|
//tasks.whenTaskAdded { task ->
|
|
|
|
|
|
// if (task.name.contains('AndroidTest') || task.name.contains('Test')) {
|
|
|
|
|
|
// task.enabled = false
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|