-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.gradle.kts
45 lines (37 loc) · 1.23 KB
/
publish.gradle.kts
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
import com.android.build.gradle.LibraryExtension
apply<PublishPlugin>()
class PublishPlugin : Plugin<Project> {
override fun apply(project: Project) = project.subprojects {
afterEvaluate {
if (projectDir.parentFile != rootDir
|| !plugins.hasPlugin("maven-publish")) {
return@afterEvaluate
}
publishing {
publications {
register<MavenPublication>("release") {
groupId = GROUP_ID
afterEvaluate { from(components["release"]) }
}
}
}
android {
publishing {
singleVariant("release") {
withSourcesJar()
withJavadocJar()
}
}
}
}
}
private fun Project.publishing(configure: PublishingExtension.() -> Unit) {
extensions.configure("publishing", configure)
}
private fun Project.android(configure: LibraryExtension.() -> Unit) {
extensions.configure("android", configure)
}
private companion object {
const val GROUP_ID = "com.github.xiaocydx"
}
}