Files
ComponentCornerstone/gradleScript/component.gradle

109 lines
3.0 KiB
Groovy
Raw Normal View History

apply plugin: 'com.android.component'
component {
//注意:下面使用到的模块命等同于 setting 中申明的模块名,严格遵守规范
//申明插件的作用域,用于有 include 和 exclude
//生效的模块会自动添加组件依赖 core可使用 component(:{projectName}) 使用其他组件提供的sdk同时可在 componentSdks 中配置自己模块暴露的sdk
exclude 'libraryWithoutPlugin,component-core'
// 上述 语句等价于下面语句
2019-10-09 19:07:37 +08:00
// include ':app,library,libraryKotlin,debugModule'
2019-10-23 18:59:37 +08:00
sdk {
2019-10-23 18:59:37 +08:00
//编译版本
compileSdkVersion 27
//java编译版本
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
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-10-03 00:04:46 +08:00
pin {
configuration {
'library' {
codeCheckEnabled true
include ':p_base'
include ':p_common'
include ':p_home'
export ':main', ':p_home'
export ':p_common'
}
}
}
//组件调试声明
debug {
2019-10-03 00:04:46 +08:00
//调试模块随意在当前项目新建一个module用于调试即可
targetModuleName 'debugModule'
2019-10-03 00:04:46 +08:00
//申明调试模块运行时链接组件的资源,表明运行 debugModule 时使用目录资源
2019-10-09 19:07:37 +08:00
// targetDebugName 'libraryWithoutPlugin'
2019-10-03 00:04:46 +08:00
configuration {
2019-10-03 00:04:46 +08:00
'library' {
dependencies {
//只支持 implementation足够了
implementation component(':library')
}
2019-10-03 00:04:46 +08:00
}
'libraryKotlin' {
dependencies {
implementation component(':libraryKotlin')
}
2019-10-03 00:04:46 +08:00
}
2019-10-09 19:07:37 +08:00
'libraryWithoutPlugin' {
dependencies {
2019-10-09 19:07:37 +08:00
implementation project(':libraryWithoutPlugin')
}
2019-10-03 00:04:46 +08:00
}
'customDebug' {
dependencies {
implementation component(':library')
implementation component(':libraryKotlin')
}
2019-10-03 00:04:46 +08:00
}
2019-10-03 00:04:46 +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
// }
//}