-
Notifications
You must be signed in to change notification settings - Fork 63
/
build.gradle.kts
94 lines (80 loc) · 2.48 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
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
group = "org.hisp.dhis"
version = libs.versions.dhis2AndroidSdkVersion.get()
/**
* Property from the Gradle command line. To remove the snapshot suffix from the version.
*/
if (project.hasProperty("removeSnapshotSuffix")) {
val mainVersion = (version as String).split("-SNAPSHOT")[0]
version = mainVersion
}
buildscript {
repositories {
google()
mavenLocal()
mavenCentral()
maven(url = "https://plugins.gradle.org/m2/")
}
dependencies {
classpath(libs.gradle)
classpath(libs.kotlin)
classpath(libs.ktlint)
}
}
plugins {
alias(libs.plugins.sonarqube)
alias(libs.plugins.dokka)
alias(libs.plugins.nexus.publish)
}
sonarqube {
properties {
val branch = System.getenv("GIT_BRANCH")
val targetBranch = System.getenv("GIT_BRANCH_DEST")
val pullRequestId = System.getenv("PULL_REQUEST")
property("sonar.projectKey", "dhis2_dhis2-android-sdk")
property("sonar.organization", "dhis2")
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.projectName", "dhis2-android-sdk")
if (pullRequestId == null) {
property("sonar.branch.name", branch)
} else {
property("sonar.pullrequest.base", targetBranch)
property("sonar.pullrequest.branch", branch)
property("sonar.pullrequest.key", pullRequestId)
}
}
}
allprojects {
repositories {
maven(url = "https://maven.google.com")
maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
google()
mavenCentral()
maven(url = "https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
maven(url = "https://jitpack.io")
}
}
apply(from = "tasks.gradle.kts")
subprojects {
apply(plugin = "org.jlleitschuh.gradle.ktlint")
apply(plugin = "org.jetbrains.dokka")
configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
version.set("0.50.0")
android.set(true)
outputColorName.set("RED")
reporters {
reporter(ReporterType.PLAIN)
reporter(ReporterType.CHECKSTYLE)
}
}
}
val nexusUsername: String? = System.getenv("NEXUS_USERNAME")
val nexusPassword: String? = System.getenv("NEXUS_PASSWORD")
nexusPublishing {
this.repositories {
sonatype {
username.set(nexusUsername)
password.set(nexusPassword)
}
}
}