-
Notifications
You must be signed in to change notification settings - Fork 17
/
build.gradle
140 lines (127 loc) · 5.01 KB
/
build.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
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
134
135
136
137
138
139
140
buildscript {
//Kotlin-Gradle-AGP compatibility matrix https://kotlinlang.org/docs/gradle-configure-project.html#apply-the-plugin
ext.mm_kotlinVersion = "1.8.20"
ext.mm_gradlePluginVersion = '8.5.2'
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:$mm_gradlePluginVersion"
classpath "com.android.tools:desugar_jdk_libs:1.1.5"
}
}
plugins {
id 'net.researchgate.release' version '3.0.2'
id 'maven-publish'
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
id 'org.jetbrains.kotlin.android' version "$mm_kotlinVersion" apply false
id "org.sonarqube" version "4.4.1.3373"
id "jacoco"
}
ext {
mm_minSdkVersion = 21
mm_compileSdkVersion = 35
mm_targetSdkVersion = 35
mm_buildToolsVersion = "35.0.0"
mm_firebaseMessagingVersion = "22.0.0"
mm_gmsLocationVersion = "21.0.1"
mm_constraintLayoutVersion = "2.1.4"
mm_appCompatVersion = "1.6.1"
mm_materialVersion = "1.9.0"
mm_coreKtxVersion = "1.10.1"
mm_desugarJdkVersion = "1.1.5"
mm_lifecycleVersion = "2.5.1"
mm_version = "$version"
}
allprojects {
repositories {
mavenCentral()
google()
}
}
//It's required to be applied here, to have `subprojects.publish` task available
subprojects {
apply plugin: "maven-publish"
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
kotlinOptions.jvmTarget = "1.8"
}
afterEvaluate { project ->
if (project.hasProperty('android')) {
project.android {
if (namespace == null) {
namespace project.group
}
}
}
}
}
tasks.register('publishAllPublicationsToMavenRepository') {
dependsOn subprojects.collect { it.tasks.named('publishReleasePublicationToSonatypeRepository') }
}
task updateVersionInReadme {
doLast {
def readmeFile = new File('README.md')
def text = readmeFile.text
readmeFile.withWriter { w ->
w << text.replaceFirst('infobip-mobile-messaging-android-sdk:\\d+\\.\\d+\\.\\S+@aar', "infobip-mobile-messaging-android-sdk:$version@aar")
}
}
}
task updateRtcUiVersionInReadme {
doLast {
def readmeFile = new File('infobip-rtc-ui/README.md')
def text = readmeFile.text
readmeFile.withWriter { w ->
w << text.replaceFirst("'com.infobip:infobip-rtc-ui:\\d+\\.\\d+\\.\\S+'", "'com.infobip:infobip-rtc-ui:$version'")
}
}
}
afterReleaseBuild.dependsOn updateVersionInReadme, updateRtcUiVersionInReadme
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
username = project.hasProperty('ossrhUsername') ? project.property('ossrhUsername') : System.getenv('OSSRH_USERNAME')
password = project.hasProperty('ossrhPassword') ? project.property('ossrhPassword') : System.getenv('OSSRH_PASSWORD')
stagingProfileId.set(project.hasProperty('sonatypeStagingProfileId') ? project.property('sonatypeStagingProfileId') : System.getenv('SONATYPE_STAGING_PROFILE_ID'))
}
}
connectTimeout = Duration.ofMinutes(3)
clientTimeout = Duration.ofMinutes(3)
}
closeAndReleaseSonatypeStagingRepository.mustRunAfter subprojects.publish
afterReleaseBuild.dependsOn subprojects.publish, closeAndReleaseSonatypeStagingRepository
release {
buildTasks = ['clean', 'build']
git {
requireBranch.set('')
pushToRemote.set('origin')
}
}
project.tasks.named("sonarqube").configure {
dependsOn 'lint'
dependsOn 'lintReportRelease'
}
sonar {
properties {
property "sonar.host.url", "https://sonar.ib-ci.com"
property "sonar.sourceEncoding", "UTF-8"
property "sonar.branch.name", System.getenv('BRANCH_NAME_TO_BUILD')
property "sonar.projectVersion", project.version
property "sonar.projectName", "infobip-mobile-messaging-android"
property "sonar.projectKey", "infobip-mobile-messaging-android"
property "sonar.androidLint.reportPaths", "${layout.buildDirectory}/reports/lint-results.xml"
property "sonar.exclusions", "" +
"infobip-mobile-messaging-android-demo/**/*, " +
"infobip-mobile-messaging-android-cryptor-migration/**/*, " +
"infobip-mobile-messaging-android-test/**/*, " +
"infobip-rtc-ui/**/*"
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.junit.reportsPath", "${layout.buildDirectory}/test-results/test/"
property "sonar.coverage.jacoco.xmlReportPaths", "" +
"${project.projectDir}/infobip-mobile-messaging-android-inbox-sdk/build/reports/jacoco/debugCoverage/debugCoverage.xml, " +
"${project.projectDir}/infobip-mobile-messaging-android-sdk/build/reports/jacoco/debugCoverage/debugCoverage.xml, " +
"${project.projectDir}/infobip-mobile-messaging-api-java/build/reports/jacoco/test/jacocoTestReport.xml"
}
}