forked from adobe/aepsdk-edgeidentity-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
237 lines (199 loc) · 7.72 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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
plugins {
id 'com.android.library'
id 'jacoco'
id 'maven-publish'
id 'signing'
id 'com.diffplug.spotless'
}
jacoco {
toolVersion = rootProject.ext.jacocoVersion
}
preBuild.dependsOn spotlessApply
spotless {
java {
toggleOffOn("format:off", "format:on")
target "src/*/java/**/*.java"
removeUnusedImports()
prettier(['prettier': rootProject.ext.prettierVersion, 'prettier-plugin-java': rootProject.ext.prettierPluginJavaVersion])
.config(['parser': 'java', 'tabWidth': 4, 'useTabs': true, 'printWidth': 120])
endWithNewline()
licenseHeaderFile "../../config/formatter/adobe.header.txt"
}
}
android {
namespace 'com.adobe.marketing.mobile.edge.identity'
compileSdk rootProject.ext.compileSdkVersion
defaultConfig {
minSdk rootProject.ext.minSdkVersion
targetSdk rootProject.ext.targetSdkVersion
testInstrumentationRunner rootProject.ext.testInstrumentationRunner
consumerProguardFiles "consumer-rules.pro"
}
flavorDimensions "target"
productFlavors {
phone {
dimension "target"
}
}
buildTypes {
debug {
testCoverageEnabled true
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
testOptions {
unitTests.returnDefaultValues = true
}
compileOptions {
sourceCompatibility rootProject.ext.sourceCompatibility
targetCompatibility rootProject.ext.targetCompatibility
}
}
afterEvaluate {
tasks.withType(Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += files(android.libraryVariants.collect { variant ->
variant.javaCompileProvider.get().classpath.files
})
options {
source = "8"
links "https://developer.android.com/reference"
}
}
}
task javadocInternal(type: Javadoc) {
destinationDir = reporting.file("javadocInternal")
options.memberLevel = JavadocMemberLevel.PRIVATE
}
task javadocPublic(type: Javadoc) {
destinationDir = reporting.file("javadocPublic")
options.memberLevel = JavadocMemberLevel.PUBLIC
}
task javadocPublish(type: Jar) {
from javadocPublic
archiveClassifier.set('javadoc')
}
def isReleaseBuild() {
return hasProperty('release')
}
version = isReleaseBuild() ? rootProject.moduleVersion : rootProject.moduleVersion+"-SNAPSHOT"
publish.dependsOn('assemblePhone')
publishing {
publications {
release(MavenPublication) {
groupId = 'com.adobe.marketing.mobile'
artifactId = rootProject.moduleName
version = version
artifact("$buildDir/outputs/aar/${rootProject.moduleAARName}")
artifact javadocPublish
pom {
name = mavenRepoName
description = mavenRepoDescription
url = 'https://developer.adobe.com/client-sdks'
licenses {
license {
name = 'Adobe Proprietary'
}
}
developers {
developer {
id = 'adobe'
name = 'adobe'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:github.com//adobe/aepsdk-edgeidentity-android.git'
developerConnection = 'scm:git:ssh://github.com//adobe/aepsdk-edgeidentity-android.git'
url = 'https://github.com/adobe/aepsdk-edgeidentity-android'
}
withXml {
def dependenciesNode = asNode().appendNode('dependencies')
def coreDependencyNode = dependenciesNode.appendNode('dependency')
coreDependencyNode.appendNode('groupId', 'com.adobe.marketing.mobile')
coreDependencyNode.appendNode('artifactId', 'core')
coreDependencyNode.appendNode('version', mavenCoreVersion)
}
}
}
}
repositories {
maven {
name = "sonatype"
url = version.endsWith('SNAPSHOT') ? "https://oss.sonatype.org/content/repositories/snapshots/" : "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = System.getenv("SONATYPE_USERNAME")
password = System.getenv("SONATYPE_PASSWORD")
}
}
}
}
ext."signing.gnupg.executable"="gpg"
ext."signing.gnupg.keyName"=System.getenv("GPG_KEY_ID")
ext."signing.gnupg.passphrase"=System.getenv("GPG_PASSPHRASE")
signing {
useGpgCmd()
required {
tasks.withType(PublishToMavenRepository).find {
gradle.taskGraph.hasTask it
}
}
sign publishing.publications
}
task platformUnitTestJacocoReport(type: JacocoReport, dependsOn: "testPhoneDebugUnitTest") {
def excludeRegex = ['**/BuildConfig.class']
def debugTree = fileTree(dir: "${project.buildDir}/intermediates/javac/phoneDebug/classes/com/adobe/marketing/mobile", excludes: excludeRegex)
additionalClassDirs.setFrom files([debugTree])
additionalSourceDirs.setFrom files(android.sourceSets.main.java.sourceFiles)
sourceDirectories.setFrom files(android.sourceSets.phone.java.sourceFiles)
executionData "$buildDir/outputs/unit_test_code_coverage/phoneDebugUnitTest/testPhoneDebugUnitTest.exec"
reports {
xml.required = true
csv.required = false
html.required = true
}
}
task platformFunctionalTestJacocoReport(type: JacocoReport, dependsOn: "createPhoneDebugCoverageReport") {
def excludeRegex = ['**/BuildConfig.class']
def debugTree = fileTree(dir: "${project.buildDir}/intermediates/javac/phoneDebug/classes/com/adobe/marketing/mobile", excludes: excludeRegex)
additionalClassDirs.setFrom files([debugTree])
additionalSourceDirs.setFrom files(android.sourceSets.main.java.sourceFiles)
sourceDirectories.setFrom files(android.sourceSets.phone.java.sourceFiles)
executionData fileTree(dir: "$buildDir", includes: [
"outputs/code_coverage/phoneDebugAndroidTest/connected/*coverage.ec"
])
reports {
xml.required = true
csv.required = false
html.required = true
}
}
dependencies {
// Adobe Mobile SDK Core
// TODO: Uncomment next line when core 2.0 artifacts are published to maven
// implementation "com.adobe.marketing.mobile:core:${rootProject.mavenCoreVersion}"
implementation 'com.github.adobe.aepsdk-core-android:core:dev-v2.0.0-SNAPSHOT'
implementation 'androidx.annotation:annotation:1.3.0'
testImplementation "androidx.test.ext:junit:${rootProject.ext.junitVersion}"
testImplementation "org.mockito:mockito-core:${rootProject.ext.mockitoVersion}"
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.9.9'
testImplementation 'org.json:json:20180813'
androidTestImplementation "androidx.test.ext:junit:${rootProject.ext.junitVersion}"
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'com.fasterxml.jackson.core:jackson-databind:2.9.9'
// TODO: Uncomment next line when Identity 2.0 artifacts are published to maven
// implementation "com.adobe.marketing.mobile:identity:2.+"
androidTestImplementation ("com.github.adobe.aepsdk-core-android:identity:dev-v2.0.0-SNAPSHOT") {
transitive = false
}
}
tasks.withType(Test) {
testLogging {
showStandardStreams = true
}
}