-
Notifications
You must be signed in to change notification settings - Fork 32
/
build.gradle
211 lines (182 loc) · 7.21 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
plugins {
id 'com.android.library'
id 'maven-publish'
}
apply from: '../common/versioning/version_tasks.gradle'
project.ext.vstsUsername = System.getenv("ENV_VSTS_MVN_ANDROIDCOMMON_USERNAME") != null ? System.getenv("ENV_VSTS_MVN_ANDROIDCOMMON_USERNAME") : project.findProperty("vstsUsername")
project.ext.vstsPassword = System.getenv("ENV_VSTS_MVN_ANDROIDCOMMON_ACCESSTOKEN") != null ? System.getenv("ENV_VSTS_MVN_ANDROIDCOMMON_ACCESSTOKEN") : project.findProperty("vstsMavenAccessToken")
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
testOptions {
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dependencies {
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$rootProject.ext.coreLibraryDesugaringVersion"
}
}
/*
//Commenting out until the next major version of common/msal/etc...
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
*/
def labClientSecret = "" // will be blank unless specified by developer
def runId = "" // will be blank unless specified by developer
def saveTestResultsToCsv = false
if (project.hasProperty("labSecret")) {
labClientSecret = labSecret
}
if (project.hasProperty("buildId")) {
runId = buildId
}
if (project.hasProperty("writeTestResultsToCsv")) {
saveTestResultsToCsv = getBoolean(writeTestResultsToCsv);
}
defaultConfig {
multiDexEnabled true
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField("String", "LAB_CLIENT_SECRET", "\"$labClientSecret\"")
buildConfigField("String", "RUN_ID", "\"$runId\"")
buildConfigField("boolean", "SAVE_TEST_RESULTS_TO_CSV", "$saveTestResultsToCsv")
}
lintOptions {
disable 'InvalidPackage'
}
buildTypes {
debug {
testCoverageEnabled false
debuggable true
}
release {
testCoverageEnabled false
minifyEnabled false
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
testOptions {
unitTests.all {
exclude 'com/microsoft/identity/internal/testutils/lab/'
}
}
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier 'sources'
}
tasks.whenTaskAdded { task ->
if (task.name == 'assembleDebug' || task.name == 'assembleRelease') {
task.dependsOn 'sourcesJar'
}
}
project.afterEvaluate{
publishing {
publications {
aar(MavenPublication) {
artifact "$buildDir/outputs/aar/testutils-release.aar"
artifact sourcesJar
groupId 'com.microsoft.identity'
artifactId = 'testutils'
version = getAppVersionName()
pom.withXml {
// Dependencies
def dependenciesNode = asNode().appendNode('dependencies')
//Iterate over the implementation dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.implementation.allDependencies.each {
if (it.group != null && it.name != null) {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
repositories {
maven {
name "vsts-maven-adal-android"
url "https://identitydivision.pkgs.visualstudio.com/_packaging/AndroidADAL/maven/v1"
credentials {
username project.ext.vstsUsername
password project.ext.vstsPassword
}
}
maven {
name "vsts-maven-android"
url 'https://identitydivision.pkgs.visualstudio.com/IDDP/_packaging/Android/maven/v1'
credentials {
username project.vstsUsername
password project.vstsPassword
}
}
}
}
}
dependencies {
//Commenting out until the next major version of common/msal/etc...
//Java 8 - Desugaring
//coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$rootProject.ext.coreLibraryDesugaringVersion"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':keyvault')
implementation project(':labapi')
if (findProject(":common") != null) {
//Use project reference if available
implementation(project(":common")) {
transitive = false
}
} else {
//Always use the latest release
implementation(group: 'com.microsoft.identity', name: 'common', version: '0.0.+')
}
// keyvault per product flavor
if (findProject(":keyvault") != null) {
//Use project reference if available
implementation(project(":keyvault")) {
transitive = true
}
} else {
//Always use the latest release
implementation(group: 'com.microsoft.identity', name: 'keyvault', version: '0.0.+')
}
// labapi per product flavor
if (findProject(":labapi") != null) {
//Use project reference if available
implementation(project(":labapi")) {
transitive = true
}
} else {
//Always use the latest release
implementation(group: 'com.microsoft.identity', name: 'labapi', version: '0.0.+')
}
implementation "androidx.test:core:$rootProject.ext.androidxTestCoreVersion"
implementation "com.google.code.gson:gson:$rootProject.ext.gsonVersion"
implementation "com.nimbusds:nimbus-jose-jwt:$rootProject.ext.nimbusVersion"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation "junit:junit:$rootProject.ext.junitVersion"
implementation ("org.robolectric:robolectric:$rootProject.ext.robolectricVersion") {
exclude group: "org.apache.maven"
exclude group: "org.apache.maven.wagon"
exclude group: "xmlpull"
exclude group: "xpp3"
}
compileOnly "org.projectlombok:lombok:$rootProject.ext.lombokVersion"
annotationProcessor "org.projectlombok:lombok:$rootProject.ext.lombokVersion"
}
static boolean getBoolean(final String s) {
return s == null ? false : s.toBoolean();
}