-
Notifications
You must be signed in to change notification settings - Fork 79
/
build.gradle
148 lines (129 loc) · 5.02 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
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
maven {
url = "https://plugins.gradle.org/m2/"
}
}
ext.brainTreeVersion = "4.49.1"
ext.deps = [
"braintreeCore" : "com.braintreepayments.api:braintree-core:$brainTreeVersion",
"threeDSecure" : "com.braintreepayments.api:three-d-secure:$brainTreeVersion",
"paypal" : "com.braintreepayments.api:paypal:$brainTreeVersion",
"venmo" : "com.braintreepayments.api:venmo:$brainTreeVersion",
"googlePlay" : "com.braintreepayments.api:google-pay:$brainTreeVersion",
"googlePay" : "com.braintreepayments.api:google-pay:$brainTreeVersion",
"card" : "com.braintreepayments.api:card:$brainTreeVersion",
"dataCollector" : "com.braintreepayments.api:data-collector:$brainTreeVersion",
"unionPay" : "com.braintreepayments.api:union-pay:$brainTreeVersion",
"cardForm" : "com.braintreepayments:card-form:$brainTreeVersion"
]
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath 'de.marcphilipp.gradle:nexus-publish-plugin:0.4.0'
classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.21.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.7.20'
}
}
plugins {
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
id 'org.jetbrains.dokka' version '1.7.10'
}
version '6.16.1-SNAPSHOT'
group "com.braintreepayments"
ext {
compileSdkVersion = 34
minSdkVersion = 21
targetSdkVersion = 34
versionCode = 109
versionName = version
}
allprojects {
repositories {
google()
mavenCentral()
}
}
subprojects {
repositories {
maven {
url "https://cardinalcommerceprod.jfrog.io/artifactory/android"
credentials {
username 'braintree_team_sdk'
password 'AKCp8jQcoDy2hxSWhDAUQKXLDPDx6NYRkqrgFLRc3qDrayg6rrCbJpsKKyMwaykVL8FWusJpp'
}
}
}
}
nexusPublishing {
useStaging = !rootProject.versionName.endsWith("SNAPSHOT")
packageGroup = "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))
}
}
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("com.braintreepayments.api:drop-in:\\d+\\.\\d+\\.\\d+'", "com.braintreepayments.api:drop-in:" + versionParam + "'")
readmeFile.write(readmeFileText)
}
}
task changeMigrationGuideVersion {
doLast {
def migrationGuideFile = new File('v6_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)
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("com.braintreepayments.api:drop-in:\\d+\\.\\d+\\.\\d+-SNAPSHOT'", "com.braintreepayments.api:drop-in:" + 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)
}
}