forked from just-ai/aimybox-android-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
133 lines (112 loc) · 3.87 KB
/
build.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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
import com.jfrog.bintray.gradle.BintrayExtension
import com.justai.gradle.project.configureRootProject
import com.justai.gradle.project.projectConfig
import com.justai.gradle.project.rootProjectConfig
val coreProject: Project
get() = rootProject.project("core")
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath(Plugin.androidGradle)
classpath(Plugin.kotlinGradle)
classpath(Plugin.dokka)
classpath(Plugin.dexcount)
classpath(Plugin.bintray)
classpath(Plugin.buildInfoExtractor)
classpath(Plugin.protobuf)
}
}
configureRootProject {
kotlinVersion = Version.kotlin
version = "0.11.0"
versionCode = 1
compileSdk = 29
minSdk = 21
groupId = "com.justai.aimybox"
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
mavenLocal()
maven("https://kotlin.bintray.com/kotlinx")
maven("https://dl.bintray.com/aimybox/aimybox-android-sdk/")
}
}
subprojects {
afterEvaluate {
if (projectConfig.createMavenPublication) {
registerPublicationTasks()
configureMavenPublication()
rootProject.tasks.register(projectConfig.customMavenLocalPublicationTask) {
group = "aimybox:submodules"
dependsOn(tasks.named(projectConfig.mavenLocalPublicationTask))
}
if (projectConfig.publishToBintray) {
configureBintrayPublication()
rootProject.tasks.register(projectConfig.bintrayPublicationTask) {
group = "aimybox:submodules"
dependsOn(
tasks.named("bintrayUpload"),
tasks.named(projectConfig.generatePomFileTask)
)
}
}
}
}
}
fun Project.configureBintrayPublication() {
apply(plugin = "com.jfrog.bintray")
configure<BintrayExtension> {
val properties = java.util.Properties()
val propsFile = project.rootProject.file("local.properties")
if (propsFile.canRead()) {
properties.load(propsFile.inputStream())
}
val bintrayUsername = properties["bintrayUser"] as? String
?: System.getProperty("BINTRAY_USER") ?: System.getenv("BINTRAY_USER")
val bintrayKey = properties["bintrayKey"] as? String
?: System.getProperty("BINTRAY_KEY") ?: System.getenv("BINTRAY_KEY")
user = bintrayUsername
key = bintrayKey
pkg(closureOf<BintrayExtension.PackageConfig> {
repo = "aimybox-android-sdk"
name = project.name
userOrg = "aimybox"
setLicenses("Apache-2.0")
websiteUrl = "https://aimybox.com"
publish = true
vcsUrl = "https://github.com/aimybox/aimybox-android-sdk.git"
version(closureOf<BintrayExtension.VersionConfig> { name = rootProjectConfig.version })
})
setPublications(projectConfig.publicationName)
}
tasks.named("bintrayUpload").configure {
dependsOn("prepareArtifacts")
}
}
tasks.register("localPublishAll") {
group = "aimybox"
val publicationTasks = subprojects.mapNotNull { project ->
if (project.projectConfig.createMavenPublication) "${project.name}:${project.projectConfig.mavenLocalPublicationTask}"
else null
}.toTypedArray()
dependsOn(*publicationTasks)
}
tasks.register("bintrayPublishAll") {
group = "aimybox"
val publicationTasks = subprojects.mapNotNull { project ->
if (project.projectConfig.publishToBintray) project.projectConfig.bintrayPublicationTask
else null
}.toTypedArray()
dependsOn(*publicationTasks)
}
tasks.register<Delete>("clean") {
group = "aimybox:util"
delete(*(allprojects.map { it.buildDir }.toTypedArray()))
delete(".gradle")
}