-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathconfig-aar.gradle
92 lines (85 loc) · 3.33 KB
/
config-aar.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
* ************************************************************
* 文件:config-aar.gradle 模块:ElegantBus 项目:ElegantBus
* 当前修改时间:2022年09月12日 18:50:52
* 上次修改时间:2022年09月12日 18:50:48
* 作者:Cody.yi https://github.com/codyer
*
* 描述:ElegantBus
* Copyright (c) 2022
* ************************************************************
*/
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
android {
compileSdk rootProject.ext.compileSdkVersion
defaultConfig {
minSdk rootProject.ext.minSdkVersion
targetSdk rootProject.ext.targetSdkVersion
consumerProguardFiles "consumer-rules.pro"
manifestPlaceholders = [
"@BUS_SUPPORT_MULTI_APP" : false,
"@BUS_MAIN_APPLICATION_ID": ""
]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
publishing {
singleVariant("release") {
// if you don't want sources/javadoc, remove these lines
if (!SIMPLIFY_VERSION) {
withSourcesJar()
withJavadocJar()
}
}
}
}
afterEvaluate {
publishing {
publications {
def flavors = android.productFlavors
if (flavors == null || flavors.size() == 0) {
println("++++++++++ componentNameList : " + components*.name)
// Creates a Maven publication called "release".
release(MavenPublication) {
from components.release
groupId = rootProject.ext.groupId
artifactId = project.getName()
version = rootProject.ext.version
}
} else {
flavors.forEach { flavor ->
println("++++++++++ productFlavors : " + flavor.name)
"$flavor.name"(MavenPublication) {
// from components."${flavor.name}Release"
groupId = rootProject.ext.groupId
artifactId = project.getName() + "-$flavor.name"
artifact tasks.findByName("bundle${flavor.name.capitalize()}ReleaseAar")
version = rootProject.ext.version
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
// Iterate over the api dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.api.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', rootProject.ext.groupId)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', rootProject.ext.version)
}
}
}
}
}
}
}
}