Files
ComponentCornerstone/gradleScript/component.gradle
2019-10-23 20:22:48 +08:00

109 lines
3.0 KiB
Groovy
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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