Repository navigation
Expand file tree
/
Copy pathbuild.gradle
More file actions
229 lines (202 loc) · 7.13 KB
/
Copy pathbuild.gradle
File metadata and controls
229 lines (202 loc) · 7.13 KB
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
buildscript {
repositories {
mavenCentral()
google()
maven {
url = "https://plugins.gradle.org/m2/"
}
}
def sdkTargetJavaVersion = JavaVersion.VERSION_11
ext.versions = [
"javaSourceCompatibility": sdkTargetJavaVersion,
"javaTargetCompatibility": sdkTargetJavaVersion,
]
dependencies {
classpath libs.gradle
classpath libs.kotlin.gradle.plugin
classpath libs.androidx.navigation.safe.args.gradle.plugin
classpath libs.dokka.gradle.plugin
classpath libs.dokka.android.documentation.plugin
classpath libs.freemarker
}
}
plugins {
alias libs.plugins.dokka
alias libs.plugins.gradle.nexus.publish
alias libs.plugins.detekt
alias libs.plugins.android.application apply false
alias libs.plugins.android.library apply false
alias libs.plugins.kotlin.android apply false
alias libs.plugins.kotlin.parcelize apply false
alias libs.plugins.ksp apply false
alias libs.plugins.androidx.safeargs apply false
}
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 '5.34.1-SNAPSHOT'
group 'com.braintreepayments'
ext {
compileSdkVersion = 37
minSdkVersion = 23
minSdkVersionPayPalMessaging = 23
versionCode = 231
targetSdkVersion = 37
versionName = version
}
nexusPublishing {
packageGroup = project.hasProperty('nexusPackageGroup') ? project.getProperty('nexusPackageGroup') : 'com.braintreepayments'
repositories {
sonatype {
// Ref: https://central.sonatype.org/publish/publish-portal-ossrh-staging-api/#configuration
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
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 libs.detekt.formatting
detektPlugins libs.detekt.rules.libraries
}
detekt {
toolVersion = "1.23.6"
config = files("detekt/detekt-config.yml")
input = files(
"BraintreeCore/src",
"AmericanExpress/src",
"Card/src",
"Demo/src",
"GooglePay/src",
"LocalPayment/src",
"PayPal/src",
"DataCollector/src",
"PayPalMessaging/src",
"SEPADirectDebit/src",
"SharedUtils/src",
"TestUtils/src",
"ThreeDSecure/src",
"UIComponents/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 'cmVmdGtuOjAxOjIwMzgzMzI5Nzg6Q3U0eUx5Zzl5TDFnZXpQMXpESndSN2tBWHhJ'
}
}
flatDir {
dirs "${rootDir}/libs"
}
}
}
dokka {
dokkaPublications.html {
// generate into a gitignored build directory; scripts/publish-docs.sh publishes
// this to the gh-pages branch instead of committing it into main
outputDirectory.set(project.file("build/dokkaDocs"))
}
}
// Dokka V2 no longer aggregates subprojects implicitly; must list every documented module
// Must depend on new version of freemarker here to resolve security vulnerability
dependencies {
dokka project(':AmericanExpress')
dokka project(':BraintreeCore')
dokka project(':Card')
dokka project(':DataCollector')
dokka project(':GooglePay')
dokka project(':LocalPayment')
dokka project(':PayPal')
dokka project(':SEPADirectDebit')
dokka project(':ShopperInsights')
dokka project(':ThreeDSecure')
dokka project(':UIComponents')
dokka project(':Venmo')
dokkaHtmlGeneratorRuntime libs.freemarker
dokkaHtmlPublicationPlugin libs.freemarker
}
subprojects {
plugins.withId('org.jetbrains.dokka') {
dependencies {
dokkaPlugin 'com.braintreepayments.dokka:DokkaRestrictToPlugin:1.0.0'
dokkaHtmlGeneratorRuntime libs.freemarker
}
}
}
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('v5_MIGRATION_GUIDE.md')
def migrationGuideFileText = migrationGuideFile.text.replaceAll(":\\d+\\.\\d+\\.\\d+(-.*)?'", ":" + versionParam + "'")
migrationGuideFile.write(migrationGuideFileText)
}
}
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[-1].toInteger()
patchInteger++
def newPatch = patch.substring(0, patch.length() - 1) + patchInteger.toString()
def newVersion = "$major.$minor.$newPatch-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)
}
}