forked from braintree/braintree_android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
233 lines (202 loc) · 8.79 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
buildscript {
repositories {
mavenCentral()
google()
maven {
url = "https://plugins.gradle.org/m2/"
}
}
def sdkTargetJavaVersion = JavaVersion.VERSION_1_8
ext.versions = [
"kotlin" : "1.7.10",
"androidxTest" : "1.4.0",
"room" : "2.4.0",
"playServices" : "19.3.0",
"javaSourceCompatibility": sdkTargetJavaVersion,
"javaTargetCompatibility": sdkTargetJavaVersion,
]
ext.deps = [
"appCompat" : "androidx.appcompat:appcompat:1.3.1",
"annotation" : "androidx.annotation:annotation:1.2.0",
"coreKtx" : "androidx.core:core-ktx:1.1.0",
// NEXT_MAJOR_VERSION: upgrade to 2.4.0 (or latest) when Java 7 support is explicitly dropped
"lifecycleRuntime" : "androidx.lifecycle:lifecycle-runtime:2.3.0",
"kotlinStdLib" : "org.jetbrains.kotlin:kotlin-stdlib:${versions.kotlin}",
"kotlinTest" : "org.jetbrains.kotlin:kotlin-test-junit:${versions.kotlin}",
// This library doesn't seem to follow the versioning pattern of the other jetbrains
// kotlin libraries. Make sure to keep this dependency in line with the kotlin version used.
"kotlinCoroutinesCore" : "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2",
"browserSwitch" : "com.braintreepayments.api:browser-switch:2.7.0",
"cardinal" : "org.jfrog.cardinalcommerce.gradle:cardinalmobilesdk:2.2.7-5",
"samsungPay" : "com.samsung.android.spay:sdk:2.5.01",
"playServicesWallet" : "com.google.android.gms:play-services-wallet:${versions.playServices}",
// NEXT_MAJOR_VERSION: upgrade to 2.7.1 (or latest) when Java 7 support is explicitly dropped
"work" : "androidx.work:work-runtime:2.7.0-alpha05",
"workTesting" : "androidx.work:work-testing:2.5.0",
"roomCompiler" : "androidx.room:room-compiler:${versions.room}",
"roomRuntime" : "androidx.room:room-runtime:${versions.room}",
"androidxTestRules" : "androidx.test:rules:${versions.androidxTest}",
"androidxTestRunner" : "androidx.test:runner:${versions.androidxTest}",
"androidxTestCore" : "androidx.test:core:${versions.androidxTest}",
"junit" : "junit:junit:4.13",
"junitTest" : "androidx.test.ext:junit:1.1.3",
"robolectric" : "org.robolectric:robolectric:4.7.3",
"dexmakerMockito" : "com.google.dexmaker:dexmaker-mockito:1.2",
"mockitoCore" : "org.mockito:mockito-core:5.3.1",
"jsonAssert" : "org.skyscreamer:jsonassert:1.5.1",
"mockk" : "io.mockk:mockk:1.13.4",
]
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.21.2'
classpath 'de.marcphilipp.gradle:nexus-publish-plugin:0.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
classpath 'androidx.navigation:navigation-safe-args-gradle-plugin:2.4.1'
classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.9.10'
classpath 'org.jetbrains.dokka:android-documentation-plugin:1.9.10'
}
}
plugins {
id 'org.jetbrains.dokka' version '1.9.10'
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
id 'io.gitlab.arturbosch.detekt' version '1.23.6'
}
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') ?: ''
ext["signing.password"] = System.getenv('SIGNING_KEY_PASSWORD') ?: ''
ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_KEY_FILE') ?: ''
allprojects {
repositories {
mavenCentral()
google()
}
}
version '4.47.1-SNAPSHOT'
group 'com.braintreepayments'
ext {
compileSdkVersion = 34
minSdkVersion = 21
minSdkVersionPayPalMessaging = 23
versionCode = 193
targetSdkVersion = 34
versionName = version
}
nexusPublishing {
packageGroup = project.hasProperty('nexusPackageGroup') ? project.getProperty('nexusPackageGroup') : 'com.braintreepayments'
repositories {
sonatype {
username = System.getenv('SONATYPE_NEXUS_USERNAME') ?: ''
password = System.getenv('SONATYPE_NEXUS_PASSWORD') ?: ''
}
}
transitionCheckOptions {
// give nexus sonatype more time to close the staging repository
delayBetween.set(Duration.ofSeconds(20))
}
}
dependencies {
detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:1.23.6"
detektPlugins "io.gitlab.arturbosch.detekt:detekt-rules-libraries:1.23.6"
}
detekt {
toolVersion = "1.23.6"
config = files("detekt/detekt-config.yml")
input = files(
"BraintreeCore/src",
"AmericanExpress/src",
"BraintreeDataCollector/src",
"Card/src",
"Demo/src",
"GooglePay/src",
"LocalPayment/src",
"PayPal/src",
"PayPalDataCollector/src",
"PayPalMessaging/src",
"PayPalNativeCheckout/src",
"SEPADirectDebit/src",
"SharedUtils/src",
"TestUtils/src",
"ThreeDSecure/src",
"Venmo/src",
"ShopperInsights/src"
)
autoCorrect = project.hasProperty('detektAutoCorrect')
reports {
html {
enabled = true
destination = file("build/reports/detekt_report.html")
}
}
}
subprojects {
repositories {
maven {
url "https://cardinalcommerceprod.jfrog.io/artifactory/android"
credentials {
username 'braintree_team_sdk'
password 'AKCp8jQcoDy2hxSWhDAUQKXLDPDx6NYRkqrgFLRc3qDrayg6rrCbJpsKKyMwaykVL8FWusJpp'
}
}
flatDir {
dirs "${rootDir}/libs"
}
}
}
dokkaHtmlMultiModule.configure {
// redirect dokka output to GitHub pages root directory
outputDirectory.set(project.file("docs"))
}
task changeGradleReleaseVersion {
doLast {
def gradleFile = new File('build.gradle')
def gradleFileText = gradleFile.text.replaceFirst("\\nversion '\\d+\\.\\d+\\.\\d+(-.*)?'", "\nversion '" + versionParam + "'")
gradleFile.write(gradleFileText)
}
}
task changeREADMEVersion {
doLast {
def readmeFile = new File('README.md')
def readmeFileText = readmeFile.text.replaceFirst(":card:\\d+\\.\\d+\\.\\d+'", ":card:" + versionParam + "'")
readmeFile.write(readmeFileText)
}
}
task changeMigrationGuideVersion {
doLast {
def migrationGuideFile = new File('v4_MIGRATION_GUIDE.md')
def migrationGuideFileText = migrationGuideFile.text.replaceAll(":\\d+\\.\\d+\\.\\d+(-.*)?'", ":" + versionParam + "'")
migrationGuideFile.write(migrationGuideFileText)
def newMigrationGuideFile = new File('v4.9.0+_MIGRATION_GUIDE.md')
def newMigrationGuideFileText = newMigrationGuideFile.text.replaceAll(":\\d+\\.\\d+\\.\\d+(-.*)?'", ":" + versionParam + "'")
newMigrationGuideFile.write(newMigrationGuideFileText)
}
}
task updateCHANGELOGVersion {
doLast {
def changelogFile = new File('CHANGELOG.md')
def changelogFileText = changelogFile.text.replaceFirst("## unreleased", "## " + versionParam + " (" + new Date().format('yyyy-MM-dd') + ")")
changelogFile.write(changelogFileText)
}
}
task incrementSNAPSHOTVersion {
doLast {
def gradleFile = new File('build.gradle')
def (major, minor, patch) = versionParam.tokenize('.')
def patchInteger = patch.toInteger()
def newVersion = "$major.$minor.${patchInteger + 1}-SNAPSHOT"
def gradleFileText = gradleFile.text.replaceFirst("\\nversion '\\d+\\.\\d+\\.\\d+(-.*)?'", "\nversion '" + newVersion + "'")
gradleFile.write(gradleFileText)
// update README snapshot version
def readmeFile = new File('README.md')
def readmeFileText = readmeFile.text.replaceFirst(":card:\\d+\\.\\d+\\.\\d+-SNAPSHOT'", ":card:" + newVersion + "'")
readmeFile.write(readmeFileText)
}
}
task incrementVersionCode {
doLast {
def gradleFile = new File('build.gradle')
def versionText = gradleFile.text.find("versionCode = \\d+")
def params = versionText.split("=")
def newVersionCode = params[1].trim().toInteger() + 1
def gradleFileText = gradleFile.text.replaceFirst("versionCode = \\d+", "versionCode = " + newVersionCode)
gradleFile.write(gradleFileText)
}
}