-
Notifications
You must be signed in to change notification settings - Fork 237
/
build.gradle
192 lines (169 loc) · 5.78 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
buildscript {
repositories {
mavenCentral()
google()
maven {
url = "https://plugins.gradle.org/m2/"
}
}
def sdkTargetJavaVersion = JavaVersion.VERSION_17
ext.versions = [
"javaSourceCompatibility": sdkTargetJavaVersion,
"javaTargetCompatibility": sdkTargetJavaVersion,
]
dependencies {
classpath libs.gradle
classpath libs.gradle.nexus.staging.plugin
classpath libs.kotlin.gradle.plugin
classpath libs.androidx.navigation.safe.args.gradle.plugin
classpath libs.dokka.gradle.plugin
classpath libs.dokka.android.documentation.plugin
}
}
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.2.1-SNAPSHOT'
group 'com.braintreepayments'
ext {
compileSdkVersion = 35
minSdkVersion = 23
minSdkVersionPayPalMessaging = 23
versionCode = 198
targetSdkVersion = 35
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 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",
"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"
}
}
}
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('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)
}
}