-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
209 lines (184 loc) · 7.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
}
}
plugins {
id "org.sonarqube" version "5.0.0.4638"
id "signing"
id "maven-publish"
id "jacoco"
}
apply plugin: "com.android.library"
android {
publishing {
singleVariant('release') {
withSourcesJar()
withJavadocJar()
}
}
compileOptions {
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
compileSdk 32
minSdk 21
consumerProguardFiles("configcat-proguard-rules.pro")
}
}
ext {
buildNumber = System.getProperty("build.number")
isSnapshot = Boolean.valueOf(System.getProperty("snapshot"))
excludes = [
'android/databinding/**/*.class',
'**/android/databinding/*Binding.class',
'**/android/databinding/*',
'**/androidx/databinding/*',
'**/BR.*',
'**/R.class',
'**/R$*.class',
'**/BuildConfig.*',
'**/Manifest*.*',
'**/*Test*.*',
'android/**/*.*',
'**/*$Result.*',
'**/*$Result$*.*'
]
}
group = "com.configcat"
version = "${version}" + (isSnapshot ? "-SNAPSHOT" : "")
repositories {
mavenLocal()
mavenCentral()
google()
}
dependencies {
api 'net.sourceforge.streamsupport:android-retrofuture:1.7.4'
api 'com.squareup.okhttp3:okhttp:4.12.0'
api 'com.squareup.okio:okio:3.4.0' // indirect dependency to solve security vulnerability in 3.2.0
api 'org.slf4j:slf4j-api:1.7.36'
api 'com.google.code.gson:gson:2.9.0'
api 'commons-codec:commons-codec:1.15'
api 'de.skuzzle:semantic-version:2.1.1'
testImplementation group: "org.junit.jupiter", name: "junit-jupiter-api", version:"5.8.0"
testImplementation group: "org.junit.jupiter", name: "junit-jupiter-params", version:"5.8.0"
testImplementation 'ch.qos.logback:logback-classic:1.3.11'
testImplementation 'ch.qos.logback:logback-core:1.3.11'
testImplementation group: "com.squareup.okhttp3", name: "mockwebserver", version:"4.11.0"
testImplementation 'org.mockito:mockito-core:4.8.0'
testImplementation 'net.sourceforge.streamsupport:android-retrofuture:1.7.4'
testRuntimeOnly group: "org.junit.jupiter", name: "junit-jupiter-engine", version:"5.8.0"
}
task javadoc(type: Javadoc) {
source android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
include("**/*.java")
afterEvaluate {
classpath += files(android.libraryVariants.collect { variant ->
variant.javaCompileProvider.get().classpath.files
})
}
}
task sourcesJar(type: Jar) {
classifier "sources"
from android.sourceSets.main.java.srcDirs
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier "javadoc"
from javadoc.destinationDir
}
sonarqube {
properties {
property "sonar.projectKey", "configcat_android-sdk"
property "sonar.projectName", "android-sdk"
property "sonar.projectVersion", "${version}-${buildNumber}"
property "sonar.organization", "configcat"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.coverage.jacoco.xmlReportPaths", "${buildDir}/reports/jacoco/report.xml"
}
}
tasks.withType(Test) { useJUnitPlatform() }
task jacocoTestReport(type:JacocoReport, dependsOn: ['testDebugUnitTest']){
reports {
csv.enabled false
html.enabled false
xml {
enabled true
destination file("${buildDir}/reports/jacoco/report.xml")
}
}
def classes = fileTree(dir: "${buildDir}/intermediates/javac/debug/classes", excludes: excludes)
sourceDirectories.setFrom(files("${project.projectDir}/src/main/java"))
classDirectories.setFrom(files([classes]))
executionData.setFrom(fileTree(dir: "$buildDir", includes: [
"/outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec",
]))
}
check.dependsOn jacocoTestReport
artifacts {
archives sourcesJar, javadocJar
}
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
from components.release
groupId 'com.configcat'
artifactId = "configcat-android-client"
version = "${version}"
pom {
name = 'ConfigCat Android SDK'
url = 'https://github.com/configcat/android-sdk'
description = 'Android SDK for ConfigCat, a feature flag, feature toggle, and configuration management service. That lets you launch new features and change your software configuration remotely without actually (re)deploying code. ConfigCat even helps you do controlled roll-outs like canary releases and blue-green deployments.'
scm {
url = "https://github.com/configcat/android-sdk"
developerConnection = "scm:git:ssh:git@github.com:configcat/android-sdk.git"
connection = "scm:git:git://github.com/configcat/android-sdk.git"
}
licenses {
license {
name = "MIT License"
url = "https://raw.githubusercontent.com/configcat/android-sdk/master/LICENSE"
}
}
organization {
url = "https://configcat.com"
name = "ConfigCat"
}
developers {
developer {
id = "configcat"
email = "developer@configcat.com"
name = "ConfigCat"
}
}
}
}
}
repositories {
maven {
credentials {
username findProperty('OSSRH_USERNAME')
password findProperty('OSSRH_PASSWORD')
}
def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots'
url = isSnapshot ? snapshotsRepoUrl : releasesRepoUrl
}
}
}
signing {
def signingKey = findProperty("SIGNING_KEY")
def signingPassphrase = findProperty("SIGNING_PASSPHRASE")
if (signingKey && signingPassphrase) {
useInMemoryPgpKeys(signingKey as String, signingPassphrase as String)
sign publishing.publications.release
}
}
}